private string doReplace(string openTag, string content, string closeTag) { if (!Globals.OutSettings.DevOutMode) { if (CommentsChecker.IsStringEmptyOrComments(content)) return string.Empty; } // OpenTagParser openTagParser = new OpenTagParser("@overloads", openTag); string title = openTagParser.TryGetAttribute("title"); if (string.IsNullOrEmpty(title)) title = "Untitled"; // SignatureParser signatureParser = new SignatureParser(title); // StringBuilder sb = new StringBuilder(); // sb.AppendLine(""); sb.AppendLine("<dt>"); sb.AppendLine(" <h4 id=\"" + signatureParser.CalcId() + "__\" >" + title + "...</h4>"); // "fields()": <h4 id="fields__" >fields()...</h4> sb.AppendLine("</dt>"); sb.AppendLine("<dd>"); sb.AppendLine(" <dl>"); // sb.AppendLine(content); // sb.AppendLine(" </dl>"); sb.AppendLine("</dd>"); // return sb.ToString(); }
private string doReplace(string openTag, string content, string closeTag) { if (!Globals.OutSettings.DevOutMode) { if (content.IndexOf("!!!!") >= 0) return string.Empty; } // OpenTagParser openTagParser = new OpenTagParser("@item", openTag); string title = openTagParser.TryGetAttribute("title"); if (string.IsNullOrEmpty(title)) title = "Untitled"; string _class = openTagParser.TryGetAttribute("class"); string _id = openTagParser.TryGetAttribute("id"); // StringBuilder sb = new StringBuilder(); // sb.AppendLine("<dt>"); SignatureParser signatureParser = new SignatureParser(title); sb.AppendLine(signatureParser.CalcHtmlH4(_class, _id)); sb.AppendLine("</dt>"); // sb.AppendLine("<dd>"); sb.AppendLine(content); sb.AppendLine("</dd>"); // return sb.ToString(); }
public void TestSignatureParser_IsStatic() { SignatureParser parser = null; // parser = new SignatureParser("func()"); Assert.AreEqual(false, parser.IsStatic); // parser = new SignatureParser("Static func()"); Assert.AreEqual(true, parser.IsStatic); }
public void TestSignatureParser_CalcId() { SignatureParser parser = null; // parser = new SignatureParser("func()"); Assert.AreEqual("func", parser.CalcId()); // parser = new SignatureParser("Static func()"); Assert.AreEqual("func", parser.CalcId()); // parser = new SignatureParser("func(a)"); Assert.AreEqual("func__a", parser.CalcId()); // parser = new SignatureParser("Static func(a,b,c)"); Assert.AreEqual("func__a_b_c", parser.CalcId()); // parser = new SignatureParser("Static func(a,b,...)"); Assert.AreEqual("func__a_b_", parser.CalcId()); }
public void TestSignatureParser_Name() { SignatureParser parser = null; // parser = new SignatureParser("func()"); Assert.AreEqual("func", parser.Name); // parser = new SignatureParser("Static func()"); Assert.AreEqual("func", parser.Name); // parser = new SignatureParser("func(a)"); Assert.AreEqual("func", parser.Name); // parser = new SignatureParser("Static func(a,b,c)"); Assert.AreEqual("func", parser.Name); // parser = new SignatureParser("Static func(a,b,...)"); Assert.AreEqual("func", parser.Name); }
public void TestSignatureParser_CalcHtmlH4() { SignatureParser parser = null; // parser = new SignatureParser("func()"); Assert.AreEqual("<h4 class=\"name\" id=\"func\">func<span class=\"signature\">()</span></h4>", parser.CalcHtmlH4()); // parser = new SignatureParser("Static func()"); Assert.AreEqual("<h4 class=\"name\" id=\"func\"><span class=\"type-signature\"><static> </span>func<span class=\"signature\">()</span></h4>", parser.CalcHtmlH4()); // parser = new SignatureParser("func(a)"); Assert.AreEqual("<h4 class=\"name\" id=\"func__a\">func<span class=\"signature\">(a)</span></h4>", parser.CalcHtmlH4()); // parser = new SignatureParser("Static func(a,b,c)"); Assert.AreEqual("<h4 class=\"name\" id=\"func__a_b_c\"><span class=\"type-signature\"><static> </span>func<span class=\"signature\">(a, b, c)</span></h4>", parser.CalcHtmlH4()); // parser = new SignatureParser("Static func(a,b,...)"); Assert.AreEqual("<h4 class=\"name\" id=\"func__a_b_\"><span class=\"type-signature\"><static> </span>func<span class=\"signature\">(a, b, ...)</span></h4>", parser.CalcHtmlH4()); }