ApplyKeyWords() публичный статический Метод

Applies the key words "%%title%%" etc. https://meta.wikimedia.org/wiki/Help:Magic_words
public static ApplyKeyWords ( string title, string text ) : string
title string
text string
Результат string
Пример #1
0
 public DynamicRegexArticleComparer(string comparator, RegexOptions options)
 {
     Comparator = comparator;
     Options    = (options & ~RegexOptions.Compiled);
     // Create a regex to try it out. Throws an exception if there's a regex error
     new Regex(Tools.ApplyKeyWords("a", comparator), options);
 }
Пример #2
0
        /// <summary>
        /// Returns true if the article should be skipped based on the text it does or doesn't contain
        /// </summary>
        /// <param name="FindText">The text to find</param>
        /// <param name="regEx">True if FindText contains a regular expression</param>
        /// <param name="caseSensitive">True if the search should be case sensitive</param>
        /// <param name="DoesContain">True if the article should be skipped if it contains the text, false if it should be skipped if it does *not* contain the text</param>
        /// <returns>A boolean value indicating whether or not the article should be skipped</returns>
        public bool SkipIfContains(string FindText, bool regEx, bool caseSensitive, bool DoesContain)
        {
            if (FindText.Length > 0)
            {
                RegexOptions regexOptions = (caseSensitive) ? RegexOptions.None : RegexOptions.IgnoreCase;

                FindText = Tools.ApplyKeyWords(Name, FindText);

                if (!regEx)
                {
                    FindText = Regex.Escape(FindText);
                }

                if (Regex.IsMatch(OriginalArticleText, FindText, regexOptions))
                {
                    return(DoesContain);
                }

                return(!DoesContain);
            }

            return(false);
        }
Пример #3
0
        /// <summary>
        /// Returns true if the article should be skipped based on the text it does or doesn't contain
        /// </summary>
        /// <param name="FindText">The text to find</param>
        /// <param name="Regexe">True if FindText contains a regular expression</param>
        /// <param name="caseSensitive">True if the search should be case sensitive</param>
        /// <param name="DoesContain">True if the article should be skipped if it contains the text, false if it should be skipped if it does *not* contain the text</param>
        /// <returns>A boolean value indicating whether or not the article should be skipped</returns>
        public bool SkipIfContains(string FindText, bool RegEx, bool CaseSensitive, bool DoesContain)
        {
            if (FindText.Length > 0)
            {
                RegexOptions regexOptions;

                if (CaseSensitive)
                {
                    regexOptions = RegexOptions.None;
                }
                else
                {
                    regexOptions = RegexOptions.IgnoreCase;
                }

                FindText = Tools.ApplyKeyWords(this.Name, FindText);

                if (!RegEx)
                {
                    FindText = Regex.Escape(FindText);
                }

                if (Regex.IsMatch(this.OriginalArticleText, FindText, regexOptions))
                {
                    return(DoesContain);
                }
                else
                {
                    return(!DoesContain);
                }
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
 public bool Matches(Article article)
 {
     return(article.ArticleText.IndexOf(Tools.ApplyKeyWords(article.Name, Comparator), StringComparison.CurrentCultureIgnoreCase) >= 0);
     // or should that be OrdinalIgnoreCase?
 }
Пример #5
0
 public bool Matches(Article article)
 {
     return(article.ArticleText.Contains(Tools.ApplyKeyWords(article.Name, Comparator)));
 }
Пример #6
0
        public bool Matches(Article article)
        {
            string text = Tools.ConvertFromLocalLineEndings(article.ArticleText);

            return(text.IndexOf(Tools.ApplyKeyWords(article.Name, Comparator), StringComparison.CurrentCultureIgnoreCase) >= 0);
        }
Пример #7
0
        public bool Matches(Article article)
        {
            string text = Tools.ConvertFromLocalLineEndings(article.ArticleText);

            return(text.Contains(Tools.ApplyKeyWords(article.Name, Comparator)));
        }
Пример #8
0
        public bool Matches(Article article)
        {
            string text = Tools.ConvertFromLocalLineEndings(article.ArticleText);

            return(Regex.IsMatch(text, Tools.ApplyKeyWords(article.Name, Comparator), Options));
        }
 public bool Matches(Article article)
 {
     return(Regex.IsMatch(article.ArticleText, Tools.ApplyKeyWords(article.Name, Comparator), Options));
 }