diff options
author | Andrey Makarov <ph.makarov@gmail.com> | 2021-03-17 20:08:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-17 18:08:13 +0100 |
commit | 144e338abb33debfa6ec6abdf3a110aade779485 (patch) | |
tree | 172c716e7165d1b34cceffd01522ff8dbd8523b4 /tests/stdlib/trstgen.nim | |
parent | e9b5543bd503ffebbd7fc4b5328d8a9c69419908 (diff) | |
download | Nim-144e338abb33debfa6ec6abdf3a110aade779485.tar.gz |
allow short-style rst references with symbols (#17372)
Diffstat (limited to 'tests/stdlib/trstgen.nim')
-rw-r--r-- | tests/stdlib/trstgen.nim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index 7d5c0e28f..61e4d44e7 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -1184,6 +1184,31 @@ Test1 doAssert "Ref. <a class=\"reference internal\" " & "href=\"#some-definition\">some definition</a>" in output1 + test "RST references (additional symbols)": + # check that ., _, -, +, : are allowed symbols in references without ` ` + let input1 = dedent """ + sec.1 + ----- + + 2-other:sec+c_2 + ^^^^^^^^^^^^^^^ + + .. _link.1_2021: + + Paragraph + + Ref. sec.1_! and 2-other:sec+c_2_;and link.1_2021_. + """ + let output1 = input1.toHtml + doAssert "id=\"secdot1\"" in output1 + doAssert "id=\"Z2minusothercolonsecplusc-2\"" in output1 + doAssert "id=\"linkdot1-2021\"" in output1 + let ref1 = "<a class=\"reference internal\" href=\"#secdot1\">sec.1</a>" + let ref2 = "<a class=\"reference internal\" href=\"#Z2minusothercolonsecplusc-2\">2-other:sec+c_2</a>" + let ref3 = "<a class=\"reference internal\" href=\"#linkdot1-2021\">link.1_2021</a>" + let refline = "Ref. " & ref1 & "! and " & ref2 & ";and " & ref3 & "." + doAssert refline in output1 + suite "RST/Code highlight": test "Basic Python code highlight": let pythonCode = """ |