diff options
author | Andrey Makarov <ph.makarov@gmail.com> | 2021-05-14 08:30:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-14 07:30:47 +0200 |
commit | 97970d9dccb24bb290cdba14275acae62602c832 (patch) | |
tree | b4d35aefd2a1a549fdbe5ebd4839bd7e7c165105 /compiler/renderverbatim.nim | |
parent | 3c622d799929520ce4f1831ec2b8ba575f21e2e0 (diff) | |
download | Nim-97970d9dccb24bb290cdba14275acae62602c832.tar.gz |
`doc2tex`: generate docs to Latex (#17997)
* `doc2tex`: generate docs to Latex * address some comments
Diffstat (limited to 'compiler/renderverbatim.nim')
-rw-r--r-- | compiler/renderverbatim.nim | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/compiler/renderverbatim.nim b/compiler/renderverbatim.nim index 02d405844..a20c8873d 100644 --- a/compiler/renderverbatim.nim +++ b/compiler/renderverbatim.nim @@ -1,8 +1,6 @@ import strutils -from xmltree import addEscaped import ast, options, msgs -import packages/docutils/highlite const isDebug = false when isDebug: @@ -131,22 +129,3 @@ proc extractRunnableExamplesSource*(conf: ConfigRef; n: PNode): string = lastNonemptyPos = result.len result.setLen lastNonemptyPos -proc renderNimCode*(result: var string, code: string, isLatex = false) = - var toknizr: GeneralTokenizer - initGeneralTokenizer(toknizr, code) - var buf = "" - template append(kind, val) = - buf.setLen 0 - buf.addEscaped(val) - let class = tokenClassToStr[kind] - if isLatex: - result.addf "\\span$1{$2}", [class, buf] - else: - result.addf "<span class=\"$1\">$2</span>", [class, buf] - while true: - getNextToken(toknizr, langNim) - case toknizr.kind - of gtEof: break # End Of File (or string) - else: - # TODO: avoid alloc; maybe toOpenArray - append(toknizr.kind, substr(code, toknizr.start, toknizr.length + toknizr.start - 1)) |