You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a proc has a parameter with a default value, and the default value is the name of a variable, the generated HTML anchor for that proc does not include that parameter's type.
It does not matter whether the variable was declared with let, var, or const. This issue does not occur if the default value is a literal instead of a variable name.
Example
Generate the documentation for this example with nim doc:
# Can also be 'var' or 'const'let num =5procincorrect*(x = num) =## A proc with an incorrect anchor.discardprocokay*(x =5) =## A proc with the expected anchor.discard
Current Output
Excerpt from the generated HTML:
<aid="incorrect"></a><dt><pre><spanclass="Keyword">proc</span><ahref="#incorrect"><spanclass="Identifier">incorrect</span></a><spanclass="Other">(</span><spanclass="Identifier">x</span><spanclass="Other">=</span><spanclass="Identifier">num</span><spanclass="Other">)</span><span><spanclass="Other">{</span><spanclass="Other pragmadots">...</span><spanclass="Other">}</span></span><spanclass="pragmawrap"><spanclass="Other">{.</span><spanclass="pragma"><spanclass="Identifier">raises</span><spanclass="Other">:</span><spanclass="Other">[</span><spanclass="Other">]</span><spanclass="Other">,</span><spanclass="Identifier">tags</span><spanclass="Other">:</span><spanclass="Other">[</span><spanclass="Other">]</span></span><spanclass="Other">.}</span></span></pre></dt><dd>
A proc with an incorrect anchor.
</dd><aid="okay,int"></a><dt><pre><spanclass="Keyword">proc</span><ahref="#okay%2Cint"><spanclass="Identifier">okay</span></a><spanclass="Other">(</span><spanclass="Identifier">x</span><spanclass="Other">=</span><spanclass="DecNumber">5</span><spanclass="Other">)</span><span><spanclass="Other">{</span><spanclass="Other pragmadots">...</span><spanclass="Other">}</span></span><spanclass="pragmawrap"><spanclass="Other">{.</span><spanclass="pragma"><spanclass="Identifier">raises</span><spanclass="Other">:</span><spanclass="Other">[</span><spanclass="Other">]</span><spanclass="Other">,</span><spanclass="Identifier">tags</span><spanclass="Other">:</span><spanclass="Other">[</span><spanclass="Other">]</span></span><spanclass="Other">.}</span></span></pre></dt><dd>
A proc with the expected anchor.
</dd>
Note that the anchor for the incorrect proc does not include the int parameter, but the okay proc does, which feels inconsistent.
Expected Output
<aid="incorrect,int"></a><dt><pre><spanclass="Keyword">proc</span><ahref="#incorrect%2Cint"><spanclass="Identifier">incorrect</span></a><spanclass="Other">(</span><spanclass="Identifier">x</span><spanclass="Other">=</span><spanclass="Identifier">num</span><spanclass="Other">)</span><span><spanclass="Other">{</span><spanclass="Other pragmadots">...</span><spanclass="Other">}</span></span><spanclass="pragmawrap"><spanclass="Other">{.</span><spanclass="pragma"><spanclass="Identifier">raises</span><spanclass="Other">:</span><spanclass="Other">[</span><spanclass="Other">]</span><spanclass="Other">,</span><spanclass="Identifier">tags</span><spanclass="Other">:</span><spanclass="Other">[</span><spanclass="Other">]</span></span><spanclass="Other">.}</span></span></pre></dt><dd>
A proc with an incorrect anchor.
</dd><aid="okay,int"></a><dt><pre><spanclass="Keyword">proc</span><ahref="#okay%2Cint"><spanclass="Identifier">okay</span></a><spanclass="Other">(</span><spanclass="Identifier">x</span><spanclass="Other">=</span><spanclass="DecNumber">5</span><spanclass="Other">)</span><span><spanclass="Other">{</span><spanclass="Other pragmadots">...</span><spanclass="Other">}</span></span><spanclass="pragmawrap"><spanclass="Other">{.</span><spanclass="pragma"><spanclass="Identifier">raises</span><spanclass="Other">:</span><spanclass="Other">[</span><spanclass="Other">]</span><spanclass="Other">,</span><spanclass="Identifier">tags</span><spanclass="Other">:</span><spanclass="Other">[</span><spanclass="Other">]</span></span><spanclass="Other">.}</span></span></pre></dt><dd>
A proc with the expected anchor.
</dd>
The id and href attributes for the anchor tags are the important parts.
Additional Information
Output of nim -v:
Nim Compiler Version 1.0.99 [Linux: amd64]
Compiled at 2019-10-07
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: 5be8e0b0883c5d88db8f24db36d114290dffcae3
active boot switches: -d:release
Also occurs with 1.0.
The text was updated successfully, but these errors were encountered:
If a proc has a parameter with a default value, and the default value is the name of a variable, the generated HTML anchor for that proc does not include that parameter's type.
It does not matter whether the variable was declared with
let
,var
, orconst
. This issue does not occur if the default value is a literal instead of a variable name.Example
Generate the documentation for this example with
nim doc
:Current Output
Excerpt from the generated HTML:
Note that the anchor for the
incorrect
proc does not include theint
parameter, but theokay
proc does, which feels inconsistent.Expected Output
The
id
andhref
attributes for the anchor tags are the important parts.Additional Information
Output of
nim -v
:Also occurs with 1.0.
The text was updated successfully, but these errors were encountered: