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
commit ee11302c24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View file

@ -277,7 +277,8 @@ proc getOutFile2(conf: ConfigRef; filename: RelativeFile,
else: else:
result = getOutFile(conf, filename, ext) 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, proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
outExt: string = HtmlExt, module: PSym = nil, 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 doAssert "doc/manual/var_t_return.md".unixToNativePath in result # sanity check
const const
rstPdfList = """ mdPdfList = """
manual.rst manual.md
lib.rst lib.md
tut1.rst tut1.md
tut2.rst tut2.md
tut3.rst tut3.md
nimc.rst nimc.md
niminst.rst niminst.md
mm.rst mm.md
""".splitWhitespace().mapIt("doc" / it) """.splitWhitespace().mapIt("doc" / it)
doc0 = """ 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. # 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 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 # 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") let texFile = outDir / src.lastPathPart.changeFileExt("tex")
for i in 0..<3: # call LaTeX three times to get cross references right: for i in 0..<3: # call LaTeX three times to get cross references right:
let xelatexLog = outDir / "xelatex.log" let xelatexLog = outDir / "xelatex.log"
@ -314,7 +314,7 @@ proc buildPdfDoc*(nimArgs, destPath: string) =
if os.execShellCmd("xelatex -version") != 0: if os.execShellCmd("xelatex -version") != 0:
doAssert false, "xelatex not found" # or, raise an exception doAssert false, "xelatex not found" # or, raise an exception
else: else:
for src in items(rstPdfList): for src in items(mdPdfList):
let dst = destPath / src.lastPathPart.changeFileExt("pdf") let dst = destPath / src.lastPathPart.changeFileExt("pdf")
pdfList.add dst pdfList.add dst
nim2pdf(src, dst, nimArgs) nim2pdf(src, dst, nimArgs)