Пример #1
0
        internal static string GenerateEmptyDocumentation(IReadonlyTextDocument data, ISymbol member, string indent)
        {
            StringBuilder result = StringBuilderCache.Allocate();

            DocGenerator generator = new DocGenerator(data);

            generator.GenerateDoc(member);

            bool first = true;

            foreach (Section section in generator.sections)
            {
                if (first)
                {
                    result.Append(indent);
                    result.Append("/// <");
                    first = false;
                }
                else
                {
                    result.AppendLine();
                    result.Append(indent);
                    result.Append("/// <");
                }
                result.Append(section.Name);
                foreach (var attr in section.Attributes)
                {
                    result.Append(" ");
                    result.Append(attr.Key);
                    result.Append("=\"");
                    result.Append(attr.Value);
                    result.Append("\"");
                }
                if (section.Name == "summary")
                {
                    result.AppendLine(">");
                    result.Append(indent);
                    result.Append("/// ");
                    result.AppendLine();
                    result.Append(indent);
                    result.Append("/// ");
                }
                else
                {
                    result.Append(">");
                }

//				bool inTag = false;
//				int column = indent.Length + "/// ".Length;

                result.Append("</");
                result.Append(section.Name);
                result.Append(">");
            }
            result.AppendLine();
            return(StringBuilderCache.ReturnAndFree(result));
        }
Пример #2
0
        internal static string GenerateEmptyDocumentation(TextEditorData data, IEntity member, string indent)
        {
            StringBuilder result = new StringBuilder();

            DocGenerator generator = new DocGenerator(data);

            generator.GenerateDoc(member);

            bool first = true;

            foreach (Section section in generator.sections)
            {
                if (first)
                {
                    result.Append(indent);
                    result.Append("/// <");
                    first = false;
                }
                else
                {
                    result.AppendLine();
                    result.Append(indent);
                    result.Append("/// <");
                }
                result.Append(section.Name);
                foreach (var attr in section.Attributes)
                {
                    result.Append(" ");
                    result.Append(attr.Key);
                    result.Append("=\"");
                    result.Append(attr.Value);
                    result.Append("\"");
                }
                if (section.Name == "summary")
                {
                    result.AppendLine(">");
                    result.Append(indent);
                    result.Append("/// ");
                    result.AppendLine();
                    result.Append(indent);
                    result.Append("/// ");
                }
                else
                {
                    result.Append(">");
                }

//				bool inTag = false;
//				int column = indent.Length + "/// ".Length;

                result.Append("</");
                result.Append(section.Name);
                result.Append(">");
            }
            result.AppendLine();
            return(result.ToString());
        }
Пример #3
0
        internal static string GenerateDocumentation(IReadonlyTextDocument data, ISymbol member, string indent, string prefix)
        {
            StringBuilder result = StringBuilderCache.Allocate();

            var generator = new DocGenerator(data);

            generator.GenerateDoc(member);

            bool first = true;

            foreach (Section section in generator.sections)
            {
                if (first)
                {
                    result.Append(indent);
                    result.Append(prefix);
                    result.Append("<");
                    first = false;
                }
                else
                {
                    result.AppendLine();
                    result.Append(indent);
                    result.Append(prefix);
                    result.Append("<");
                }
                result.Append(section.Name);
                foreach (var attr in section.Attributes)
                {
                    result.Append(" ");
                    result.Append(attr.Key);
                    result.Append("=\"");
                    result.Append(attr.Value);
                    result.Append("\"");
                }
                if (section.Name == "summary")
                {
                    result.AppendLine(">");
                    result.Append(indent);
                    result.Append(prefix);
                }
                else
                {
                    result.Append(">");
                }
                bool          inTag   = false;
                int           column  = indent.Length + prefix.Length;
                StringBuilder curWord = StringBuilderCache.Allocate();
                foreach (char ch in section.Documentation)
                {
                    if (ch == '<')
                    {
                        inTag = true;
                    }
                    if (ch == '>')
                    {
                        inTag = false;
                    }

                    if (ch == '\n')
                    {
                        result.Append(curWord.ToString());
                        curWord.Length = 0;

                        result.AppendLine();
                        result.Append(indent);
                        result.Append(prefix);
                        column = indent.Length + prefix.Length;
                    }
                    else if (!inTag && char.IsWhiteSpace(ch))
                    {
                        if (column + curWord.Length > 120)
                        {
                            result.Length--;                             // trunk last char white space.
                            result.AppendLine();
                            result.Append(indent);
                            result.Append(prefix);
                            column = indent.Length + prefix.Length;
                        }
                        result.Append(curWord.ToString());
                        result.Append(ch);
                        column        += curWord.Length + 1;
                        curWord.Length = 0;
                    }
                    else
                    {
                        curWord.Append(ch);
                    }
                }
                if (section.Name == "summary")
                {
                    result.AppendLine(curWord.ToString());
                    result.Append(indent);
                    result.Append(prefix);
                }
                else
                {
                    result.Append(curWord.ToString());
                }

                result.Append("</");
                result.Append(section.Name);
                result.Append(">");
                StringBuilderCache.ReturnAndFree(curWord);
            }
            result.AppendLine();
            return(StringBuilderCache.ReturnAndFree(result));
        }
        internal static string GenerateDocumentation(TextEditorData data, IEntity member, string indent, string prefix)
        {
            StringBuilder result = new StringBuilder();

            DocGenerator generator = new DocGenerator(data);

            generator.GenerateDoc(member);

            bool first = true;

            foreach (Section section in generator.sections)
            {
                if (first)
                {
                    result.Append(indent);
                    result.Append(prefix);
                    result.Append("<");
                    first = false;
                }
                else
                {
                    result.AppendLine();
                    result.Append(indent);
                    result.Append(prefix);
                    result.Append("<");
                }
                result.Append(section.Name);
                foreach (var attr in section.Attributes)
                {
                    result.Append(" ");
                    result.Append(attr.Key);
                    result.Append("='");
                    result.Append(attr.Value);
                    result.Append("'");
                }
                result.AppendLine(">");

                result.Append(indent);
                result.Append(prefix);
                bool          inTag   = false;
                int           column  = indent.Length + prefix.Length;
                StringBuilder curWord = new StringBuilder();
                foreach (char ch in section.Documentation)
                {
                    if (ch == '<')
                    {
                        inTag = true;
                    }
                    if (ch == '>')
                    {
                        inTag = false;
                    }

                    if (ch == '\n')
                    {
                        result.Append(curWord.ToString());
                        curWord.Length = 0;

                        result.AppendLine();
                        result.Append(indent);
                        result.Append(prefix);
                        column = indent.Length + prefix.Length;
                    }
                    else if (!inTag && char.IsWhiteSpace(ch))
                    {
                        if (column + curWord.Length > 120)
                        {
                            result.Length--; // trunk last char white space.
                            result.AppendLine();
                            result.Append(indent);
                            result.Append(prefix);
                            column = indent.Length + prefix.Length;
                        }
                        result.Append(curWord.ToString());
                        result.Append(ch);
                        column        += curWord.Length + 1;
                        curWord.Length = 0;
                    }
                    else
                    {
                        curWord.Append(ch);
                    }
                }
                result.AppendLine(curWord.ToString());

                result.Append(indent);
                result.Append(prefix);
                result.Append("</");
                result.Append(section.Name);
                result.Append(">");
            }
            result.AppendLine();
            return(result.ToString());
        }
