本文整理汇总了C#中WikiFunctions.Parse.Parsers.Unicodify方法的典型用法代码示例。如果您正苦于以下问题:C# Parsers.Unicodify方法的具体用法?C# Parsers.Unicodify怎么用?C# Parsers.Unicodify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFunctions.Parse.Parsers
的用法示例。
在下文中一共展示了Parsers.Unicodify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpandTemplate
/// <summary>
///
/// </summary>
/// <param name="ArticleText">The text of the article</param>
/// <param name="ArticleTitle">The title of the artlce</param>
/// <param name="Regexes"></param>
/// <param name="includeComment"></param>
/// <returns></returns>
public static string ExpandTemplate(string ArticleText, string ArticleTitle, Dictionary<Regex, string> Regexes, bool includeComment)
{
Parse.Parsers parsers = new Parse.Parsers();
foreach (KeyValuePair<Regex, string> p in Regexes)
{
MatchCollection uses = p.Key.Matches(ArticleText);
foreach (Match m in uses)
{
string call = m.Value;
string expandUri = Variables.URLLong + "api.php?action=expandtemplates&format=xml&title=" + Tools.WikiEncode(ArticleTitle) + "&text=" + HttpUtility.UrlEncode(call);
string result;
try
{
string respStr = Tools.GetHTML(expandUri);
Match m1 = ExpandTemplatesRegex.Match(respStr);
if (!m.Success) continue;
result = HttpUtility.HtmlDecode(m1.Groups[1].Value);
}
catch
{
continue;
}
bool skipArticle;
result = parsers.Unicodify(result, out skipArticle);
if (includeComment)
result = result + "<!-- " + call + " -->";
ArticleText = ArticleText.Replace(call, result);
}
}
return ArticleText;
}