protected virtual string ReplaceTag(XmlTag tag) { //code c para see seealso paramref typeparamref list/item switch (tag.name) { case "c": return(ReplaceCTag(tag)); case "code": return(ReplaceCodeTag(tag)); case "para": return(ReplaceParaTag(tag)); case "see": return(ReplaceSeeTag(tag)); case "paramref": return(ReplaceParamRefTag(tag)); case "typeparamref": return(ReplaceTypeParamRefTag(tag)); default: System.Console.WriteLine("unexpected inline tag:" + tag.name); break; } return("<" + tag.name + "/>"); }
private XmlTag CreateTag(Match match) { //groups[1] = tag name //groups[2] = attr name //groups[3] = attr value Group nameGroup = match.Groups[1]; Group attrGroup = match.Groups[2]; Group valueGroup = match.Groups[3]; if (attrGroup.Captures.Count != valueGroup.Captures.Count) { throw new System.Exception("desync of attr/value pairs"); } Dictionary <string, string> attrs = new Dictionary <string, string>(); for (int k = 0; k < attrGroup.Captures.Count; k++) { attrs.Add(attrGroup.Captures[k].Value, valueGroup.Captures[k].Value); } XmlTag tag = new XmlTag(nameGroup.Value, attrs); if (match.Groups.Count > 4) { Group contentGroup = match.Groups[4]; tag.content = contentGroup.Value; } return(tag); }
protected override string ReplaceSeeTag(XmlTag tag) { return(":see:`" + Sanitize(tag.attrs["cref"]) + "`"); }
protected override string ReplaceParaTag(XmlTag tag) { return("\n\n" + tag.content + "\n\n"); }
protected override string ReplaceParamRefTag(XmlTag tag) { return(":paramref:`" + Sanitize(tag.attrs["name"]) + "`"); }
protected override string ReplaceCTag(XmlTag tag) { return(tag.content); }
protected override string ReplaceTypeParamRefTag(XmlTag tag) { return(Sanitize(tag.attrs["name"])); }
private string RegexMatcher(Match match) { XmlTag tag = CreateTag(match); return(ReplaceTag(tag)); }
protected abstract string ReplaceTypeParamRefTag(XmlTag tag);
protected abstract string ReplaceSeeTag(XmlTag tag);
protected abstract string ReplaceParaTag(XmlTag tag);