fix nim md2tex and koch pdf commands (#20280)

* fix `nim md2tex` and `koch pdf` commands

* change rst2tex -> md2tex also
This commit is contained in:
Andrey Makarov
2022-08-29 01:04:13 +03:00
committed by GitHub
parent 2b56b38235
commit ee11302c24
2 changed files with 13 additions and 12 deletions

View File

@@ -277,7 +277,8 @@ proc getOutFile2(conf: ConfigRef; filename: RelativeFile,
else:
result = getOutFile(conf, filename, ext)
proc isLatexCmd(conf: ConfigRef): bool = conf.cmd in {cmdRst2tex, cmdDoc2tex}
proc isLatexCmd(conf: ConfigRef): bool =
conf.cmd in {cmdRst2tex, cmdMd2tex, cmdDoc2tex}
proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
outExt: string = HtmlExt, module: PSym = nil,

View File

@@ -121,15 +121,15 @@ proc getMd2html(): seq[string] =
doAssert "doc/manual/var_t_return.md".unixToNativePath in result # sanity check
const
rstPdfList = """
manual.rst
lib.rst
tut1.rst
tut2.rst
tut3.rst
nimc.rst
niminst.rst
mm.rst
mdPdfList = """
manual.md
lib.md
tut1.md
tut2.md
tut3.md
nimc.md
niminst.md
mm.md
""".splitWhitespace().mapIt("doc" / it)
doc0 = """
@@ -293,7 +293,7 @@ proc nim2pdf(src: string, dst: string, nimArgs: string) =
# xxx expose as a `nim` command or in some other reusable way.
let outDir = "build" / "xelatextmp" # xxx factor pending https://github.com/timotheecour/Nim/issues/616
# note: this will generate temporary files in gitignored `outDir`: aux toc log out tex
exec("$# rst2tex $# --outdir:$# $#" % [findNim().quoteShell(), nimArgs, outDir.quoteShell, src.quoteShell])
exec("$# md2tex $# --outdir:$# $#" % [findNim().quoteShell(), nimArgs, outDir.quoteShell, src.quoteShell])
let texFile = outDir / src.lastPathPart.changeFileExt("tex")
for i in 0..<3: # call LaTeX three times to get cross references right:
let xelatexLog = outDir / "xelatex.log"
@@ -314,7 +314,7 @@ proc buildPdfDoc*(nimArgs, destPath: string) =
if os.execShellCmd("xelatex -version") != 0:
doAssert false, "xelatex not found" # or, raise an exception
else:
for src in items(rstPdfList):
for src in items(mdPdfList):
let dst = destPath / src.lastPathPart.changeFileExt("pdf")
pdfList.add dst
nim2pdf(src, dst, nimArgs)