Beispiel #1
0
        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 + "/>");
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 protected override string ReplaceSeeTag(XmlTag tag)
 {
     return(":see:`" + Sanitize(tag.attrs["cref"]) + "`");
 }
Beispiel #4
0
 protected override string ReplaceParaTag(XmlTag tag)
 {
     return("\n\n" + tag.content + "\n\n");
 }
Beispiel #5
0
 protected override string ReplaceParamRefTag(XmlTag tag)
 {
     return(":paramref:`" + Sanitize(tag.attrs["name"]) + "`");
 }
Beispiel #6
0
 protected override string ReplaceCTag(XmlTag tag)
 {
     return(tag.content);
 }
Beispiel #7
0
 protected override string ReplaceTypeParamRefTag(XmlTag tag)
 {
     return(Sanitize(tag.attrs["name"]));
 }
Beispiel #8
0
        private string RegexMatcher(Match match)
        {
            XmlTag tag = CreateTag(match);

            return(ReplaceTag(tag));
        }
Beispiel #9
0
 protected abstract string ReplaceTypeParamRefTag(XmlTag tag);
Beispiel #10
0
 protected abstract string ReplaceSeeTag(XmlTag tag);
Beispiel #11
0
 protected abstract string ReplaceParaTag(XmlTag tag);