docgen: PDFs and HTMLs finally are generated in their own respective directories

This commit is contained in:
Araq 2016-10-24 11:55:23 +02:00
commit ed9d0809ae
5 changed files with 21 additions and 8 deletions

View file

@ -41,8 +41,8 @@ Files: "config/nimdoc.tex.cfg"
; Files: "doc/*.cfg"
; Files: "doc/*.pdf"
; Files: "doc/*.ini"
Files: "doc/overview.html"
Start: "doc/overview.html"
Files: "doc/html/overview.html"
Start: "doc/html/overview.html"
[Other]
@ -63,6 +63,7 @@ Files: "icons/koch_icon.o"
Files: "compiler"
Files: "doc"
Files: "doc/html"
Files: "tools"
Files: "web/website.ini"
Files: "web/ticker.html"

View file

@ -72,7 +72,7 @@ when defined(windows):
createShortcut(getCurrentDir() / "start.bat", dest / "Nim",
getCurrentDir() / r"icons\nim.ico")
if fileExists("doc/overview.html"):
createShortcut(getCurrentDir() / "doc" / "overview.html",
createShortcut(getCurrentDir() / "doc" / "html" / "overview.html",
dest / "Overview")
if dirExists(r"dist\aporia-0.4.0"):
createShortcut(getCurrentDir() / r"dist\aporia-0.4.0\bin\aporia.exe",

View file

@ -369,6 +369,7 @@ of cmdArgument:
of "boot": boot(op.cmdLineRest)
of "clean": clean(op.cmdLineRest)
of "web": web(op.cmdLineRest)
of "docs": web("--onlyDocs " & op.cmdLineRest)
of "json2": web("--json2 " & op.cmdLineRest)
of "website": website(op.cmdLineRest & " --googleAnalytics:UA-48159761-1")
of "web0":

View file

@ -29,7 +29,7 @@ type
TRssItem = object
year, month, day, title, url, content: string
TAction = enum
actAll, actOnlyWebsite, actPdf, actJson2
actAll, actOnlyWebsite, actPdf, actJson2, actOnlyDocs
Sponsor = object
logo: string
@ -72,7 +72,7 @@ include "website.tmpl"
# ------------------------- configuration file -------------------------------
const
version = "0.7"
version = "0.8"
usage = "nimweb - Nim Website Generator Version " & version & """
(c) 2015 Andreas Rumpf
@ -85,6 +85,8 @@ Options:
-v, --version shows the version
--website only build the website, not the full documentation
--pdf build the PDF version of the documentation
--json2 build JSON of the documentation
--onlyDocs build only the documentation
Compile_options:
will be passed to the Nim compiler
"""
@ -157,6 +159,7 @@ proc parseCmdLine(c: var TConfigData) =
of "website": action = actOnlyWebsite
of "pdf": action = actPdf
of "json2": action = actJson2
of "onlydocs": action = actOnlyDocs
of "googleanalytics":
c.gaId = val
c.nimArgs.add("--doc.googleAnalytics:" & val & " ")
@ -315,6 +318,7 @@ proc buildDoc(c: var TConfigData, destPath: string) =
exec(findNim() & " buildIndex -o:$1/theindex.html $1" % [destPath])
proc buildPdfDoc(c: var TConfigData, destPath: string) =
createDir(destPath)
if os.execShellCmd("pdflatex -version") != 0:
echo "pdflatex not found; no PDF documentation generated"
else:
@ -507,8 +511,14 @@ proc main(c: var TConfigData) =
buildAddDoc(c, docup)
buildDocSamples(c, docup)
buildDoc(c, docup)
buildDocSamples(c, "doc")
buildDoc(c, "doc")
createDir("doc/html")
buildDocSamples(c, "doc/html")
buildDoc(c, "doc/html")
proc onlyDocs(c: var TConfigData) =
createDir("doc/html")
buildDocSamples(c, "doc/html")
buildDoc(c, "doc/html")
proc json2(c: var TConfigData) =
const destPath = "web/json2"
@ -529,6 +539,7 @@ parseCmdLine(c)
parseIniFile(c)
case action
of actOnlyWebsite: buildWebsite(c)
of actPdf: buildPdfDoc(c, "doc")
of actPdf: buildPdfDoc(c, "doc/pdf")
of actOnlyDocs: onlyDocs(c)
of actAll: main(c)
of actJson2: json2(c)