summary refs log tree commit diff stats
path: root/nimdoc
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-04-29 21:30:44 +0800
committerGitHub <noreply@github.com>2023-04-29 15:30:44 +0200
commit8e0f336f6dab061bd4dd0a07f4b436bbbe78138d (patch)
tree30263aed513d381fb607568bd90ff969ccc4beba /nimdoc
parenta593e40ad614158a35c7d6f777e783b0c910c9ed (diff)
downloadNim-8e0f336f6dab061bd4dd0a07f4b436bbbe78138d.tar.gz
fixes #21483; fixes nim doc skips documentation of annotated elements of objects (#21743)
* fixes #21483; skipPragmaExpr

* add a test case for #21483

* fixes HTML
Diffstat (limited to 'nimdoc')
-rw-r--r--nimdoc/testproject/expected/testproject.html29
-rw-r--r--nimdoc/testproject/expected/testproject.idx2
-rw-r--r--nimdoc/testproject/expected/theindex.html8
-rw-r--r--nimdoc/testproject/testproject.nim8
4 files changed, 47 insertions, 0 deletions
diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html
index 45a53bb93..a5c9b6af2 100644
--- a/nimdoc/testproject/expected/testproject.html
+++ b/nimdoc/testproject/expected/testproject.html
@@ -61,6 +61,9 @@
 <li><a class="reference" href="#Foo" title="Foo = enum
   enumValueA2">Foo</a></li>
 <li><a class="reference" href="#FooBuzz" title="FooBuzz {.deprecated: &quot;FooBuzz msg&quot;.} = int">FooBuzz</a></li>
+<li><a class="reference" href="#MyObject" title="MyObject = object
+  someString*: string        ## This is a string
+  annotated* {.somePragma.}: string ## This is an annotated string">MyObject</a></li>
 <li><a class="reference" href="#Shapes" title="Shapes = enum
   Circle,                   ## A circle
   Triangle,                 ## A three-sided shape
@@ -303,6 +306,10 @@
   <li><a class="reference" href="#myfn.t" title="myfn()">myfn()</a></li>
 
 </ul>
+<ul class="simple nested-toc-section">somePragma
+  <li><a class="reference" href="#somePragma.t" title="somePragma()">somePragma()</a></li>
+
+</ul>
 <ul class="simple nested-toc-section">testNimDocTrailingExample
   <li><a class="reference" href="#testNimDocTrailingExample.t" title="testNimDocTrailingExample()">testNimDocTrailingExample()</a></li>
 
@@ -392,6 +399,17 @@
     
   </dd>
 </div>
+<div id="MyObject">
+  <dt><pre><a href="testproject.html#MyObject"><span class="Identifier">MyObject</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
+  <span class="Identifier">someString</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>        <span class="Comment">## This is a string</span>
+  <span class="Identifier">annotated</span><span class="Operator">*</span> {.<span class="Identifier">somePragma</span>.}<span class="Other">:</span> <span class="Identifier">string</span> <span class="Comment">## This is an annotated string</span>
+  </pre></dt>
+  <dd>
+    
+    
+    
+  </dd>
+</div>
 <div id="Shapes">
   <dt><pre><a href="testproject.html#Shapes"><span class="Identifier">Shapes</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
   <span class="Identifier">Circle</span><span class="Other">,</span>                   <span class="Comment">## A circle</span>
@@ -1128,6 +1146,17 @@ bar
 </div>
 
 </div>
+<div id="somePragma-templates-all">
+  <div id="somePragma.t">
+  <dt><pre><span class="Keyword">template</span> <a href="#somePragma.t"><span class="Identifier">somePragma</span></a><span class="Other">(</span><span class="Other">)</span> {.<span class="Identifier">pragma</span>.}</pre></dt>
+  <dd>
+    
+    Just some annotation
+    
+  </dd>
+</div>
+
+</div>
 <div id="testNimDocTrailingExample-templates-all">
   <div id="testNimDocTrailingExample.t">
   <dt><pre><span class="Keyword">template</span> <a href="#testNimDocTrailingExample.t"><span class="Identifier">testNimDocTrailingExample</span></a><span class="Other">(</span><span class="Other">)</span></pre></dt>
diff --git a/nimdoc/testproject/expected/testproject.idx b/nimdoc/testproject/expected/testproject.idx
index 46ffaee72..c29223a83 100644
--- a/nimdoc/testproject/expected/testproject.idx
+++ b/nimdoc/testproject/expected/testproject.idx
@@ -64,5 +64,7 @@ nim	Rectangle	testproject.html#Rectangle	Shapes.Rectangle		380
 nim	Shapes	testproject.html#Shapes	enum Shapes		380
 nim	anything	testproject.html#anything	proc anything()		387
 nim	T19396	testproject.html#T19396	object T19396		392
+nim	somePragma	testproject.html#somePragma.t	template somePragma()		396
+nim	MyObject	testproject.html#MyObject	object MyObject		400
 nimgrp	bar	testproject.html#bar-procs-all	proc		31
 nimgrp	baz	testproject.html#baz-procs-all	proc		34
diff --git a/nimdoc/testproject/expected/theindex.html b/nimdoc/testproject/expected/theindex.html
index fd4666bf9..24e3cff1c 100644
--- a/nimdoc/testproject/expected/theindex.html
+++ b/nimdoc/testproject/expected/theindex.html
@@ -282,6 +282,10 @@
 <li><a class="reference external"
           data-doc-search-tag="testproject: template myfn()" href="testproject.html#myfn.t">testproject: template myfn()</a></li>
           </ul></dd>
+<dt><a name="MyObject" href="#MyObject"><span>MyObject:</span></a></dt><dd><ul class="simple">
+<li><a class="reference external"
+          data-doc-search-tag="testproject: object MyObject" href="testproject.html#MyObject">testproject: object MyObject</a></li>
+          </ul></dd>
 <dt><a name="p1" href="#p1"><span>p1:</span></a></dt><dd><ul class="simple">
 <li><a class="reference external"
           data-doc-search-tag="testproject: proc p1()" href="testproject.html#p1">testproject: proc p1()</a></li>
@@ -298,6 +302,10 @@
 <li><a class="reference external"
           data-doc-search-tag="testproject: proc someFunc()" href="testproject.html#someFunc">testproject: proc someFunc()</a></li>
           </ul></dd>
+<dt><a name="somePragma" href="#somePragma"><span>somePragma:</span></a></dt><dd><ul class="simple">
+<li><a class="reference external"
+          data-doc-search-tag="testproject: template somePragma()" href="testproject.html#somePragma.t">testproject: template somePragma()</a></li>
+          </ul></dd>
 <dt><a name="SomeType" href="#SomeType"><span>SomeType:</span></a></dt><dd><ul class="simple">
 <li><a class="reference external"
           data-doc-search-tag="utils: enum SomeType" href="subdir/subdir_b/utils.html#SomeType">utils: enum SomeType</a></li>
diff --git a/nimdoc/testproject/testproject.nim b/nimdoc/testproject/testproject.nim
index b5fa2ac37..d08a12544 100644
--- a/nimdoc/testproject/testproject.nim
+++ b/nimdoc/testproject/testproject.nim
@@ -392,3 +392,11 @@ when true: # issue #15184
 type T19396* = object # bug #19396
    a*: int
    b: float
+
+template somePragma*() {.pragma.}
+  ## Just some annotation
+
+type # bug #21483
+   MyObject* = object
+      someString*: string ## This is a string
+      annotated* {.somePragma.}: string ## This is an annotated string