예제 #1
0
        public override void VisitPara(Para para)
        {
            // Avoid double line breaks between adjacent <para> elements.
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                if (builder.Length < 2 ||
                    new string(new char[] { builder[builder.Length - 2], builder[builder.Length - 1] }) != Environment.NewLine)
                {
                    builder.AppendLine();
                }
            }
            else if (builder.Length < 1 ||
                     builder[builder.Length - 1].ToString() != Environment.NewLine)
            {
                builder.AppendLine();
            }

            base.VisitPara(para);
            builder.AppendLine();
        }
예제 #2
0
파일: Visitor.cs 프로젝트: liwq-net/NuDoq
 /// <summary>
 /// Visits the <c>para</c> documentation element.
 /// </summary>
 public virtual void VisitPara(Para para) => VisitContainer(para);
예제 #3
0
파일: DocReader.cs 프로젝트: xoofx/NuDoq
        /// <summary>
        /// Reads all supported documentation elements.
        /// </summary>
        private static IEnumerable <Element> ReadContent(XElement xml)
        {
            foreach (var node in xml.Nodes())
            {
                var element = default(Element);
                switch (node.NodeType)
                {
                case System.Xml.XmlNodeType.Element:
                    var elementNode = (XElement)node;
                    switch (elementNode.Name.LocalName)
                    {
                    case "summary":
                        element = new Summary(ReadContent(elementNode));
                        break;

                    case "remarks":
                        element = new Remarks(ReadContent(elementNode));
                        break;

                    case "example":
                        element = new Example(ReadContent(elementNode));
                        break;

                    case "para":
                        element = new Para(ReadContent(elementNode));
                        break;

                    case "param":
                        element = new Param(FindAttribute(elementNode, "name"), ReadContent(elementNode));
                        break;

                    case "paramref":
                        element = new ParamRef(FindAttribute(elementNode, "name"));
                        break;

                    case "typeparam":
                        element = new TypeParam(FindAttribute(elementNode, "name"), ReadContent(elementNode));
                        break;

                    case "typeparamref":
                        element = new TypeParamRef(FindAttribute(elementNode, "name"));
                        break;

                    case "code":
                        element = new Code(TrimCode(elementNode.Value));
                        break;

                    case "c":
                        element = new C(elementNode.Value);
                        break;

                    case "see":
                        element = new See(FindAttribute(elementNode, "cref"), FindAttribute(elementNode, "langword"), elementNode.Value, ReadContent(elementNode));
                        break;

                    case "seealso":
                        element = new SeeAlso(FindAttribute(elementNode, "cref"), elementNode.Value, ReadContent(elementNode));
                        break;

                    case "list":
                        element = new List(FindAttribute(elementNode, "type"), ReadContent(elementNode));
                        break;

                    case "listheader":
                        element = new ListHeader(ReadContent(elementNode));
                        break;

                    case "term":
                        element = new Term(ReadContent(elementNode));
                        break;

                    case "description":
                        element = new Description(ReadContent(elementNode));
                        break;

                    case "item":
                        element = new Item(ReadContent(elementNode));
                        break;

                    case "exception":
                        element = new Exception(FindAttribute(elementNode, "cref"), ReadContent(elementNode));
                        break;

                    case "value":
                        element = new Value(ReadContent(elementNode));
                        break;

                    case "returns":
                        element = new Returns(ReadContent(elementNode));
                        break;

                    default:
                        element = new UnknownElement(elementNode, ReadContent(elementNode));
                        break;
                    }
                    break;

                case System.Xml.XmlNodeType.Text:
                    element = new Text(TrimText(((XText)node).Value));
                    break;

                default:
                    break;
                }

                if (element != null)
                {
                    element.SetLineInfo(xml as IXmlLineInfo);
                    yield return(element);
                }
            }
        }
예제 #4
0
파일: XmlVisitor.cs 프로젝트: xoofx/NuDoq
 /// <summary>
 /// Visits the <c>para</c> documentation element.
 /// </summary>
 public override void VisitPara(Para para)
 {
     AddXml("para", para, base.VisitPara);
 }