• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Parse.Parsers类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WikiFunctions.Parse.Parsers的典型用法代码示例。如果您正苦于以下问题:C# Parsers类的具体用法?C# Parsers怎么用?C# Parsers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Parsers类属于WikiFunctions.Parse命名空间,在下文中一共展示了Parsers类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AutoTag

        public void AutoTag()
        {
            #if DEBUG
            const string LongText =
            @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dictum ultrices augue. Fusce sem diam, vestibulum sit amet, vehicula id, congue a, nisl. Phasellus pulvinar posuere purus. Donec elementum justo mattis nulla. Sed a purus dictum lacus pharetra adipiscing. Nam non dui non ante viverra iaculis. Fusce euismod lacus id nulla vulputate gravida. Suspendisse lectus pede, tempus sed, tristique id, pharetra eget, urna. Integer mattis libero vel quam accumsan suscipit. Vivamus molestie dapibus est. Quisque quis metus eget nisl accumsan aliquet. Donec tempus pellentesque tellus. Aliquam lacinia gravida justo. Aliquam erat volutpat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris ultricies suscipit urna. Ut mollis tempor leo. Pellentesque fringilla mattis enim. Proin sapien enim, congue non, aliquet et, sollicitudin nec, mauris. Sed porta.

            Curabitur luctus mollis massa. Nullam consectetur mollis lacus. Suspendisse turpis. Fusce velit. Morbi egestas dui. Donec commodo ornare lorem. Vestibulum sodales. Curabitur egestas libero ut metus. Sed eget orci a ligula consectetur vestibulum. Cras sapien.

            Sed libero. Ut volutpat massa. Donec nulla pede, porttitor eu, sodales et, consectetur nec, quam. Pellentesque vestibulum hendrerit est. Nulla facilisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis et nibh eu lacus iaculis pretium. Fusce sed turpis. In cursus. Etiam interdum augue. Morbi commodo auctor ligula. In imperdiet, neque nec hendrerit consequat, lacus purus tristique turpis, eu hendrerit ipsum ligula at libero. Duis varius nunc vel tortor. Praesent tempor. Nunc non pede at velit congue feugiat. Curabitur gravida, nisl quis mattis porttitor, purus nulla viverra dui, non suscipit augue nunc ac libero. Donec lacinia est non augue.

            Nulla quam dui, tristique id, condimentum sed, sodales in, ante. Vestibulum vitae diam. Integer placerat ante non orci. Nulla gravida. Integer magna enim, iaculis ut, ornare dignissim, ultrices a, urna. Donec urna. Fusce fringilla, pede vitae pulvinar ullamcorper, est nisi eleifend ipsum, ac adipiscing odio massa vehicula neque. Sed blandit est. Morbi faucibus, nisl vel commodo vulputate, mi ipsum tincidunt sem, id ornare orci orci et velit. Morbi commodo sollicitudin ligula. Pellentesque vitae urna. Duis massa arcu, accumsan id, euismod eu, tincidunt et, odio. Phasellus purus leo, rhoncus sed, condimentum nec, vestibulum vel, lacus. In egestas, lectus vitae lacinia tristique, elit magna consequat risus, id sodales metus nulla ac pede. Suspendisse potenti.

            Fusce massa. Nullam lacinia purus nec ipsum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse potenti. Proin augue. Donec mi magna, interdum a, elementum quis, bibendum sit amet, felis. Donec vel libero eget magna hendrerit ultrices. Suspendisse potenti. Sed scelerisque lacinia nisi. Quisque elementum, nunc nec luctus iaculis, ante quam aliquet orci, et ullamcorper dui ipsum at mi. Vestibulum a dolor id tortor posuere elementum. Sed mauris nisl, ultrices a, malesuada non, convallis ac, velit. Sed aliquam elit id metus. Donec malesuada, lorem ut pharetra auctor, mi risus viverra enim, vitae pulvinar urna metus at lorem. Vivamus id lorem. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla facilisi. Ut vel odio. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque lobortis sem.

            Proin in odio. Pellentesque [[habitant]] [[morbi]] [[tristique]] senectus et netus et malesuada fames ac turpis egestas. Vivamus bibendum arcu nec risus. Nulla iaculis ligula in purus. Etiam vulputate nibh sit amet lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Suspendisse eleifend. Donec blandit nibh hendrerit turpis. Integer accumsan posuere odio. Ut commodo augue malesuada risus. Curabitur augue. Praesent volutpat nunc a diam. Nulla lobortis interdum dolor. Nunc imperdiet, ipsum ac tempor iaculis, nunc.
            ";
            Article a = new Article("A", "ABC");
            Parsers p = new Parsers(500, true);
            a.AutoTag(p, true, true);
            Assert.IsFalse(a.NoArticleTextChanged);

            a = new Article("A", LongText);
            Globals.UnitTestIntValue = 1;
            Globals.UnitTestBoolValue = false;
            a.AutoTag(p, true, true);
            Assert.IsTrue(a.NoArticleTextChanged);
            #endif
        }
