Add doctype: RST|Markdown|RstMarkdown pragma (#20252)
* Add `doctype: RST|Markdown|RstMarkdown` pragma Implements https://github.com/nim-lang/RFCs/issues/68 , see also discussion in https://github.com/nim-lang/Nim/issues/17987 The permitted values: * `markdown`, which is default. It still contains nearly all of the RST supported but it is assumed that in time we will give up most or all RST features in this mode * `rst`, without any extensions * `RstMarkdown` — compatibility with Nim 1.x. It's basically RST with those Markdown features enabled that don't conflict with RST. * Apply suggestions from code review Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Additional fix in spirit of review * Fix test after #20188 Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
This commit is contained in:
parent
f4af9e955b
commit
14656154ef
7 changed files with 158 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ proc testNimDoc(prjDir, docsDir: string; switches: NimSwitches; fixup = false) =
|
|||
if nimBuildIndexSwitches != "":
|
||||
exec("$1 buildIndex $2" % [nimExe, nimBuildIndexSwitches])
|
||||
|
||||
for expected in walkDirRec(prjDir / "expected/"):
|
||||
for expected in walkDirRec(prjDir / "expected/", checkDir=true):
|
||||
let produced = expected.replace('\\', '/').replace("/expected/", "/$1/" % [docsDir])
|
||||
if not fileExists(produced):
|
||||
echo "FAILURE: files not found: ", produced
|
||||
|
|
@ -79,5 +79,14 @@ let
|
|||
"$1/$2" % [test2Dir, test2DocsDir]])
|
||||
testNimDoc(test2Dir, test2DocsDir, test2Switches, fixup)
|
||||
|
||||
# Test `nim doc` on file with `{.doctype.}` pragma
|
||||
let
|
||||
test3PrjDir = "test_doctype"
|
||||
test3PrjName = "test_doctype"
|
||||
test3Dir = baseDir / test3PrjDir
|
||||
test3DocsDir = "htmldocs"
|
||||
test3Switches = NimSwitches(doc: @["$1/$2.nim" % [test3Dir, test3PrjName]])
|
||||
testNimDoc(test3Dir, test3DocsDir, test3Switches, fixup)
|
||||
|
||||
if failures > 0:
|
||||
quit "$# failures occurred; see note in nimdoc/tester.nim regarding -d:nimTestsNimdocFixup" % $failures
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue