public static string HighlightToHTML(string source, LangType type, bool customProtectionTags) { SourceFormat sf = null; switch (type) { case LangType.C: case LangType.CPP: sf = new CppFormat(); break; case LangType.CS: sf = new CSharpFormat(); break; case LangType.Html: case LangType.Xml: case LangType.Asp: sf = new HtmlFormat(); break; case LangType.JS: sf = new JavaScriptFormat(); break; case LangType.Msh: sf = new MshFormat(); break; case LangType.TSql: sf = new TsqlFormat(); break; case LangType.VB: sf = new VisualBasicFormat(); break; } if (sf == null) { return(source); } sf.CustomProtectedTags = customProtectionTags; return(sf.FormatCode(source)); }
/// <summary> /// Handles the Click event of the btnCopy control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnCopy_Click(object sender, EventArgs e) { SourceFormat sf = null; if (rbCSharp.Checked) { sf = new CSharpFormat(); } else if (rbVB.Checked) { sf = new VisualBasicFormat(); } else if (rbtsql.Checked) { sf = new TsqlFormat(); } else if (rbHtml.Checked) { sf = new HtmlFormat(); } else if (rbJS.Checked) { sf = new JavaScriptFormat(); } else if (rbMsh.Checked) { sf = new MshFormat(); } else { return; } sf.TabSpaces = 4; sf.LineNumbers = cbLineNumbers.Checked; sf.EmbedStyleSheet = cbEmbedCss.Checked; sf.Alternate = cbAlternate.Checked; string formatedCode = sf.FormatCode(CodeToFormat); //Clipboard.SetText(formatedCode, TextDataFormat.Html); Clipboard.SetText(formatedCode); }
public override string GetReplaceResult(Match match) { string lang = match.Result("$1"); string body = match.Result("$2"); SourceFormat srcFormat = new HtmlFormat(); if (lang.Equals("c#", StringComparison.OrdinalIgnoreCase) || lang.Equals("cs", StringComparison.OrdinalIgnoreCase) || lang.Equals("csharp", StringComparison.OrdinalIgnoreCase)) { srcFormat = new CSharpFormat(); } if (lang.Equals("vb", StringComparison.OrdinalIgnoreCase) || lang.Equals("visualbasic", StringComparison.OrdinalIgnoreCase) || lang.Equals("vbscript", StringComparison.OrdinalIgnoreCase)) { srcFormat = new VisualBasicFormat(); } if (lang.Equals("javascript", StringComparison.OrdinalIgnoreCase) || lang.Equals("js", StringComparison.OrdinalIgnoreCase) || lang.Equals("jscript", StringComparison.OrdinalIgnoreCase)) { srcFormat = new JavaScriptFormat(); } if (lang.Equals("sql", StringComparison.OrdinalIgnoreCase)) { srcFormat = new TsqlFormat(); } if (lang.Equals("msh", StringComparison.OrdinalIgnoreCase)) { srcFormat = new MshFormat(); } srcFormat.Alternate = Alternate; srcFormat.EmbedStyleSheet = EmbedStyleSheet; srcFormat.LineNumbers = LineNumbers; return(srcFormat.FormatCode(body)); }
private static SourceFormat _GetSourceCodeFormat(string language, bool alternate, bool embedStyleSheet, bool lineNumbers) { SourceFormat srcFormat = new HtmlFormat(); if (language.Equals("c#", StringComparison.OrdinalIgnoreCase) || language.Equals("cs", StringComparison.OrdinalIgnoreCase) || language.Equals("csharp", StringComparison.OrdinalIgnoreCase)) { srcFormat = new CSharpFormat(); } if (language.Equals("vb", StringComparison.OrdinalIgnoreCase) || language.Equals("visualbasic", StringComparison.OrdinalIgnoreCase) || language.Equals("vbscript", StringComparison.OrdinalIgnoreCase)) { srcFormat = new VisualBasicFormat(); } if (language.Equals("javascript", StringComparison.OrdinalIgnoreCase) || language.Equals("js", StringComparison.OrdinalIgnoreCase) || language.Equals("jscript", StringComparison.OrdinalIgnoreCase)) { srcFormat = new JavaScriptFormat(); } if (language.Equals("sql", StringComparison.OrdinalIgnoreCase)) { srcFormat = new TsqlFormat(); } if (language.Equals("msh", StringComparison.OrdinalIgnoreCase)) { srcFormat = new MshFormat(); } srcFormat.Alternate = alternate; srcFormat.EmbedStyleSheet = embedStyleSheet; srcFormat.LineNumbers = lineNumbers; return(srcFormat); }
private readonly JavaScriptFormat jsf; //to format client-side JavaScript code #endregion Fields #region Constructors /// <summary/> public HtmlFormat() { const string regJavaScript = @"(?<=<script(?:\s.*?)?>).+?(?=</script>)"; const string regComment = @"<!--.*?-->"; const string regAspTag = @"<%@.*?%>|<%|%>"; const string regAspCode = @"(?<=<%).*?(?=%>)"; const string regTagDelimiter = @"(?:</?!?\??(?!%)|(?<!%)/?>)+"; const string regTagName = @"(?<=</?!?\??(?!%))[\w\.:-]+(?=.*>)"; const string regAttributes = @"(?<=<(?!%)/?!?\??[\w:-]+).*?(?=(?<!%)/?>)"; const string regEntity = @"&\w+;"; const string regAttributeMatch = @"(=?"".*?""|=?'.*?')|([\w:-]+)"; //the regex object will handle all the replacements in one pass string regAll = "(" + regJavaScript + ")|(" + regComment + ")|(" + regAspTag + ")|(" + regAspCode + ")|(" + regTagDelimiter + ")|(" + regTagName + ")|(" + regAttributes + ")|(" + regEntity + ")"; CodeRegex = new Regex(regAll, RegexOptions.IgnoreCase | RegexOptions.Singleline); attribRegex = new Regex(regAttributeMatch, RegexOptions.Singleline); csf = new CSharpFormat(); jsf = new JavaScriptFormat(); }
/// <summary> /// Returns the formatted text. /// </summary> /// <param name="options">Whatever options were set in the regex groups.</param> /// <param name="text">Send the e.body so it can get formatted.</param> /// <returns>The formatted string of the match.</returns> private static string Highlight(HighlightOptions options, string text) { switch (options.Language) { case "c#": var csf = new CSharpFormat(); csf.LineNumbers = options.DisplayLineNumbers; csf.Alternate = options.AlternateLineNumbers; return HttpUtility.HtmlDecode(csf.FormatCode(text)); case "vb": var vbf = new VisualBasicFormat(); vbf.LineNumbers = options.DisplayLineNumbers; vbf.Alternate = options.AlternateLineNumbers; return vbf.FormatCode(text); case "js": var jsf = new JavaScriptFormat(); jsf.LineNumbers = options.DisplayLineNumbers; jsf.Alternate = options.AlternateLineNumbers; return HttpUtility.HtmlDecode(jsf.FormatCode(text)); case "html": var htmlf = new HtmlFormat(); htmlf.LineNumbers = options.DisplayLineNumbers; htmlf.Alternate = options.AlternateLineNumbers; text = StripHtml(text).Trim(); string code = htmlf.FormatCode(HttpUtility.HtmlDecode(text)).Trim(); return code.Replace("\r\n", "<br />").Replace("\n", "<br />"); case "xml": var xmlf = new HtmlFormat(); xmlf.LineNumbers = options.DisplayLineNumbers; xmlf.Alternate = options.AlternateLineNumbers; text = text.Replace("<br />", "\r\n"); text = StripHtml(text).Trim(); string xml = xmlf.FormatCode(HttpUtility.HtmlDecode(text)).Trim(); return xml.Replace("\r\n", "<br />").Replace("\n", "<br />"); case "tsql": var tsqlf = new TsqlFormat(); tsqlf.LineNumbers = options.DisplayLineNumbers; tsqlf.Alternate = options.AlternateLineNumbers; return HttpUtility.HtmlDecode(tsqlf.FormatCode(text)); case "msh": var mshf = new MshFormat(); mshf.LineNumbers = options.DisplayLineNumbers; mshf.Alternate = options.AlternateLineNumbers; return HttpUtility.HtmlDecode(mshf.FormatCode(text)); } return string.Empty; }
public static string FormatCode(string lang, string code) { SourceFormat sf = null; switch (lang) { case "csharp": case "cs": sf = new Manoli.Utils.CSharpFormat.CSharpFormat(); break; case "c++": case "cpp": sf = new CPlusPlusFormat(); break; case "js": case "javascript": sf = new JavaScriptFormat(); break; case "vb": case "basic": sf = new VisualBasicFormat(); break; case "sql": sf = new TsqlFormat(); break; case "msh": sf = new MshFormat(); break; case "haskell": sf = new HaskellFormat(); break; case "php": sf = new PhpFormat(); break; case "fsharp": case "fs": sf = new FSharpFormat(); break; case "html": case "xml": case "aspx": sf = new HtmlFormat(); break; } if (sf == null) { return(code); } else { string c = code.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(""", "\""); c = c.Replace("<em>", "verynastythingthatnoonewillusebeginem") .Replace("</em>", "verynastythingthatnoonewilluseendem"); sf.TabSpaces = 2; return(sf.FormatCode(c) .Replace("verynastythingthatnoonewilluseendem", "</em>") .Replace("verynastythingthatnoonewillusebeginem", "<em>")); } }
public static string FormatCode(string lang, string code) { SourceFormat sf = null; switch (lang) { case "csharp": case "cs": sf = new Manoli.Utils.CSharpFormat.CSharpFormat(); break; case "c++": case "cpp": sf = new CPlusPlusFormat(); break; case "js": case "javascript": sf = new JavaScriptFormat(); break; case "vb": case "basic": sf = new VisualBasicFormat(); break; case "sql": sf = new TsqlFormat(); break; case "msh": sf = new MshFormat(); break; case "haskell": sf = new HaskellFormat(); break; case "php": sf = new PhpFormat(); break; case "fsharp": case "fs": sf = new FSharpFormat(); break; case "html": case "xml": case "aspx": sf = new HtmlFormat(); break; } if (sf == null) { return(code); } else { sf.TabSpaces = 2; return(sf.FormatCode(code)); } }
public static Tuple <bool, string> FormatCode(string lang, string code) { SourceFormat sf = null; switch (lang) { case "csharp": case "cs": sf = new Manoli.Utils.CSharpFormat.CSharpFormat(); break; case "c++": case "cpp": sf = new CPlusPlusFormat(); break; case "js": case "javascript": sf = new JavaScriptFormat(); break; case "ts": case "typescript": sf = new TypeScriptFormat(); break; case "vb": case "basic": sf = new VisualBasicFormat(); break; case "sql": sf = new TsqlFormat(); break; case "msh": sf = new MshFormat(); break; case "haskell": sf = new HaskellFormat(); break; case "php": sf = new PhpFormat(); break; case "fsharp": case "fs": sf = new FSharpFormat(); break; case "html": case "xml": case "aspx": sf = new HtmlFormat(); break; case "paket": sf = new PaketFormat(); break; } if (sf == null) { return(Tuple.Create(false, SourceFormat.EscapeHtml(code, tabSpaces: 2))); } else { sf.TabSpaces = 2; return(Tuple.Create(true, sf.FormatCode(code))); } }
/// <summary> /// Returns the formatted text. /// </summary> /// <param name="options"> /// Whatever options were set in the regex groups. /// </param> /// <param name="text"> /// Send the e.body so it can get formatted. /// </param> /// <returns> /// The formatted string of the match. /// </returns> private static string Highlight(HighlightOptions options, string text) { switch (options.Language) { case "c#": var csf = new CSharpFormat { LineNumbers = options.DisplayLineNumbers, Alternate = options.AlternateLineNumbers }; return(HttpContext.Current.Server.HtmlDecode(csf.FormatCode(text))); case "vb": var vbf = new VisualBasicFormat { LineNumbers = options.DisplayLineNumbers, Alternate = options.AlternateLineNumbers }; return(HttpContext.Current.Server.HtmlDecode(vbf.FormatCode(text))); case "js": var jsf = new JavaScriptFormat { LineNumbers = options.DisplayLineNumbers, Alternate = options.AlternateLineNumbers }; return(HttpContext.Current.Server.HtmlDecode(jsf.FormatCode(text))); case "html": var htmlf = new HtmlFormat { LineNumbers = options.DisplayLineNumbers, Alternate = options.AlternateLineNumbers }; text = Utils.StripHtml(text); var code = htmlf.FormatCode(HttpContext.Current.Server.HtmlDecode(text)).Trim(); return(code.Replace("\r\n", "<br />").Replace("\n", "<br />")); case "xml": var xmlf = new HtmlFormat { LineNumbers = options.DisplayLineNumbers, Alternate = options.AlternateLineNumbers }; text = text.Replace("<br />", "\r\n"); text = Utils.StripHtml(text); var xml = xmlf.FormatCode(HttpContext.Current.Server.HtmlDecode(text)).Trim(); return(xml.Replace("\r\n", "<br />").Replace("\n", "<br />")); case "tsql": var tsqlf = new TsqlFormat { LineNumbers = options.DisplayLineNumbers, Alternate = options.AlternateLineNumbers }; return(HttpContext.Current.Server.HtmlDecode(tsqlf.FormatCode(text))); case "msh": var mshf = new MshFormat { LineNumbers = options.DisplayLineNumbers, Alternate = options.AlternateLineNumbers }; return(HttpContext.Current.Server.HtmlDecode(mshf.FormatCode(text))); } return(string.Empty); }
public string GetTabContent(TabType LoadType, string Path) { TagBuilder tabContent = new TagBuilder("div"); string Filestream = ""; CSharpFormat csformat = new CSharpFormat(); HtmlFormat format = new HtmlFormat(); JavaScriptFormat jsformat = new JavaScriptFormat(); VisualBasicFormat vbformat = new VisualBasicFormat(); HttpContext context = System.Web.HttpContext.Current; switch (LoadType) { case TabType.Description: Filestream = ReadTabContent(context.Request.PhysicalApplicationPath + Path); tabContent.InnerHtml = context.Server.HtmlDecode(Filestream); break; case TabType.PartialView: Filestream = ReadTabContent(context.Request.PhysicalApplicationPath + @"\Views" + Path.Replace("/", "\\")); tabContent.InnerHtml = format.FormatCode(Filestream).ToString(); break; case TabType.View: Filestream = ReadTabContent(context.Request.PhysicalApplicationPath + Path); tabContent.InnerHtml = format.FormatCode(Filestream).ToString(); break; case TabType.VB: case TabType.CS: Filestream = ReadTabContent(context.Request.PhysicalApplicationPath + Path); tabContent.InnerHtml = csformat.FormatCode(Filestream).ToString(); break; case TabType.CSS: Filestream = ReadTabContent(context.Request.PhysicalApplicationPath + Path); tabContent.InnerHtml = format.FormatCode(Filestream).ToString(); break; case TabType.XML: Filestream = ReadTabContent(@"/Models" + Path); tabContent.InnerHtml = csformat.FormatCode(Filestream).ToString(); break; case TabType.JavaScript: Filestream = ReadTabContent(context.Request.PhysicalApplicationPath + @"\Scripts" + Path.Replace("/", "\\")); tabContent.InnerHtml = jsformat.FormatCode(Filestream).ToString(); break; case TabType.Model: Filestream = ReadTabContent(@"/Models" + Path).ToString(); tabContent.InnerHtml = csformat.FormatCode(Filestream).ToString(); break; case TabType.Html: Filestream = ReadTabContent(context.Request.PhysicalApplicationPath + Path.Replace("/", "\\")); tabContent.InnerHtml = jsformat.FormatCode(Filestream).ToString(); break; default: break; } return(tabContent.ToString()); }
static BbCodeProcessor() { _formatters.Add(new RegexFormatter("<(.|\\n)*?>", string.Empty)); _formatters.Add(new LineBreaksFormatter(new string[7] { "html", "csharp", "code", "jscript", "sql", "vb", "php" })); _formatters.Add(new RegexFormatter("\\[b(?:\\s*)\\]((.|\\n)*?)\\[/b(?:\\s*)\\]", "<strong>$1</strong>")); _formatters.Add(new RegexFormatter("\\[chart(?:\\s*)\\]((.|\\n)*?)\\[/chart(?:\\s*)\\]", "<iframe src=\"/ShowChart/Charts/$1\" border=\"0\" class=\"chartFrame\" > </iframe>")); _formatters.Add(new RegexFormatter("\\[tr(?:\\s*)\\]((.|\\n)*?)\\[/tr(?:\\s*)\\]", "<tr>$1</tr>")); _formatters.Add(new RegexFormatter("\\[td(?:\\s*)\\]((.|\\n)*?)\\[/td(?:\\s*)\\]", "<td>$1</td>")); _formatters.Add(new RegexFormatter("\\[table(?:\\s*)\\]((.|\\n)*?)\\[/table(?:\\s*)\\]", "<table>$1</table>")); _formatters.Add(new RegexFormatter("\\[chart(?:\\s*)\\]((.|\\n)*?)\\[/chart(?:\\s*)\\]", "<iframe src=\"/ShowChart/Charts/$1\" style=\"border:0 none;\" class=\"chartFrame\" > </iframe>")); _formatters.Add(new RegexFormatter("\\[i(?:\\s*)\\]((.|\\n)*?)\\[/i(?:\\s*)\\]", "<em>$1</em>")); _formatters.Add(new RegexFormatter("\\[s(?:\\s*)\\]((.|\\n)*?)\\[/s(?:\\s*)\\]", "<strike>$1</strike>")); _formatters.Add(new RegexFormatter("\\[u(?:\\s*)\\]((.|\\n)*?)\\[/u(?:\\s*)\\]", "<u>$1</u>")); _formatters.Add(new RegexFormatter("\\[left(?:\\s*)\\]((.|\\n)*?)\\[/left(?:\\s*)]", "<div style=\"text-align:left\">$1</div>")); _formatters.Add(new RegexFormatter("\\[center(?:\\s*)\\]((.|\\n)*?)\\[/center(?:\\s*)]", "<div style=\"text-align:center\">$1</div>")); _formatters.Add(new RegexFormatter("\\[right(?:\\s*)\\]((.|\\n)*?)\\[/right(?:\\s*)]", "<div style=\"text-align:right\">$1</div>")); _formatters.Add(new RegexFormatter("\\[rtl(?:\\s*)\\]((.|\\n)*?)\\[/rtl(?:\\s*)]", "<div style=\"text-align:right;direction:rtl\">$1</div>")); _formatters.Add(new RegexFormatter("\\[ltr(?:\\s*)\\]((.|\\n)*?)\\[/ltr(?:\\s*)]", "<div style=\"text-align:left;direction:ltr\">$1</div>")); _formatters.Add(new RegexFormatter("\\[code(?:\\s*)\\]((.|\\n)*?)\\[/code(?:\\s*)]", "<div class=\"bbc-codetitle\">Code:</div><div class=\"bbc-codecontent\"><pre>$1</pre></div>")); _formatters.Add(new RegexFormatter("\\[php(?:\\s*)\\]((.|\\n)*?)\\[/php(?:\\s*)]", "<div class=\"bbc-codetitle\">PHP Code:</div><div class=\"bbc-codecontent\"><pre>$1</pre></div>")); List <IHtmlFormatter> formatters1 = _formatters; HtmlFormat htmlFormat = new HtmlFormat(); int num1 = 1; htmlFormat.EmbedStyleSheet = num1 != 0; string pattern1 = "\\[html(?:\\s*)\\]((.|\\n)*?)\\[/html(?:\\s*)]"; string replace1 = "<div class=\"bbc-codetitle\">HTML Code:</div><div class=\"bbc-codecontent\">{0}</div>"; SyntaxFormatter syntaxFormatter1 = new SyntaxFormatter(htmlFormat, pattern1, replace1); formatters1.Add(syntaxFormatter1); List <IHtmlFormatter> formatters2 = _formatters; CSharpFormat csharpFormat = new CSharpFormat(); int num2 = 1; csharpFormat.EmbedStyleSheet = num2 != 0; string pattern2 = "\\[csharp(?:\\s*)\\]((.|\\n)*?)\\[/csharp(?:\\s*)]"; string replace2 = "<div class=\"bbc-codetitle\">C# Code:</div><div class=\"bbc-codecontent\">{0}</div>"; SyntaxFormatter syntaxFormatter2 = new SyntaxFormatter(csharpFormat, pattern2, replace2); formatters2.Add(syntaxFormatter2); List <IHtmlFormatter> formatters3 = _formatters; JavaScriptFormat javaScriptFormat = new JavaScriptFormat(); int num3 = 1; javaScriptFormat.EmbedStyleSheet = num3 != 0; string pattern3 = "\\[jscript(?:\\s*)\\]((.|\\n)*?)\\[/jscript(?:\\s*)]"; string replace3 = "<div class=\"bbc-codetitle\">JavaScript Code:</div><div class=\"bbc-codecontent\">{0}</div>"; SyntaxFormatter syntaxFormatter3 = new SyntaxFormatter(javaScriptFormat, pattern3, replace3); formatters3.Add(syntaxFormatter3); List <IHtmlFormatter> formatters4 = _formatters; TsqlFormat tsqlFormat = new TsqlFormat(); int num4 = 1; tsqlFormat.EmbedStyleSheet = num4 != 0; string pattern4 = "\\[sql(?:\\s*)\\]((.|\\n)*?)\\[/sql(?:\\s*)]"; string replace4 = "<div class=\"bbc-codetitle\">SQL Code:</div><div class=\"bbc-codecontent\">{0}</div>"; SyntaxFormatter syntaxFormatter4 = new SyntaxFormatter(tsqlFormat, pattern4, replace4); formatters4.Add(syntaxFormatter4); List <IHtmlFormatter> formatters5 = _formatters; VisualBasicFormat visualBasicFormat = new VisualBasicFormat(); int num5 = 1; visualBasicFormat.EmbedStyleSheet = num5 != 0; string pattern5 = "\\[vb(?:\\s*)\\]((.|\\n)*?)\\[/vb(?:\\s*)]"; string replace5 = "<div class=\"bbc-codetitle\">Visual Basic Code:</div><div class=\"bbc-codecontent\">{0}</div>"; SyntaxFormatter syntaxFormatter5 = new SyntaxFormatter(visualBasicFormat, pattern5, replace5); formatters5.Add(syntaxFormatter5); _formatters.Add(new RegexFormatter("\\[quote=((.|\\n)*?)(?:\\s*)\\]", "<div class=\"bbc-quotetitle\">$1 said:</div><div class=\"bbc-quotecontent\"><p>")); _formatters.Add(new RegexFormatter("\\[quote(?:\\s*)\\]", "<div class=\"bbc-quotecontent\"><p>")); _formatters.Add(new RegexFormatter("\\[/quote(?:\\s*)\\]", "</p></div>")); _formatters.Add(new RegexFormatter("\\[url(?:\\s*)\\]www\\.(.*?)\\[/url(?:\\s*)\\]", "<a href=\"http://www.$1\" target=\"_blank\" title=\"$1\">$1</a>")); _formatters.Add(new RegexFormatter("\\[url(?:\\s*)\\]((.|\\n)*?)\\[/url(?:\\s*)\\]", "<a href=\"$1\" target=\"_blank\" title=\"$1\">$1</a>")); _formatters.Add(new RegexFormatter("\\[url=\"((.|\\n)*?)(?:\\s*)\"\\]((.|\\n)*?)\\[/url(?:\\s*)\\]", "<a href=\"$1\" target=\"_blank\" title=\"$1\">$3</a>")); _formatters.Add(new RegexFormatter("\\[url=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/url(?:\\s*)\\]", "<a href=\"$1\" target=\"_blank\" title=\"$1\">$3</a>")); _formatters.Add(new RegexFormatter("\\[link(?:\\s*)\\]((.|\\n)*?)\\[/link(?:\\s*)\\]", "<a href=\"$1\" target=\"_blank\" title=\"$1\">$1</a>")); _formatters.Add(new RegexFormatter("\\[link=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/link(?:\\s*)\\]", "<a href=\"$1\" target=\"_blank\" title=\"$1\">$3</a>")); var rnd = new Random().Next(int.MaxValue); _formatters.Add(new RegexFormatter("\\[tree(?:\\s*)\\]((.|\\n)*?)\\[/tree(?:\\s*)\\]", "<div id='treegraph" + rnd + "'></div><script> dTree.init(treeDataParcer('$1'), { target: '#treegraph" + rnd + "',width: document.getElementById('treegraph" + rnd + "').offsetWidth, height: 850}); </script>")); _formatters.Add(new RegexFormatter("\\[tree=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/tree(?:\\s*)\\]", "<style>$1</style> <div id='treegraph" + rnd + "'></div> <script> dTree.init(treeDataParcer('$3'), { target: '#treegraph" + rnd + "',width: document.getElementById('treegraph" + rnd + "').offsetWidth, height: 850 }); </script>")); _formatters.Add(new RegexFormatter("\\[img(?:\\s*)\\]((.|\\n)*?)\\[/img(?:\\s*)\\]", "<img src=\"$1\" border=\"0\" alt=\"\" />")); _formatters.Add(new RegexFormatter("\\[img align=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/img(?:\\s*)\\]", "<img src=\"$3\" border=\"0\" align=\"$1\" alt=\"\" />")); _formatters.Add(new RegexFormatter("\\[img width=((.|\\n)*?),height=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/img(?:\\s*)\\]", "<img width=\"$1\" height=\"$3\" src=\"$5\" border=\"0\" alt=\"\" />")); _formatters.Add(new RegexFormatter("\\[img=((.|\\n)*?)x((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/img(?:\\s*)\\]", "<img width=\"$1\" height=\"$3\" src=\"$5\" border=\"0\" alt=\"\" />")); _formatters.Add(new RegexFormatter("\\[color=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/color(?:\\s*)\\]", "<span style=\"color:$1;\">$3</span>")); _formatters.Add(new RegexFormatter("\\[highlight(?:\\s*)\\]((.|\\n)*?)\\[/highlight(?:\\s*)]", "<span class=\"bbc-highlight\">$1</span>")); _formatters.Add(new RegexFormatter("\\[spoiler(?:\\s*)\\]((.|\\n)*?)\\[/spoiler(?:\\s*)]", "<span class=\"bbc-spoiler\">$1</span>")); _formatters.Add(new RegexFormatter("\\[indent(?:\\s*)\\]((.|\\n)*?)\\[/indent(?:\\s*)]", "<div class=\"bbc-indent\">$1</div>")); _formatters.Add(new RegexFormatter("\\[hr(?:\\s*)\\]", "<hr />")); _formatters.Add(new RegexFormatter("\\[rule=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/rule(?:\\s*)\\]", "<div style=\"height: 0pt; border-top: 1px solid $3; margin: auto; width: $1;\"></div>")); _formatters.Add(new RegexFormatter("\\[email(?:\\s*)\\]((.|\\n)*?)\\[/email(?:\\s*)\\]", "<a href=\"mailto:$1\">$1</a>")); _formatters.Add(new RegexFormatter("\\[email=\"((.|\\n)*?)(?:\\s*)\"\\]((.|\\n)*?)\\[/email(?:\\s*)\\]", "<a href=\"mailto:$1\" title=\"$3\">$3</a>")); _formatters.Add(new RegexFormatter("\\[email=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/email(?:\\s*)\\]", "<a href=\"mailto:$1\" title=\"$3\">$3</a>")); _formatters.Add(new RegexFormatter("\\[small(?:\\s*)\\]((.|\\n)*?)\\[/small(?:\\s*)]", "<small>$1</small>")); _formatters.Add(new RegexFormatter("\\[size=+((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/size(?:\\s*)\\]", "<span style=\"font-size:$1em\">$3</span>")); _formatters.Add(new RegexFormatter("\\[size=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/size(?:\\s*)\\]", "<span style=\"font-size:$1\">$3</span>")); _formatters.Add(new RegexFormatter("\\[font=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/font(?:\\s*)\\]", "<span style=\"font-family:$1;\">$3</span>")); _formatters.Add(new RegexFormatter("\\[align=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/align(?:\\s*)\\]", "<span style=\"text-align:$1;\">$3</span>")); _formatters.Add(new RegexFormatter("\\[float=((.|\\n)*?)(?:\\s*)\\]((.|\\n)*?)\\[/float(?:\\s*)\\]", "<span style=\"float:$1;\">$3</div>")); string format = "<ol class=\"bbc-list\" style=\"list-style:{0};\">$1</ol>"; _formatters.Add(new RegexFormatter("\\[\\*(?:\\s*)]\\s*([^\\[]*)", "<li>$1</li>")); _formatters.Add(new RegexFormatter("\\[list(?:\\s*)\\]((.|\\n)*?)\\[/list(?:\\s*)\\]", "<ul class=\"bbc-list\">$1</ul>")); _formatters.Add(new RegexFormatter("\\[list=1(?:\\s*)\\]((.|\\n)*?)\\[/list(?:\\s*)\\]", string.Format(format, "decimal"), false)); _formatters.Add(new RegexFormatter("\\[list=i(?:\\s*)\\]((.|\\n)*?)\\[/list(?:\\s*)\\]", string.Format(format, "lower-roman"), false)); _formatters.Add(new RegexFormatter("\\[list=I(?:\\s*)\\]((.|\\n)*?)\\[/list(?:\\s*)\\]", string.Format(format, "upper-roman"), false)); _formatters.Add(new RegexFormatter("\\[list=a(?:\\s*)\\]((.|\\n)*?)\\[/list(?:\\s*)\\]", string.Format(format, "lower-alpha"), false)); _formatters.Add(new RegexFormatter("\\[list=A(?:\\s*)\\]((.|\\n)*?)\\[/list(?:\\s*)\\]", string.Format(format, "upper-alpha"), false)); }