diff options
author | Andrey Makarov <ph.makarov@gmail.com> | 2022-08-23 21:49:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 14:49:53 -0400 |
commit | 14656154efa2b3f08a341742c697fd1064f40166 (patch) | |
tree | 36c9d2b28f6a4f3f227d60f653bc00fa05784fae /nimdoc/tester.nim | |
parent | f4af9e955b64e8fd055da2c85b1846ca5cd1d663 (diff) | |
download | Nim-14656154efa2b3f08a341742c697fd1064f40166.tar.gz |
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>
Diffstat (limited to 'nimdoc/tester.nim')
-rw-r--r-- | nimdoc/tester.nim | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nimdoc/tester.nim b/nimdoc/tester.nim index 32dce0709..ef82ae1b9 100644 --- a/nimdoc/tester.nim +++ b/nimdoc/tester.nim @@ -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 |