diff options
author | Andrey Makarov <ph.makarov@gmail.com> | 2021-04-08 20:00:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 19:00:14 +0200 |
commit | 42687457b079c16f69b22ff2354590780bd4cf45 (patch) | |
tree | c144b2f80a6242b3029d3304fbd62270b7793163 /tests/stdlib/trstgen.nim | |
parent | 4d3f9d3536e84d756f15b708177f289417dca3d2 (diff) | |
download | Nim-42687457b079c16f69b22ff2354590780bd4cf45.tar.gz |
further progress on rst roles & directives (fix #17646) (#17659)
* further progress on rst roles & dir-s (fix #17646) * fix documents according to the messages * fix bug 17 from #17340
Diffstat (limited to 'tests/stdlib/trstgen.nim')
-rw-r--r-- | tests/stdlib/trstgen.nim | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index 99b8d8db5..b403d96c6 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -136,6 +136,25 @@ suite "YAML syntax highlighting": <span class="StringLit">not numbers</span><span class="Punctuation">:</span> <span class="Punctuation">[</span> <span class="StringLit">42e</span><span class="Punctuation">,</span> <span class="StringLit">0023</span><span class="Punctuation">,</span> <span class="StringLit">+32.37</span><span class="Punctuation">,</span> <span class="StringLit">8 ball</span><span class="Punctuation">]</span> <span class="Punctuation">}</span></pre>""" + test "Directives: warnings": + let input = dedent""" + .. non-existant-warning: Paragraph. + + .. another.wrong:warning::: Paragraph. + """ + var warnings = new seq[string] + let output = input.toHtml(warnings=warnings) + check output == "" + doAssert warnings[].len == 2 + check "(1, 24) Warning: RST style:" in warnings[0] + check "double colon :: may be missing at end of 'non-existant-warning'" in warnings[0] + check "(3, 25) Warning: RST style:" in warnings[1] + check "RST style: too many colons for a directive (should be ::)" in warnings[1] + + test "not a directive": + let input = "..warning:: I am not a warning." + check input.toHtml == input + test "Anchors, Aliases, Tags": let input = """.. code-block:: yaml --- !!map @@ -1403,6 +1422,23 @@ Test1 check """`3`:sup:\ He is an isotope of helium.""".toHtml == expected check """`3`:superscript:\ He is an isotope of helium.""".toHtml == expected + test "Roles: warnings": + let input = dedent""" + See function :py:func:`spam`. + + See also `egg`:py:class:. + """ + var warnings = new seq[string] + let output = input.toHtml(warnings=warnings) + doAssert warnings[].len == 2 + check "(1, 14) Warning: " in warnings[0] + check "language 'py:func' not supported" in warnings[0] + check "(3, 15) Warning: " in warnings[1] + check "language 'py:class' not supported" in warnings[1] + check("""<p>See function <span class="py:func">spam</span>.</p>""" & "\n" & + """<p>See also <span class="py:class">egg</span>. </p>""" & "\n" == + output) + test "(not) Roles: check escaping 1": let expected = """See :subscript:<tt class="docutils literal">""" & """<span class="pre">""" & id"some" & " " & id"text" & |