diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-06-02 09:02:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-02 09:02:14 -0700 |
commit | 0de3d4292f328f94c7a94af7e3e61e58ff43a252 (patch) | |
tree | 829525610f60acb1fb4461385532d197cc077301 /nimdoc | |
parent | 4ee6eddad4a43e1ba6104e091f221f6295aece64 (diff) | |
download | Nim-0de3d4292f328f94c7a94af7e3e61e58ff43a252.tar.gz |
fix #16993, #18054, #17835 runnableExamples now works with templates and nested templates (#18082)
Diffstat (limited to 'nimdoc')
-rw-r--r-- | nimdoc/testproject/expected/subdir/subdir_b/utils.html | 4 | ||||
-rw-r--r-- | nimdoc/testproject/expected/testproject.html | 11 | ||||
-rw-r--r-- | nimdoc/testproject/subdir/subdir_b/utils.nim | 10 |
3 files changed, 15 insertions, 10 deletions
diff --git a/nimdoc/testproject/expected/subdir/subdir_b/utils.html b/nimdoc/testproject/expected/subdir/subdir_b/utils.html index 794066cae..826cad02a 100644 --- a/nimdoc/testproject/expected/subdir/subdir_b/utils.html +++ b/nimdoc/testproject/expected/subdir/subdir_b/utils.html @@ -206,9 +206,9 @@ constructor. <dt><pre><span class="Keyword">template</span> <a href="#fromUtilsGen.t"><span class="Identifier">fromUtilsGen</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt> <dd> -this should be shown in utils.html +should be shown in utils.html only <p><strong class="examples_text">Example:</strong></p> -<pre class="listing"><span class="Identifier">assert</span> <span class="DecNumber">3</span><span class="Operator">*</span><span class="DecNumber">2</span> <span class="Operator">==</span> <span class="DecNumber">6</span></pre>ditto +<pre class="listing"><span class="Keyword">discard</span> <span class="StringLit">"should be in utils.html only, not in module that calls fromUtilsGen"</span></pre>ditto </dd> diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html index d2fe38021..513dd507b 100644 --- a/nimdoc/testproject/expected/testproject.html +++ b/nimdoc/testproject/expected/testproject.html @@ -431,10 +431,7 @@ window.addEventListener('DOMContentLoaded', main); <span class="Keyword">discard</span> <span class="StringLit">"in top2"</span></pre>top2 after <p><strong class="examples_text">Example:</strong></p> <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">testproject</span> -<span class="Keyword">discard</span> <span class="StringLit">"in top3"</span></pre>top3 after -<p><strong class="examples_text">Example:</strong></p> -<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">testproject</span> -<span class="Identifier">assert</span> <span class="DecNumber">3</span><span class="Operator">*</span><span class="DecNumber">2</span> <span class="Operator">==</span> <span class="DecNumber">6</span></pre></p> +<span class="Keyword">discard</span> <span class="StringLit">"in top3"</span></pre>top3 after</p> <div class="section" id="6"> <h1><a class="toc-backref" href="#6">Imports</a></h1> <dl class="item"> @@ -574,7 +571,8 @@ My someFunc. Stuff in <tt class="docutils literal"><span class="pre"><span class came form utils but should be shown where <tt class="docutils literal"><span class="pre"><span class="Identifier">fromUtilsGen</span></span></tt> is called <p><strong class="examples_text">Example:</strong></p> -<pre class="listing"><span class="Keyword">discard</span> <span class="DecNumber">1</span></pre> +<pre class="listing"><span class="Keyword">discard</span> <span class="LongStringLit">"""should be shown as examples for fromUtils3 + in module calling fromUtilsGen"""</span></pre> </dd> <a id="isValid,T"></a> @@ -957,6 +955,9 @@ cz18 <dd> ok3 +<p><strong class="examples_text">Example:</strong></p> +<pre class="listing"><span class="Keyword">discard</span> <span class="LongStringLit">"""should be shown as examples for fromUtils2 + in module calling fromUtilsGen"""</span></pre> </dd> <a id="z6t.t"></a> diff --git a/nimdoc/testproject/subdir/subdir_b/utils.nim b/nimdoc/testproject/subdir/subdir_b/utils.nim index 128e8e481..4e3aa1f10 100644 --- a/nimdoc/testproject/subdir/subdir_b/utils.nim +++ b/nimdoc/testproject/subdir/subdir_b/utils.nim @@ -50,9 +50,9 @@ template bEnum*(): untyped = discard template fromUtilsGen*(): untyped = - ## this should be shown in utils.html + ## should be shown in utils.html only runnableExamples: - assert 3*2 == 6 + discard "should be in utils.html only, not in module that calls fromUtilsGen" ## ditto iterator fromUtils1*(): int = @@ -64,7 +64,11 @@ template fromUtilsGen*(): untyped = template fromUtils2*() = ## ok3 + runnableExamples: + discard """should be shown as examples for fromUtils2 + in module calling fromUtilsGen""" proc fromUtils3*() = ## came form utils but should be shown where `fromUtilsGen` is called - runnableExamples: discard 1 + runnableExamples: discard """should be shown as examples for fromUtils3 + in module calling fromUtilsGen""" |