put both funcs and procs under the same section in the documentation (#16301)

* both funcs and procs are under the same section in the documentation

* update the test
This commit is contained in:
Miran
2020-12-09 10:56:28 +01:00
committed by GitHub
parent a32acc351e
commit 40255f6721
2 changed files with 14 additions and 31 deletions

View File

@@ -1045,12 +1045,9 @@ proc generateDoc*(d: PDoc, n, orig: PNode, docFlags: DocFlags = kDefault) =
let pragmaNode = findPragma(n, wDeprecated)
d.modDeprecationMsg.add(genDeprecationMsg(d, pragmaNode))
of nkCommentStmt: d.modDesc.add(genComment(d, n))
of nkProcDef:
of nkProcDef, nkFuncDef:
when useEffectSystem: documentRaises(d.cache, n)
genItemAux(skProc)
of nkFuncDef:
when useEffectSystem: documentRaises(d.cache, n)
genItemAux(skFunc)
of nkMethodDef:
when useEffectSystem: documentRaises(d.cache, n)
genItemAux(skMethod)
@@ -1101,12 +1098,9 @@ proc generateJson*(d: PDoc, n: PNode, includeComments: bool = true) =
d.add %*{"comment": genComment(d, n)}
else:
d.modDesc.add(genComment(d, n))
of nkProcDef:
of nkProcDef, nkFuncDef:
when useEffectSystem: documentRaises(d.cache, n)
d.add genJsonItem(d, n, n[namePos], skProc)
of nkFuncDef:
when useEffectSystem: documentRaises(d.cache, n)
d.add genJsonItem(d, n, n[namePos], skFunc)
of nkMethodDef:
when useEffectSystem: documentRaises(d.cache, n)
d.add genJsonItem(d, n, n[namePos], skMethod)

View File

@@ -262,6 +262,11 @@ window.addEventListener('DOMContentLoaded', main);
<li><a class="reference" href="#z4"
title="z4()">z4</a></li>
</ul>
<ul class="simple nested-toc-section">someFunc
<li><a class="reference" href="#someFunc"
title="someFunc()">someFunc</a></li>
</ul>
<ul class="simple nested-toc-section">z8
<li><a class="reference" href="#z8"
@@ -296,17 +301,6 @@ window.addEventListener('DOMContentLoaded', main);
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#13" id="63">Funcs</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">someFunc
<li><a class="reference" href="#someFunc"
title="someFunc()">someFunc</a></li>
</ul>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#14" id="64">Methods</a>
<ul class="simple simple-toc-section">
@@ -509,6 +503,13 @@ This is deprecated without message.
This is deprecated with a message.
</dd>
<a id="someFunc"></a>
<dt><pre><span class="Keyword">func</span> <a href="#someFunc"><span class="Identifier">someFunc</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
<dd>
My someFunc. Stuff in <tt class="docutils literal"><span class="pre">quotes</span></tt> here. <a class="reference external" href="https://nim-lang.org">Some link</a>
</dd>
<a id="fromUtils3"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#fromUtils3"><span class="Identifier">fromUtils3</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
@@ -795,18 +796,6 @@ ok1
</dd>
</dl></div>
<div class="section" id="13">
<h1><a class="toc-backref" href="#13">Funcs</a></h1>
<dl class="item">
<a id="someFunc"></a>
<dt><pre><span class="Keyword">func</span> <a href="#someFunc"><span class="Identifier">someFunc</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
<dd>
My someFunc. Stuff in <tt class="docutils literal"><span class="pre">quotes</span></tt> here. <a class="reference external" href="https://nim-lang.org">Some link</a>
</dd>
</dl></div>
<div class="section" id="14">
<h1><a class="toc-backref" href="#14">Methods</a></h1>