Пример #5
0
		internal static string GenerateEmptyDocumentation (TextEditorData data, IEntity member, string indent)
		{
			StringBuilder result = new StringBuilder ();
			
			DocGenerator generator = new DocGenerator (data);
			generator.GenerateDoc (member);
			
			bool first = true;
			foreach (Section section in generator.sections) {
				if (first) {
					result.Append (indent);
					result.Append ("/// <");
					first = false;
				} else {
					result.AppendLine ();
					result.Append (indent);
					result.Append ("/// <");
				}
				result.Append (section.Name);
				foreach (var attr in section.Attributes) {
					result.Append (" ");
					result.Append (attr.Key);
					result.Append ("=\"");
					result.Append (attr.Value);
					result.Append ("\"");
				}
				if (section.Name == "summary")
				{
					result.AppendLine (">");
					result.Append (indent);
					result.Append ("/// ");
					result.AppendLine ();
					result.Append (indent);
					result.Append ("/// ");
				}
				else
				{
					result.Append (">");
				}

//				bool inTag = false;
//				int column = indent.Length + "/// ".Length;

				result.Append ("</");
				result.Append (section.Name);
				result.Append (">");
			}
			result.AppendLine ();
			return result.ToString ();
		}
Пример #6
0
		internal static string GenerateDocumentation (TextEditorData data, IEntity member, string indent, string prefix)
		{
			StringBuilder result = new StringBuilder ();
			
			DocGenerator generator = new DocGenerator (data);
			generator.GenerateDoc (member);
			
			bool first = true;
			foreach (Section section in generator.sections) {
				if (first) {
					result.Append (indent);
					result.Append (prefix);
					result.Append ("<");
					first = false;
				} else {
					result.AppendLine ();
					result.Append (indent);
					result.Append (prefix);
					result.Append ("<");
				}
				result.Append (section.Name);
				foreach (var attr in section.Attributes) {
					result.Append (" ");
					result.Append (attr.Key);
					result.Append ("=\"");
					result.Append (attr.Value);
					result.Append ("\"");
				}
				if (section.Name == "summary")
				{
					result.AppendLine (">");
					result.Append (indent);
					result.Append (prefix);
				}
				else
				{
					result.Append (">");
				}
				bool inTag = false;
				int column = indent.Length + prefix.Length;
				StringBuilder curWord = new StringBuilder ();
				foreach (char ch in section.Documentation) {
					if (ch == '<')
						inTag = true;
					if (ch == '>')
						inTag = false;

					if (ch =='\n') {
						result.Append (curWord.ToString ());
						curWord.Length = 0;

						result.AppendLine ();
						result.Append (indent);
						result.Append (prefix);
						column = indent.Length + prefix .Length;
					} else if (!inTag && char.IsWhiteSpace (ch)) {
						if (column + curWord.Length > 120) {
							result.Length--; // trunk last char white space.
							result.AppendLine ();
							result.Append (indent);
							result.Append (prefix);
							column = indent.Length + prefix .Length;
						}
						result.Append (curWord.ToString ());
						result.Append (ch);
						column += curWord.Length + 1;
						curWord.Length = 0;
					} else {
						curWord.Append (ch);
					}
				}
				if (section.Name == "summary")
				{
					result.AppendLine(curWord.ToString ());
					result.Append(indent);
					result.Append(prefix);
				}
				else
				{
					result.Append(curWord.ToString ());
				}

				result.Append ("</");
				result.Append (section.Name);
				result.Append (">");
			}
			result.AppendLine ();
			return result.ToString ();
		}