docutils: make ':test:' work without argument
This commit is contained in:
parent
efae366857
commit
ed9c28484a
2 changed files with 7 additions and 4 deletions
|
|
@ -816,7 +816,7 @@ proc commandRstAux(filename, outExt: string) =
|
||||||
# Nim's convention: every path is relative to the file it was written in:
|
# Nim's convention: every path is relative to the file it was written in:
|
||||||
outp = splitFile(d.filename).dir / filename
|
outp = splitFile(d.filename).dir / filename
|
||||||
writeFile(outp, content)
|
writeFile(outp, content)
|
||||||
let cmd = unescape(cmd) % quoteShell(outp)
|
let cmd = cmd % quoteShell(outp)
|
||||||
rawMessage(hintExecuting, cmd)
|
rawMessage(hintExecuting, cmd)
|
||||||
if execShellCmd(cmd) != status:
|
if execShellCmd(cmd) != status:
|
||||||
rawMessage(errExecutionOfProgramFailed, cmd)
|
rawMessage(errExecutionOfProgramFailed, cmd)
|
||||||
|
|
|
||||||
|
|
@ -820,7 +820,7 @@ proc parseCodeBlockField(d: PDoc, n: PRstNode, params: var CodeBlockParams) =
|
||||||
##
|
##
|
||||||
## This supports the special ``default-language`` internal string generated
|
## This supports the special ``default-language`` internal string generated
|
||||||
## by the ``rst`` module to communicate a specific default language.
|
## by the ``rst`` module to communicate a specific default language.
|
||||||
case n.getArgument.toLower
|
case n.getArgument.toLowerAscii
|
||||||
of "number-lines":
|
of "number-lines":
|
||||||
params.numberLines = true
|
params.numberLines = true
|
||||||
# See if the field has a parameter specifying a different line than 1.
|
# See if the field has a parameter specifying a different line than 1.
|
||||||
|
|
@ -836,8 +836,11 @@ proc parseCodeBlockField(d: PDoc, n: PRstNode, params: var CodeBlockParams) =
|
||||||
params.filename = n.getFieldValue.strip
|
params.filename = n.getFieldValue.strip
|
||||||
of "test":
|
of "test":
|
||||||
params.testCmd = n.getFieldValue.strip
|
params.testCmd = n.getFieldValue.strip
|
||||||
if params.testCmd.len == 0: params.testCmd = "nim c -r $1"
|
if params.testCmd.len == 0:
|
||||||
of "status":
|
params.testCmd = "nim c -r $1"
|
||||||
|
else:
|
||||||
|
params.testCmd = unescape(params.testCmd)
|
||||||
|
of "status", "exitcode":
|
||||||
var status: int
|
var status: int
|
||||||
if parseInt(n.getFieldValue, status) > 0:
|
if parseInt(n.getFieldValue, status) > 0:
|
||||||
params.status = status
|
params.status = status
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue