removed global variable from rstgen.nim
This commit is contained in:
parent
c640bd2d1b
commit
73799903ee
2 changed files with 8 additions and 6 deletions
|
|
@ -853,7 +853,6 @@ proc commandRst2Html*(cache: IdentCache, conf: ConfigRef) =
|
||||||
commandRstAux(cache, conf, conf.projectFull, HtmlExt)
|
commandRstAux(cache, conf, conf.projectFull, HtmlExt)
|
||||||
|
|
||||||
proc commandRst2TeX*(cache: IdentCache, conf: ConfigRef) =
|
proc commandRst2TeX*(cache: IdentCache, conf: ConfigRef) =
|
||||||
splitter = "\\-"
|
|
||||||
commandRstAux(cache, conf, conf.projectFull, TexExt)
|
commandRstAux(cache, conf, conf.projectFull, TexExt)
|
||||||
|
|
||||||
proc commandJson*(cache: IdentCache, conf: ConfigRef) =
|
proc commandJson*(cache: IdentCache, conf: ConfigRef) =
|
||||||
|
|
|
||||||
|
|
@ -188,13 +188,16 @@ proc addTexChar(dest: var string, c: char) =
|
||||||
of '`': add(dest, "\\symbol{96}")
|
of '`': add(dest, "\\symbol{96}")
|
||||||
else: add(dest, c)
|
else: add(dest, c)
|
||||||
|
|
||||||
var splitter*: string = "<wbr />"
|
|
||||||
|
|
||||||
proc escChar*(target: OutputTarget, dest: var string, c: char) {.inline.} =
|
proc escChar*(target: OutputTarget, dest: var string, c: char) {.inline.} =
|
||||||
case target
|
case target
|
||||||
of outHtml: addXmlChar(dest, c)
|
of outHtml: addXmlChar(dest, c)
|
||||||
of outLatex: addTexChar(dest, c)
|
of outLatex: addTexChar(dest, c)
|
||||||
|
|
||||||
|
proc addSplitter(target: OutputTarget; dest: var string) {.inline.} =
|
||||||
|
case target
|
||||||
|
of outHtml: add(dest, "<wbr />")
|
||||||
|
of outLatex: add(dest, "\\-")
|
||||||
|
|
||||||
proc nextSplitPoint*(s: string, start: int): int =
|
proc nextSplitPoint*(s: string, start: int): int =
|
||||||
result = start
|
result = start
|
||||||
while result < len(s) + 0:
|
while result < len(s) + 0:
|
||||||
|
|
@ -215,9 +218,9 @@ proc esc*(target: OutputTarget, s: string, splitAfter = -1): string =
|
||||||
var j = 0
|
var j = 0
|
||||||
while j < len(s):
|
while j < len(s):
|
||||||
var k = nextSplitPoint(s, j)
|
var k = nextSplitPoint(s, j)
|
||||||
if (splitter != " ") or (partLen + k - j + 1 > splitAfter):
|
#if (splitter != " ") or (partLen + k - j + 1 > splitAfter):
|
||||||
partLen = 0
|
partLen = 0
|
||||||
add(result, splitter)
|
addSplitter(target, result)
|
||||||
for i in countup(j, k): escChar(target, result, s[i])
|
for i in countup(j, k): escChar(target, result, s[i])
|
||||||
inc(partLen, k - j + 1)
|
inc(partLen, k - j + 1)
|
||||||
j = k + 1
|
j = k + 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue