Ejemplo n.º 1
0
        private void StrikeOutSection(WikiPageSection section)
        {
            if (section.Subsections.Count(s => s.Title.Trim() == "Итог") > 0)
            {
                if (!section.Title.Contains("<s>"))
                {
                    section.Title = string.Format(" <s>{0}</s> ",
                        section.Title.Trim());
                }

                foreach (WikiPageSection subsection in section.Subsections)
                {
                    Match m = _wikiLinkRE.Match(subsection.Title);
                    if (m.Success && !subsection.Title.Contains("<s>"))
                    {
                        subsection.Title = string.Format(" <s>{0}</s> ",
                            subsection.Title.Trim());
                    }
                }
            }
            section.ForEach(StrikeOutSection);
        }
Ejemplo n.º 2
0
        private void StrikeOutSection(WikiPageSection section)
        {
            Regex wikiLinkRE = new Regex(@"\[{2}(.+?)(\|.+?)?]{2}");

            if (section.Subsections.Count(s => s.Title.ToLower().Trim() == "итог" ||
                s.Title.Trim() == "Автоматический итог") > 0)
            {
                if (!section.Title.Contains("<s>"))
                {
                    section.Title = string.Format(" <s>{0}</s> ",
                        section.Title.Trim());
                }

                foreach (WikiPageSection subsection in section.Subsections)
                {
                    Match m = wikiLinkRE.Match(subsection.Title);
                    if (m.Success && !subsection.Title.Contains("<s>"))
                    {
                        subsection.Title = string.Format(" <s>{0}</s> ",
                            subsection.Title.Trim());
                    }
                }
            }
            section.ForEach(StrikeOutSection);
        }
Ejemplo n.º 3
0
 private void RemoveStrikeOut(WikiPageSection section)
 {
     if (section.Subsections.Count(s => s.Title.Trim() == "Итог") == 0)
     {
         if (section.Title.Contains("<s>"))
         {
             section.Title = section.Title.Replace("<s>", "");
             section.Title = section.Title.Replace("</s>", "");
         }
     }
     section.ForEach(RemoveStrikeOut);
 }
Ejemplo n.º 4
0
        private void StrikeOutSection(WikiPageSection section)
        {
            Regex wikiLinkRE = new Regex(@"\[{2}(.+?)(\|.+?)?]{2}");

            if (section.Subsections.Count(s => _l10i.Processor != null
                        ? _l10i.Results.Any(r => r == _l10i.Processor(s).Trim())
                        : _l10i.Results.Any(r => r == s.Title.Trim())) > 0)
            {
                if (!section.Title.Contains("<s>"))
                {
                    section.Title = string.Format(" <s>{0}</s> ",
                        section.Title.Trim());
                }

                foreach (WikiPageSection subsection in section.Subsections)
                {
                    Match m = wikiLinkRE.Match(subsection.Title);
                    if (m.Success && !subsection.Title.Contains("<s>"))
                    {
                        subsection.Title = string.Format(" <s>{0}</s> ",
                            subsection.Title.Trim());
                    }
                }
            }
            section.ForEach(StrikeOutSection);
        }
Ejemplo n.º 5
0
 private void ReplaceEmptyResults(WikiPageSection section)
 {
     WikiPageSection result = section.Subsections.FirstOrDefault(s => _l10i.Processor != null
                 ? _l10i.Results.Any(r => r == _l10i.Processor(s).Trim())
                 : _l10i.Results.Any(r => r == s.Title.Trim()));
     if (result != null && result.Subsections.Count == 0 &&
         string.IsNullOrEmpty(result.SectionText.Trim()))
     {
         result.Title = _l10i.EmptyResult;
     }
     section.ForEach(ReplaceEmptyResults);
 }
Ejemplo n.º 6
0
 private void RemoveStrikeOut(WikiPageSection section)
 {
     if (section.Subsections.Count(s => _l10i.Processor != null
                 ? _l10i.Results.Any(r => r == _l10i.Processor(s).Trim())
                 : _l10i.Results.Any(r => r == s.Title.Trim())) == 0)
     {
         if (section.Title.Contains("<s>"))
         {
             section.Title = section.Title.Replace("<s>", "");
             section.Title = section.Title.Replace("</s>", "");
         }
     }
     section.ForEach(RemoveStrikeOut);
 }
Ejemplo n.º 7
0
 private void RemoveStrikeOut(WikiPageSection section)
 {
     if (section.Subsections.Count(s => _results.Any(r => r.ToLower() == s.Title.Trim().ToLower())) == 0)
     {
         if (section.Title.Contains("<s>"))
         {
             section.Title = section.Title.Replace("<s>", "");
             section.Title = section.Title.Replace("</s>", "");
         }
     }
     section.ForEach(RemoveStrikeOut);
 }
Ejemplo n.º 8
0
 private void RemoveStrikeOut(WikiPageSection section)
 {
     if (!section.Title.ToLower(_l10i.Culture).Contains("{{ok}}") &&
         !section.Title.ToLower(_l10i.Culture).Contains("{{ок}}") &&
         !section.Title.ToLower(_l10i.Culture).Contains("{{x}}") &&
         section.Subsections.Count(s => s.Title.Trim() == "Итог") == 0)
     {
         if (section.Title.Contains("<s>"))
         {
             section.Title = section.Title.Replace("<s>", "");
             section.Title = section.Title.Replace("</s>", "");
         }
     }
     section.ForEach(RemoveStrikeOut);
 }