summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2020-12-02 15:36:08 +0100
committerGitHub <noreply@github.com>2020-12-02 15:36:08 +0100
commitc0b76ef3cb08dc8d1547ed5d791427ba0c146802 (patch)
tree83da5a7a0fc092dad39b8d49b14efb4a0947856a
parente875f27ee6f57a24e0c9be36f3ab2d8780085a0c (diff)
downloadNim-c0b76ef3cb08dc8d1547ed5d791427ba0c146802.tar.gz
fix #16164, render doc comments (#16230)
* fix #16164, render doc comments

* add a test
-rw-r--r--compiler/options.nim2
-rw-r--r--nimdoc/testproject/expected/testproject.html11
-rw-r--r--nimdoc/testproject/expected/testproject.idx1
-rw-r--r--nimdoc/testproject/expected/theindex.html4
-rw-r--r--nimdoc/testproject/testproject.nim3
5 files changed, 19 insertions, 2 deletions
diff --git a/compiler/options.nim b/compiler/options.nim
index 42a907777..bf0a9a4ee 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -541,7 +541,7 @@ proc isDefined*(conf: ConfigRef; symbol: string): bool =
                             osDragonfly, osMacosx}
     else: discard
 
-proc importantComments*(conf: ConfigRef): bool {.inline.} = conf.cmd notin cmdDocLike + {cmdIdeTools}
+proc importantComments*(conf: ConfigRef): bool {.inline.} = conf.cmd in cmdDocLike + {cmdIdeTools}
 proc usesWriteBarrier*(conf: ConfigRef): bool {.inline.} = conf.selectedGC >= gcRefc
 
 template compilationCachePresent*(conf: ConfigRef): untyped =
diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html
index d9132d087..ee09b46af 100644
--- a/nimdoc/testproject/expected/testproject.html
+++ b/nimdoc/testproject/expected/testproject.html
@@ -120,7 +120,9 @@ function main() {
 <li>
   <a class="reference reference-toplevel" href="#8" id="58">Vars</a>
   <ul class="simple simple-toc-section">
-      <li><a class="reference" href="#aVariable"
+      <li><a class="reference" href="#someVariable"
+    title="someVariable: bool">someVariable</a></li>
+  <li><a class="reference" href="#aVariable"
     title="aVariable: array[1, int]">aVariable</a></li>
 
   </ul>
@@ -427,6 +429,13 @@ Some shapes.
 <div class="section" id="8">
 <h1><a class="toc-backref" href="#8">Vars</a></h1>
 <dl class="item">
+<a id="someVariable"></a>
+<dt><pre><a href="testproject.html#someVariable"><span class="Identifier">someVariable</span></a><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
+<dd>
+
+This should be visible.
+
+</dd>
 <a id="aVariable"></a>
 <dt><pre><a href="testproject.html#aVariable"><span class="Identifier">aVariable</span></a><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="DecNumber">1</span><span class="Other">,</span> <span class="Identifier">int</span><span class="Other">]</span></pre></dt>
 <dd>
diff --git a/nimdoc/testproject/expected/testproject.idx b/nimdoc/testproject/expected/testproject.idx
index 8d132acc4..5714efac0 100644
--- a/nimdoc/testproject/expected/testproject.idx
+++ b/nimdoc/testproject/expected/testproject.idx
@@ -1,3 +1,4 @@
+someVariable	testproject.html#someVariable	testproject: someVariable	
 C_A	testproject.html#C_A	testproject: C_A	
 C_B	testproject.html#C_B	testproject: C_B	
 C_C	testproject.html#C_C	testproject: C_C	
diff --git a/nimdoc/testproject/expected/theindex.html b/nimdoc/testproject/expected/theindex.html
index 34d24e900..03d9c72fe 100644
--- a/nimdoc/testproject/expected/theindex.html
+++ b/nimdoc/testproject/expected/theindex.html
@@ -244,6 +244,10 @@ function main() {
 <li><a class="reference external"
           data-doc-search-tag="utils: someType(): SomeType" href="subdir/subdir_b/utils.html#someType_2">utils: someType(): SomeType</a></li>
           </ul></dd>
+<dt><a name="someVariable" href="#someVariable"><span>someVariable:</span></a></dt><dd><ul class="simple">
+<li><a class="reference external"
+          data-doc-search-tag="testproject: someVariable" href="testproject.html#someVariable">testproject: someVariable</a></li>
+          </ul></dd>
 <dt><a name="testNimDocTrailingExample" href="#testNimDocTrailingExample"><span>testNimDocTrailingExample:</span></a></dt><dd><ul class="simple">
 <li><a class="reference external"
           data-doc-search-tag="testproject: testNimDocTrailingExample()" href="testproject.html#testNimDocTrailingExample.t">testproject: testNimDocTrailingExample()</a></li>
diff --git a/nimdoc/testproject/testproject.nim b/nimdoc/testproject/testproject.nim
index 3cb7fddc5..eea399f82 100644
--- a/nimdoc/testproject/testproject.nim
+++ b/nimdoc/testproject/testproject.nim
@@ -9,6 +9,9 @@ runnableExamples:
   # bug #11078
   for x in "xx": discard
 
+
+var someVariable*: bool ## This should be visible.
+
 when true:
   ## top2
   runnableExamples: