Exemplo n.º 1
0
        private string ContentWithoutSignatures(bool prependSlashes = false)
        {
            var sb = new StringBuilder();

            if (!Summary.IsEmpty())
            {
                if (prependSlashes)
                {
                    sb.Append(ParserToken.DocComment);
                }
                sb.AppendUnixLine(Summary);
            }

            foreach (var textOrExample in TextBlocks)
            {
                string str = textOrExample.ToString().TrimEndAndNewlines();
                if (!str.IsEmpty())
                {
                    if (textOrExample is DescriptionBlock && prependSlashes)
                    {
                        var multiLine = str.SplitLines();
                        foreach (var line in multiLine)
                        {
                            sb.Append(ParserToken.DocComment);
                            sb.AppendUnixLine(line);
                        }
                    }
                    else
                    {
                        //note, we do not prepend slashes to examples regardless
                        sb.AppendUnixLine(str);
                    }
                }
            }
            foreach (var param in Parameters)
            {
                if (param.HasDoc)
                {
                    if (prependSlashes)
                    {
                        sb.Append(ParserToken.DocComment);
                    }

                    sb.AppendUnixLine(param.ToString());
                }
            }
            if (ReturnDoc != null && ReturnDoc.HasDoc)
            {
                if (prependSlashes)
                {
                    sb.Append(ParserToken.DocComment);
                }

                sb.AppendUnixLine(ReturnDoc.ToString());
            }

            return(sb.ToString().Trim());
        }
Exemplo n.º 2
0
        private void OutputForReturnDoc(bool prependSlashes, StringBuilder sb)
        {
            if (ReturnDoc != null && ReturnDoc.HasDoc)
            {
                if (prependSlashes)
                {
                    sb.Append(TxtToken.DocComment);
                }

                sb.AppendUnixLine(ReturnDoc.ToString());
            }
        }
Exemplo n.º 3
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            if (SignatureList.Any())
            {
                sb.AppendUnixLine(SignatureOpen);
                foreach (var sig in SignatureList)
                {
                    sb.AppendUnixLine(sig);
                }
                sb.AppendUnixLine(SignatureClose);
            }
            sb.AppendUnixLine(Summary);
            foreach (var textOrExample in TextBlocks)
            {
                string str = textOrExample.ToString().TrimEndAndNewlines();
                if (!str.IsEmpty())
                {
                    sb.AppendUnixLine(str);
                }
            }
            foreach (var param in Parameters)
            {
                if (param.HasDoc)
                {
                    sb.AppendUnixLine(param.ToString());
                }
            }
            if (ReturnDoc != null && ReturnDoc.HasDoc)
            {
                sb.AppendUnixLine(ReturnDoc.ToString());
            }

            return(sb.ToString().Trim());
        }