parent
33cd883e27
commit
56a901f9e1
3 changed files with 9 additions and 6 deletions
|
|
@ -237,6 +237,7 @@ template declareClosures =
|
||||||
of meInvalidDirective: k = errRstInvalidDirectiveX
|
of meInvalidDirective: k = errRstInvalidDirectiveX
|
||||||
of meInvalidField: k = errRstInvalidField
|
of meInvalidField: k = errRstInvalidField
|
||||||
of meFootnoteMismatch: k = errRstFootnoteMismatch
|
of meFootnoteMismatch: k = errRstFootnoteMismatch
|
||||||
|
of meSandboxedDirective: k = errRstSandboxedDirective
|
||||||
of mwRedefinitionOfLabel: k = warnRstRedefinitionOfLabel
|
of mwRedefinitionOfLabel: k = warnRstRedefinitionOfLabel
|
||||||
of mwUnknownSubstitution: k = warnRstUnknownSubstitutionX
|
of mwUnknownSubstitution: k = warnRstUnknownSubstitutionX
|
||||||
of mwAmbiguousLink: k = warnRstAmbiguousLink
|
of mwAmbiguousLink: k = warnRstAmbiguousLink
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ type
|
||||||
errRstInvalidDirectiveX,
|
errRstInvalidDirectiveX,
|
||||||
errRstInvalidField,
|
errRstInvalidField,
|
||||||
errRstFootnoteMismatch,
|
errRstFootnoteMismatch,
|
||||||
|
errRstSandboxedDirective,
|
||||||
errProveInit, # deadcode
|
errProveInit, # deadcode
|
||||||
errGenerated,
|
errGenerated,
|
||||||
errUser,
|
errUser,
|
||||||
|
|
@ -110,6 +111,7 @@ const
|
||||||
errRstInvalidDirectiveX: "invalid directive: '$1'",
|
errRstInvalidDirectiveX: "invalid directive: '$1'",
|
||||||
errRstInvalidField: "invalid field: $1",
|
errRstInvalidField: "invalid field: $1",
|
||||||
errRstFootnoteMismatch: "number of footnotes and their references don't match: $1",
|
errRstFootnoteMismatch: "number of footnotes and their references don't match: $1",
|
||||||
|
errRstSandboxedDirective: "disabled directive: '$1'",
|
||||||
errProveInit: "Cannot prove that '$1' is initialized.", # deadcode
|
errProveInit: "Cannot prove that '$1' is initialized.", # deadcode
|
||||||
errGenerated: "$1",
|
errGenerated: "$1",
|
||||||
errUser: "$1",
|
errUser: "$1",
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import std/private/miscdollars
|
||||||
import os
|
import os
|
||||||
|
|
||||||
proc toAst(input: string,
|
proc toAst(input: string,
|
||||||
rstOptions: RstParseOptions = {roPreferMarkdown, roSupportMarkdown, roNimFile},
|
rstOptions: RstParseOptions = {roPreferMarkdown, roSupportMarkdown, roNimFile, roSandboxDisabled},
|
||||||
error: ref string = nil,
|
error: ref string = nil,
|
||||||
warnings: ref seq[string] = nil): string =
|
warnings: ref seq[string] = nil): string =
|
||||||
## If `error` is nil then no errors should be generated.
|
## If `error` is nil then no errors should be generated.
|
||||||
|
|
@ -866,7 +866,7 @@ suite "RST include directive":
|
||||||
test "Include whole":
|
test "Include whole":
|
||||||
"other.rst".writeFile("**test1**")
|
"other.rst".writeFile("**test1**")
|
||||||
let input = ".. include:: other.rst"
|
let input = ".. include:: other.rst"
|
||||||
doAssert "<strong>test1</strong>" == rstTohtml(input, {}, defaultConfig())
|
doAssert "<strong>test1</strong>" == rstTohtml(input, {roSandboxDisabled}, defaultConfig())
|
||||||
removeFile("other.rst")
|
removeFile("other.rst")
|
||||||
|
|
||||||
test "Include starting from":
|
test "Include starting from":
|
||||||
|
|
@ -880,7 +880,7 @@ OtherStart
|
||||||
.. include:: other.rst
|
.. include:: other.rst
|
||||||
:start-after: OtherStart
|
:start-after: OtherStart
|
||||||
"""
|
"""
|
||||||
check "<em>Visible</em>" == rstTohtml(input, {}, defaultConfig())
|
check "<em>Visible</em>" == rstTohtml(input, {roSandboxDisabled}, defaultConfig())
|
||||||
removeFile("other.rst")
|
removeFile("other.rst")
|
||||||
|
|
||||||
test "Include everything before":
|
test "Include everything before":
|
||||||
|
|
@ -894,7 +894,7 @@ And this should **NOT** be visible in `docs.html`
|
||||||
.. include:: other.rst
|
.. include:: other.rst
|
||||||
:end-before: OtherEnd
|
:end-before: OtherEnd
|
||||||
"""
|
"""
|
||||||
doAssert "<em>Visible</em>" == rstTohtml(input, {}, defaultConfig())
|
doAssert "<em>Visible</em>" == rstTohtml(input, {roSandboxDisabled}, defaultConfig())
|
||||||
removeFile("other.rst")
|
removeFile("other.rst")
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -912,7 +912,7 @@ And this should **NOT** be visible in `docs.html`
|
||||||
:start-after: OtherStart
|
:start-after: OtherStart
|
||||||
:end-before: OtherEnd
|
:end-before: OtherEnd
|
||||||
"""
|
"""
|
||||||
check "<em>Visible</em>" == rstTohtml(input, {}, defaultConfig())
|
check "<em>Visible</em>" == rstTohtml(input, {roSandboxDisabled}, defaultConfig())
|
||||||
removeFile("other.rst")
|
removeFile("other.rst")
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -932,7 +932,7 @@ And this should **NOT** be visible in `docs.html`
|
||||||
:start-after: OtherStart
|
:start-after: OtherStart
|
||||||
:end-before: OtherEnd
|
:end-before: OtherEnd
|
||||||
"""
|
"""
|
||||||
doAssert "<em>Visible</em>" == rstTohtml(input, {}, defaultConfig())
|
doAssert "<em>Visible</em>" == rstTohtml(input, {roSandboxDisabled}, defaultConfig())
|
||||||
removeFile("other.rst")
|
removeFile("other.rst")
|
||||||
|
|
||||||
suite "RST escaping":
|
suite "RST escaping":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue