This revision was automatically updated to reflect the committed changes.
Closed by commit rL343818: [clang-doc] Clean up Markdown output (authored by 
juliehockett, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52754?vs=167851&id=168381#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52754

Files:
  clang-tools-extra/trunk/clang-doc/MDGenerator.cpp
  clang-tools-extra/trunk/test/clang-doc/md-comment.cpp
  clang-tools-extra/trunk/test/clang-doc/md-linkage.cpp
  clang-tools-extra/trunk/test/clang-doc/md-module.cpp
  clang-tools-extra/trunk/test/clang-doc/md-namespace.cpp
  clang-tools-extra/trunk/test/clang-doc/md-record.cpp

Index: clang-tools-extra/trunk/clang-doc/MDGenerator.cpp
===================================================================
--- clang-tools-extra/trunk/clang-doc/MDGenerator.cpp
+++ clang-tools-extra/trunk/clang-doc/MDGenerator.cpp
@@ -74,18 +74,18 @@
   return Stream.str();
 }
 
-void writeLine(const Twine &Text, raw_ostream &OS) { OS << Text << "\n"; }
+void writeLine(const Twine &Text, raw_ostream &OS) { OS << Text << "\n\n"; }
 
-void writeNewLine(raw_ostream &OS) { OS << "\n"; }
+void writeNewLine(raw_ostream &OS) { OS << "\n\n"; }
 
 void writeHeader(const Twine &Text, unsigned int Num, raw_ostream &OS) {
-  OS << std::string(Num, '#') + " " + Text << "\n";
+  OS << std::string(Num, '#') + " " + Text << "\n\n";
 }
 
 void writeFileDefinition(const Location &L, raw_ostream &OS) {
   OS << genItalic("Defined at line " + std::to_string(L.LineNumber) + " of " +
                   L.Filename)
-     << "\n";
+     << "\n\n";
 }
 
 void writeDescription(const CommentInfo &I, raw_ostream &OS) {
@@ -104,10 +104,10 @@
     OS << genEmphasis(I.Name) << " " << I.Text;
   } else if (I.Kind == "ParamCommandComment") {
     std::string Direction = I.Explicit ? (" " + I.Direction).str() : "";
-    OS << genEmphasis(I.ParamName) << I.Text << Direction << "\n";
+    OS << genEmphasis(I.ParamName) << I.Text << Direction << "\n\n";
   } else if (I.Kind == "TParamCommandComment") {
     std::string Direction = I.Explicit ? (" " + I.Direction).str() : "";
-    OS << genEmphasis(I.ParamName) << I.Text << Direction << "\n";
+    OS << genEmphasis(I.ParamName) << I.Text << Direction << "\n\n";
   } else if (I.Kind == "VerbatimBlockComment") {
     for (const auto &Child : I.Children)
       writeDescription(*Child, OS);
@@ -132,7 +132,7 @@
   } else if (I.Kind == "TextComment") {
     OS << I.Text;
   } else {
-    OS << "Unknown comment kind: " << I.Kind << ".\n";
+    OS << "Unknown comment kind: " << I.Kind << ".\n\n";
   }
 }
 
@@ -166,11 +166,16 @@
     Stream << N.Type.Name + " " + N.Name;
     First = false;
   }
+  writeHeader(I.Name, 3, OS);
   std::string Access = getAccess(I.Access);
   if (Access != "")
-    writeHeader(genItalic(Access) + " " + I.ReturnType.Type.Name + " " + I.Name + "(" + Stream.str() + ")", 3, OS);
-  else 
-    writeHeader(I.ReturnType.Type.Name + " " + I.Name + "(" + Stream.str() + ")", 3, OS);
+    writeLine(genItalic(Access + " " + I.ReturnType.Type.Name + " " + I.Name +
+                        "(" + Stream.str() + ")"),
+              OS);
+  else
+    writeLine(genItalic(I.ReturnType.Type.Name + " " + I.Name + "(" +
+                        Stream.str() + ")"),
+              OS);
   if (I.DefLoc)
     writeFileDefinition(I.DefLoc.getValue(), OS);
 
Index: clang-tools-extra/trunk/test/clang-doc/md-comment.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-doc/md-comment.cpp
+++ clang-tools-extra/trunk/test/clang-doc/md-comment.cpp
@@ -33,7 +33,8 @@
 // RUN: cat %t/docs/./GlobalNamespace.md | FileCheck %s --check-prefix CHECK-0
 // CHECK-0: # Global Namespace
 // CHECK-0: ## Functions
-// CHECK-0: ### void F(int I, int J)
+// CHECK-0: ### F
+// CHECK-0: *void F(int I, int J)*
 // CHECK-0: *Defined at line 28 of test*
 // CHECK-0: **brief** Brief description.
 // CHECK-0:  Extended description that continues onto the next line.
Index: clang-tools-extra/trunk/test/clang-doc/md-namespace.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-doc/md-namespace.cpp
+++ clang-tools-extra/trunk/test/clang-doc/md-namespace.cpp
@@ -31,13 +31,15 @@
 // RUN: cat %t/docs/./A.md | FileCheck %s --check-prefix CHECK-0
 // CHECK-0: # namespace A
 // CHECK-0: ## Functions
-// CHECK-0: ### void f()
+// CHECK-0: ### f
+// CHECK-0: *void f()*
 // CHECK-0: *Defined at line 17 of test*
 
 // RUN: cat %t/docs/A/B.md | FileCheck %s --check-prefix CHECK-1
 // CHECK-1: # namespace B
 // CHECK-1: ## Functions
-// CHECK-1: ### enum A::B::E func(int i)
+// CHECK-1: ### func
+// CHECK-1: *enum A::B::E func(int i)*
 // CHECK-1: *Defined at line 23 of test*
 // CHECK-1: ## Enums
 // CHECK-1: | enum E |
Index: clang-tools-extra/trunk/test/clang-doc/md-module.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-doc/md-module.cpp
+++ clang-tools-extra/trunk/test/clang-doc/md-module.cpp
@@ -20,5 +20,7 @@
 // RUN: cat %t/docs/./GlobalNamespace.md | FileCheck %s --check-prefix CHECK-0
 // CHECK-0: # Global Namespace
 // CHECK-0: ## Functions
-// CHECK-0: ### int moduleFunction(int x)
-// CHECK-0: ### double exportedModuleFunction(double y, int z)
+// CHECK-0: ### moduleFunction
+// CHECK-0: *int moduleFunction(int x)*
+// CHECK-0: ### exportedModuleFunction
+// CHECK-0: *double exportedModuleFunction(double y, int z)*
Index: clang-tools-extra/trunk/test/clang-doc/md-record.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-doc/md-record.cpp
+++ clang-tools-extra/trunk/test/clang-doc/md-record.cpp
@@ -56,7 +56,8 @@
 // RUN: cat %t/docs/./GlobalNamespace.md | FileCheck %s --check-prefix CHECK-2
 // CHECK-2: # Global Namespace
 // CHECK-2: ## Functions
-// CHECK-2: ### void H()
+// CHECK-2: ### H
+// CHECK-2: *void H()*
 // CHECK-2: *Defined at line 11 of test*
 // CHECK-2: ## Enums
 // CHECK-2: | enum B |
@@ -74,11 +75,14 @@
 // CHECK-3: # class E
 // CHECK-3: *Defined at line 25 of test*
 // CHECK-3: ## Functions
-// CHECK-3: ### void E()
+// CHECK-3: ### E
+// CHECK-3: *void E()*
 // CHECK-3: *Defined at line 27 of test*
-// CHECK-3: ### void ~E()
+// CHECK-3: ### ~E
+// CHECK-3: *void ~E()*
 // CHECK-3: *Defined at line 28 of test*
-// CHECK-3: ### void ProtectedMethod()
+// CHECK-3: ### ProtectedMethod
+// CHECK-3: *void ProtectedMethod()*
 // CHECK-3: *Defined at line 34 of test*
 
 // RUN: cat %t/docs/./C.md | FileCheck %s --check-prefix CHECK-4
Index: clang-tools-extra/trunk/test/clang-doc/md-linkage.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-doc/md-linkage.cpp
+++ clang-tools-extra/trunk/test/clang-doc/md-linkage.cpp
@@ -104,23 +104,31 @@
 // CHECK-0: int publicField
 // CHECK-0: protected int protectedField
 // CHECK-0: ## Functions
-// CHECK-0: ### void publicMethod()
-// CHECK-0: ### void protectedMethod()
+// CHECK-0: ### publicMethod
+// CHECK-0: *void publicMethod()*
+// CHECK-0: ### protectedMethod
+// CHECK-0: *void protectedMethod()*
 
 // RUN: cat %t/docs/./named.md | FileCheck %s --check-prefix CHECK-1
 // CHECK-1: # namespace named
 // CHECK-1: ## Functions
-// CHECK-1: ### void namedFunction()
-// CHECK-1: ### void namedInlineFunction()
+// CHECK-1: ### namedFunction
+// CHECK-1: *void namedFunction()*
+// CHECK-1: ### namedInlineFunction
+// CHECK-1: *void namedInlineFunction()*
 
 // RUN: cat %t/docs/./GlobalNamespace.md | FileCheck %s --check-prefix CHECK-2
 // CHECK-2: # Global Namespace
 // CHECK-2: ## Functions
-// CHECK-2: ### void function(int x)
-// CHECK-2: ### int inlinedFunction(int x)
-// CHECK-2: ### int functionWithInnerClass(int x)
+// CHECK-2: ### function
+// CHECK-2: *void function(int x)*
+// CHECK-2: ### inlinedFunction
+// CHECK-2: *int inlinedFunction(int x)*
+// CHECK-2: ### functionWithInnerClass
+// CHECK-2: *int functionWithInnerClass(int x)*
 // CHECK-2: *Defined at line 14 of test*
-// CHECK-2: ### int inlinedFunctionWithInnerClass(int x)
+// CHECK-2: ### inlinedFunctionWithInnerClass
+// CHECK-2: *int inlinedFunctionWithInnerClass(int x)*
 // CHECK-2: *Defined at line 23 of test*
 
 // RUN: cat %t/docs/named/NamedClass.md | FileCheck %s --check-prefix CHECK-3
@@ -130,5 +138,7 @@
 // CHECK-3: int namedPublicField
 // CHECK-3: protected int namedProtectedField
 // CHECK-3: ## Functions
-// CHECK-3: ### void namedPublicMethod()
-// CHECK-3: ### void namedProtectedMethod()
+// CHECK-3: ### namedPublicMethod
+// CHECK-3: *void namedPublicMethod()*
+// CHECK-3: ### namedProtectedMethod
+// CHECK-3: *void namedProtectedMethod()*
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to