From 4c533b2d92162980dc8fac2332b0eb0739dbda25 Mon Sep 17 00:00:00 2001 From: Xabier Bello Date: Tue, 8 Dec 2020 10:44:07 +0100 Subject: Added Python to highlite module. (#16286) * Added Python to highlite module. * Added the keywords for Python * Refactored the 'pythonLikeNextToken' into 'nimNextToken': - `lang` property added to GeneralTokenizer object, is set in `getNextToken`. - `nimNextToken` accepts `keywords` parameter, used for languages different from Nim. - Multiline comment available only for `langNim`. --- tests/stdlib/trstgen.nim | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index 1bf73e146..8b12a89c4 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -188,13 +188,13 @@ not in table""" let input1 = """ Test 2 column/4 rows table: ==== === -H0 H1 +H0 H1 ==== === -A0 A1 +A0 A1 ==== === -A2 A3 +A2 A3 ==== === -A4 A5 +A4 A5 ==== === """ let output1 = rstToLatex(input1, {}) assert "{|X|X|}" in output1 # 2 columns @@ -360,3 +360,19 @@ Test1 let output1l = rstToLatex(input1, {}) assert "line block\\\\" in output1l assert "other line\\\\" in output1l + +suite "RST/Code highlight": + test "Basic Python code highlight": + let pythonCode = """ + .. code-block:: python + + def f_name(arg=42): + print(f"{arg}") + + """ + + let expected = """

def f_name(arg=42): + print(f"{arg}")

""" + + check strip(rstToHtml(pythonCode, {}, newStringTable(modeCaseSensitive))) == + strip(expected) -- cgit 1.4.1-2-gfad0 201b2713a4045167fd8feb407df98a43997'/>
path: root/tools/nim.zsh-completion
blob: e9b9002fb5c1295ddca8fa2fcfbbdab641a486ec (plain) (tree)
1
2
3
4
5
6
7