开发者ID:svn2github,项目名称:awb,代码行数:28,代码来源:MiscellaneousTests.cs


示例2: ProcessArticle

        public string ProcessArticle(IAutoWikiBrowser sender, ProcessArticleEventArgs eventargs)
        {
            //If menu item is not checked, then return
            if (!PluginEnabled || Settings.Images.Count == 0)
            {
                eventargs.Skip = false;
                return eventargs.ArticleText;
            }

            eventargs.EditSummary = "";
            string text = eventargs.ArticleText;

            Parsers parse = new Parsers();

            foreach (KeyValuePair<string, string> p in Settings.Images)
            {
                bool noChange;

                if (p.Value.Length == 0)
                {
                    text = parse.RemoveImage(p.Key, text, Settings.Comment, "", out noChange);
                    if (!noChange) eventargs.EditSummary += ", removed " + Variables.Namespaces[6] + p.Key;
                }
                else
                {
                    text = parse.ReplaceImage(p.Key, p.Value, text, out noChange);
                    if (!noChange) eventargs.EditSummary += ", replaced: " + Variables.Namespaces[6]
                         + p.Key + FindandReplace.Arrow + Variables.Namespaces[6] + p.Value;
                }
                if (!noChange) text = Regex.Replace(text, "<includeonly>[\\s\\r\\n]*\\</includeonly>", "");
            }

            eventargs.Skip = (text == eventargs.ArticleText) && Settings.Skip;

            return text;
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:36,代码来源:IfdCore.cs


示例3: HasNoBoldTitle

 public HasNoBoldTitle(Parsers p)
 {
     parsers = p;
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:4,代码来源:Scanners.cs


示例4: RequiresParser

 public RequiresParser()
 {
     parser = new Parsers();
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:4,代码来源:ParserTests.cs


示例5: Unicodify

        public void Unicodify()
        {
            Parsers Parser = new Parsers();
            HideText RemoveText = new HideText(false, true, false);
            Article a = new Article("a", @"'''test'''. z &amp; a&Dagger; &dagger;.

            {{DEFAULTSORT:Hello test}}
            [[Category:Test pages]]
            ");

            a.Unicodify(true, Parser, RemoveText);

            Assert.AreEqual(@"'''test'''. z & a‡ †.

            {{DEFAULTSORT:Hello test}}
            [[Category:Test pages]]
            ", a.ArticleText, "Text unicodified");

            a = new Article("a", @"'''test'''. z &amp; {{t|a&Dagger; &dagger;}}.

            {{DEFAULTSORT:Hello test}}
            [[Category:Test pages]]
            ");

            a.Unicodify(true, Parser, RemoveText);

            Assert.AreEqual(@"'''test'''. z & {{t|a&Dagger; &dagger;}}.

            {{DEFAULTSORT:Hello test}}
            [[Category:Test pages]]
            ", a.ArticleText, "Text unicodified, hidemore used");

            a = new Article("a", @"ABC");
            a.Unicodify(true, Parser, RemoveText);
            Assert.AreEqual(@"ABC", a.ArticleText, "No change");
        }
开发者ID:svn2github,项目名称:awb,代码行数:36,代码来源:MiscellaneousTests.cs


示例6: EmboldenTitles

 public void EmboldenTitles()
 {
     Parsers Parser = new Parsers();
     Article a = new Article("a", @"A [[B]]");
     a.EmboldenTitles(Parser, true);
     Assert.IsTrue(a.ArticleText.Contains("[[B]]"));
 }
开发者ID:svn2github,项目名称:awb,代码行数:7,代码来源:MiscellaneousTests.cs


示例7: RequiresParser2

		public RequiresParser2()
		{
			parser2 = new Parsers();
		}
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:4,代码来源:SorterTests.cs


示例8: ConvertDate

          /// <summary>
        /// Returns the input date in the requested format (American or International). If another Locale is pasased in the input date is returned. For en-wiki only.
        /// </summary>
        /// <param name="inputDate">string representing a date, any format that C# can parse</param>
        /// <param name="locale">Locale of output date required (American/International/ISO)</param>
        /// <param name="AmericanInputDate">Whether the input date is in American MM/DD/YYYY format</param>
        /// <returns>The English-language (American or International) date</returns>
        public static string ConvertDate(string inputDate, Parsers.DateLocale locale, bool AmericanInputDate)
        {
            if (Variables.LangCode != "en" || YearMon.IsMatch(inputDate) || MonthYear.IsMatch(inputDate))
                return inputDate;

            DateTime dt;

            try
            {
                dt = Convert.ToDateTime(inputDate, AmericanInputDate ? AmericanEnglish : BritishEnglish);
            }
            catch
            {
                return inputDate;
            }

            switch (locale)
            {
                case Parsers.DateLocale.American:
                    return dt.ToString("MMMM d, yyyy", BritishEnglish);
                case Parsers.DateLocale.International:
                    return dt.ToString("d MMMM yyyy", BritishEnglish);
                case  Parsers.DateLocale.ISO:
                     return dt.ToString("yyyy-MM-dd", BritishEnglish);
                default:
                    return inputDate;
            }
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:35,代码来源:Tools.cs


示例9: CleanDerivedReferenceName

        /// <summary>
        /// Removes various unwanted punctuation and comment characters from a derived reference name
        /// </summary>
        /// <param name="derivedName">the input reference name</param>
        /// <returns>the cleaned reference name</returns>
        private static string CleanDerivedReferenceName(string derivedName)
        {
            derivedName = WikiRegexes.PipedWikiLink.Replace(derivedName, "$2"); // piped wikilinks -> text value

            derivedName = CommentOrFloorNumber.Replace(derivedName, "");
            // rm comments from ref name, might be masked
            derivedName = derivedName.Trim(CharsToTrim.ToCharArray());
            derivedName = SequenceOfQuotesInDerivedName.Replace(derivedName, ""); // remove chars
            derivedName = WhitespaceInDerivedName.Replace(derivedName, " "); // spacing fixes
            derivedName = derivedName.Replace(@"&ndash;", "–");

            Parsers p = new Parsers();
            derivedName = p.FixDatesA(derivedName);
            derivedName = p.FixDatesB(derivedName, false, false);

            return DateRetrievedOrAccessed.IsMatch(derivedName) ? "" : derivedName;
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:22,代码来源:Parsers.cs


示例10: AddMissingReflist

        /// <summary>
        /// First checks for a &lt;references&lt; missing '/' to correct, otherwise:
        /// if the article uses cite references but has no recognised template to display the references, add {{Reflist}} in the appropriate place
        /// </summary>
        /// <param name="articleText">The wiki text of the article</param>
        /// <returns>The updated article text</returns>
        public static string AddMissingReflist(string articleText)
        {
            if (!IsMissingReferencesDisplay(articleText) || !Variables.LangCode.Equals("en"))
                return articleText;

            if (ReferencesMissingSlash.IsMatch(articleText))
                return ReferencesMissingSlash.Replace(articleText, @"<references/>");

            // Rename ==Links== to ==External links==
            articleText = LinksHeading.Replace(articleText, "$1External links$2");

            // add to any existing references section if present
            if (ReferencesHeadingLevel2.IsMatch(articleText))
                articleText = ReferencesHeadingLevelLower.Replace(articleText, "$1\r\n{{Reflist}}");
            else
            {
                articleText += "\r\n==References==\r\n{{Reflist}}";

                // now sort metadata in case Category at top of article
                Parsers p = new Parsers();
                articleText = p.SortMetaData(articleText, "A", false);

                // try to move just above external links
                if (ExternalLinksHeading.IsMatch(articleText))
                    articleText = ExternalLinksToReferences.Replace(articleText, "$2\r\n$1");
                else if (Category.IsMatch(articleText))
                    // try to move just above categories
                    articleText = CategoryToReferences.Replace(articleText, "$3\r\n$1$2");
                else // not moved, so extra blank line required before heading
                    articleText = articleText.Replace("\r\n==References==", "\r\n\r\n==References==");
            }

            return articleText;
        }
开发者ID:svn2github,项目名称:awb,代码行数:40,代码来源:References.cs


示例11: Tagger


//.........这里部分代码省略.........
            // nl wiki doesn't use {{Uncategorized}} template
            // prevent wictionary redirects from being tagged as uncategorised
            if (words > 6 && totalCategories == 0
                && !WikiRegexes.Uncat.IsMatch(articleText)
                && Variables.LangCode != "nl"
                && !Tools.NestedTemplateRegex("cat improve").IsMatch(articleText)
                // category count is from API; don't add uncat tag if genfixes added person categories
                && !WikiRegexes.DeathsOrLivingCategory.IsMatch(articleText)
                && !WikiRegexes.BirthsCategory.IsMatch(articleText))
            {
                if (WikiRegexes.Stub.IsMatch(commentsStripped))
                {
                    // add uncategorized stub tag
                    articleText += Tools.Newline("{{Uncategorized stub|", 2) + WikiRegexes.DateYearMonthParameter +
                        @"}}";
                    tagsAdded.Add("[[CAT:UNCATSTUBS|uncategorised]]");
                }
                else
                {
                    // add uncategorized tag
                    articleText += Tools.Newline("{{Uncategorized|", 2) + WikiRegexes.DateYearMonthParameter + @"}}";
                    tagsAdded.Add("[[CAT:UNCAT|uncategorised]]");
                }
            }

            // remove {{Uncategorized}} if > 0 real categories (stub categories not counted)
            // rename {{Uncategorized}} to {{Uncategorized stub}} if stub with zero categories (stub categories not counted)
            if (WikiRegexes.Uncat.IsMatch(articleText))
            {
                if (totalCategories > 0)
                {
                    articleText = WikiRegexes.Uncat.Replace(articleText, "");
                    tagsRemoved.Add("uncategorised");
                }
                else if (totalCategories == 0 && WikiRegexes.Stub.IsMatch(commentsStripped))
                {
                    string uncatname = WikiRegexes.Uncat.Match(articleText).Groups[1].Value;
                    if (!uncatname.Contains("stub"))
                        articleText = Tools.RenameTemplate(articleText, uncatname, "Uncategorized stub");
                }
            }

            if (linkCount == 0 && !WikiRegexes.DeadEnd.IsMatch(articleText) && Variables.LangCode != "sv"
                && !Regex.IsMatch(WikiRegexes.MultipleIssues.Match(articleText).Value.ToLower(), @"\bdead ?end\b"))
            {
                // add dead-end tag
                articleText = "{{dead end|" + WikiRegexes.DateYearMonthParameter + "}}\r\n\r\n" + articleText;
                tagsAdded.Add("[[:Category:Dead-end pages|deadend]]");
            }

            if (linkCount < 3 && underlinked && !WikiRegexes.Wikify.IsMatch(articleText)
                && !WikiRegexes.MultipleIssues.Match(articleText).Value.ToLower().Contains("wikify"))
            {
                // add wikify tag
                articleText = "{{Wikify|" + WikiRegexes.DateYearMonthParameter + "}}\r\n\r\n" + articleText;
                tagsAdded.Add("[[WP:WFY|wikify]]");
            }
            else if (linkCount > 3 && !underlinked &&
                     WikiRegexes.Wikify.IsMatch(articleText))
            {
                articleText = WikiRegexes.Wikify.Replace(articleText, new MatchEvaluator(SectionTagME));
                
                if(!WikiRegexes.Wikify.IsMatch(articleText))
                    tagsRemoved.Add("wikify");
            }

            // rename unreferenced --> refimprove if has existing refs
            if (WikiRegexes.Unreferenced.IsMatch(commentsCategoriesStripped)
                && WikiRegexes.Refs.Matches(commentsCategoriesStripped).Count > 0)
            {
                articleText = Tools.RenameTemplate(articleText, "unreferenced", "refimprove", true);
                
                Match m = WikiRegexes.MultipleIssues.Match(articleText);
                if(m.Success)
                {
                    string newValue = Tools.RenameTemplateParameter(m.Value,  "unreferenced", "refimprove");
                    if(!newValue.Equals(m.Value))
                        articleText = articleText.Replace(m.Value, newValue);
                }
            }

            if (tagsAdded.Count > 0 || tagsRemoved.Count > 0)
            {
                Parsers p = new Parsers();
                HideText ht = new HideText();

                articleText = ht.HideUnformatted(articleText);

                articleText = p.MultipleIssues(articleText);
                articleText = Conversions(articleText);
                articleText = ht.AddBackUnformatted(articleText);

                // sort again in case tag removal requires whitespace cleanup
                articleText = p.Sorter.Sort(articleText, articleTitle);
            }

            summary = PrepareTaggerEditSummary();

            return articleText;
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:101,代码来源:Parsers.cs


示例12: MissingDefaultsort

 public MissingDefaultsort(Parsers p)
 {
     parsers = p;
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:4,代码来源:Scanners.cs


示例13: LivingPerson

 public LivingPerson(Parsers p)
 {
     parsers = p;
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:4,代码来源:Scanners.cs


示例14: HasSectionError

 public HasSectionError(Parsers p)
 {
     parsers = p;
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:4,代码来源:Scanners.cs


示例15: HasHTMLEntities

 public HasHTMLEntities(Parsers p)
 {
     parsers = p;
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:4,代码来源:Scanners.cs


示例16: ExpandTemplate

        /// <summary>
        /// Expands (substitutes) template calls
        /// </summary>
        /// <param name="articleText">The text of the article</param>
        /// <param name="articleTitle">The title of the artlce</param>
        /// <param name="regexes">Dictionary of templates to substitute</param>
        /// <param name="includeComment"></param>
        /// <returns>The updated article text</returns>
        public static string ExpandTemplate(string articleText, string articleTitle, Dictionary<Regex, string> regexes, bool includeComment)
        {
            foreach (KeyValuePair<Regex, string> p in regexes)
            {
                string originalArticleText = "";
                
                while(!originalArticleText.Equals(articleText))
                {
                    originalArticleText = articleText;
                    // avoid matching on previously commented out calls
                    Match m = p.Key.Match(Tools.ReplaceWithSpaces(articleText, WikiRegexes.Comments));
                    if(!m.Success)
                        continue;
                    
                    string call = m.Value, result;
                    
                    if(Globals.UnitTestMode)
                        result = "Expanded template test return";
                    else
                    {
                        string expandUri = Variables.URLApi + "?action=expandtemplates&format=xml&title=" + WikiEncode(articleTitle) + "&text=" + HttpUtility.UrlEncode(call);
                    
                        try
                        {
                            string respStr = GetHTML(expandUri);
                            Match m1 = ExpandTemplatesRegex.Match(respStr);
                            if (!m.Success) continue;
                            result = HttpUtility.HtmlDecode(m1.Groups[1].Value);
                        }
                        catch
                        {
                            continue;
                        }
                    }

                    bool skipArticle;
                    result = new Parsers().Unicodify(result, out skipArticle);
                    
                    if (includeComment)
                        result = result + "<!-- " + call + " -->";

                    articleText = articleText.Replace(call, result);
                }
            }

            return articleText;
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:55,代码来源:Tools.cs


示例17: FixCitationTemplatesME


//.........这里部分代码省略.........

            // date = YYYY --> year = YYYY if year the same
            // with Lua no need to rename date to year when date = YYYY
            if (TheDate.Length == 4)
            {
                if(TheYear.Equals(TheDate))
                    newValue = Tools.RemoveTemplateParameter(newValue, "date");
            }

            // year = full date --> date = full date
            if (TheYear.Length > 5)
            {
                string TheYearCorected = IncorrectCommaInternationalDates.Replace(TheYear, @"$1 $2");
                TheYearCorected = IncorrectCommaAmericanDates.Replace(TheYearCorected, @"$1 $2, $3");
                
                if(!TheYearCorected.Equals(TheYear))
                {
                    newValue = Tools.UpdateTemplateParameterValue(newValue, "year", TheYearCorected);
                    TheYear = TheYearCorected;
                }
            }
            
            if (TheYear.Length > 5 && (WikiRegexes.ISODates.IsMatch(TheYear) || WikiRegexes.InternationalDates.IsMatch(TheYear)
                                       || WikiRegexes.AmericanDates.IsMatch(TheYear)))
            {
                TheDate = TheYear;
                TheYear = "";
                newValue = Tools.RenameTemplateParameter(newValue, "year", "date");
            }

            // year=YYYY and date=...YYYY -> remove year; not for year=YYYYa
            if (TheYear.Length == 4 && TheDate.Contains(TheYear) && YearOnly.IsMatch(TheYear))
            {
                Parsers p = new Parsers();
                TheDate = p.FixDatesAInternal(TheDate);

                if(WikiRegexes.InternationalDates.IsMatch(TheDate) || WikiRegexes.AmericanDates.IsMatch(TheDate)
                   || WikiRegexes.ISODates.IsMatch(TheDate))
                {
                    TheYear = "";
                    newValue = Tools.RemoveTemplateParameter(newValue, "year");
                }
            }

            // month=Month and date=...Month... OR month=Month and date=same month (by conversion from ISO format)Ors month=nn and date=same month (by conversion to ISO format)
            int num;
            if ((TheMonth.Length > 2 && TheDate.Contains(TheMonth)) // named month within date
                || (TheMonth.Length > 2 && Tools.ConvertDate(TheDate, DateLocale.International).Contains(TheMonth))
                || (int.TryParse(TheMonth, out num) && Regex.IsMatch(Tools.ConvertDate(TheDate, DateLocale.ISO), @"\-0?" + TheMonth + @"\-")))
                newValue = Tools.RemoveTemplateParameter(newValue, "month");

            // date = Month DD and year = YYYY --> date = Month DD, YYYY
            if (!YearOnly.IsMatch(TheDate) && YearOnly.IsMatch(TheYear))
            {
                if (!WikiRegexes.AmericanDates.IsMatch(TheDate) && WikiRegexes.AmericanDates.IsMatch(TheDate + ", " + TheYear))
                {
                    if(!TheDate.Contains(TheYear))
                        newValue = Tools.SetTemplateParameterValue(newValue, "date", TheDate + ", " + TheYear);
                    newValue = Tools.RemoveTemplateParameter(newValue, "year");
                }
                else if (!WikiRegexes.InternationalDates.IsMatch(TheDate) && WikiRegexes.InternationalDates.IsMatch(TheDate + " " + TheYear))
                {
                    if(!TheDate.Contains(TheYear))
                        newValue = Tools.SetTemplateParameterValue(newValue, "date", TheDate + " " + TheYear);
                    newValue = Tools.RemoveTemplateParameter(newValue, "year");
                }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:67,代码来源:Parsers.cs


示例18: MainForm

        public MainForm()
        {
            SplashScreen.Show(this);
            RightToLeft = System.Globalization.CultureInfo.CurrentCulture.TextInfo.IsRightToLeft
                ? RightToLeft.Yes : RightToLeft.No;
            InitializeComponent();
            SplashScreen.SetProgress(5);
            try
            {
                btntsShowHide.Image = Resources.Showhide;
                btntsShowHideParameters.Image = Resources.Showhideparameters;
                btntsSave.Image = Resources.Save;
                btntsIgnore.Image = Resources.RightArrow;
                btntsStop.Image = Resources.Stop;
                btntsPreview.Image = Resources.preview;
                btntsChanges.Image = Resources.changes;
                btntsFalsePositive.Image = Resources.RollBack;
                btntsStart.Image = Resources.Run;
                btntsDelete.Image = Resources.Vista_trashcan_empty;

                SplashScreen.SetProgress(10);
                try
                {
                    Parser = new Parsers(Properties.Settings.Default.StubMaxWordCount,
                        Properties.Settings.Default.AddHummanKeyToCats);
                }
                catch (Exception ex)
                {
                    Parser = new Parsers();
                    ErrorHandler.Handle(ex);
                }

                toolStripComboOnLoad.SelectedIndex = 0;
                cmboCategorise.SelectedIndex = 0;
                cmboImages.SelectedIndex = 0;

                Variables.User.UserNameChanged += UpdateUserName;
                Variables.User.BotStatusChanged += UpdateBotStatus;
                Variables.User.AdminStatusChanged += UpdateAdminStatus;
                //Variables.User.WikiStatusChanged += UpdateWikiStatus;

                Variables.User.WebBrowserLogin.DocumentCompleted += WebLoginCompleted;
                Variables.User.WebBrowserLogin.Navigating += WebLoginStarting;

                webBrowserEdit.Deleted += CaseWasDelete;
                webBrowserEdit.Loaded += CaseWasLoad;
                webBrowserEdit.Saved += CaseWasSaved;
                webBrowserEdit.None += CaseWasNull;
                webBrowserEdit.Fault += StartDelayedRestartTimer;
                webBrowserEdit.StatusChanged += UpdateWebBrowserStatus;
                listMaker.UserInputTextBox.ContextMenuStrip = mnuMakeFromTextBox;
                listMaker.BusyStateChanged += SetProgressBar;
                listMaker.NoOfArticlesChanged += UpdateButtons;
                listMaker.StatusTextChanged += UpdateListStatus;
                listMaker.cmboSourceSelect.SelectedIndexChanged += ListMakerSourceSelectHandler;

                Profiles = new WikiFunctions.Profiles.AWBProfilesForm(webBrowserEdit);
                Profiles.LoadProfile += LoadProfileSettings;

                SplashScreen.SetProgress(15);
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:66,代码来源:Main.cs


示例19: FormatToBDA

        /// <summary>
        /// takes input string of date and age e.g. "11 May 1990 (age 21)" and converts to {{birth date and age|1990|5|11}}
        /// </summary>
        /// <param name="dateandage"></param>
        /// <returns></returns>
        public static string FormatToBDA(string dateandage)
        {
            Parsers p = new Parsers();
            string original = dateandage;
            // clean up date format if possible
            dateandage = p.FixDateOrdinalsAndOf(" " + dateandage, "test");

            // remove date wikilinks
            dateandage = WikiRegexes.WikiLinksOnlyPossiblePipe.Replace(dateandage, "$1").Trim();

            // string must end with (age xx)
            if (!AgeBrackets.IsMatch(dateandage))
                return original;

            dateandage = AgeBrackets.Replace(dateandage, "");

            bool AmericanDate = WikiRegexes.AmericanDates.IsMatch(dateandage);

            string ISODate = Tools.ConvertDate(dateandage, DateLocale.ISO);

            if (ISODate.Equals(dateandage) && !WikiRegexes.ISODates.IsMatch(dateandage))
                return original;

            // we have ISO date, convert with {{birth date and age}}, American date, set mf=y
            return @"{{birth date and age|" + (AmericanDate ? "mf=y|" : "df=y|") + ISODate.Replace("-", "|") + @"}}";
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:31,代码来源:Parsers.cs


示例20: CiteTemplateDates

 public void CiteTemplateDates()
 {
     Parsers Parser = new Parsers();
     Article a = new Article("a", @"A [[B]]");
     a.CiteTemplateDates(Parser, true);
     Assert.IsTrue(a.ArticleText.Contains("[[B]]"));
 }
开发者ID:svn2github,项目名称:awb,代码行数:7,代码来源:MiscellaneousTests.cs



注:本文中的WikiFunctions.Parse.Parsers类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Win32.RECT类代码示例发布时间:2022-05-26
下一篇:
C# Parse.HideText类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap