koch knows about json2
This commit is contained in:
parent
358f582939
commit
ecae779956
2 changed files with 25 additions and 10 deletions
15
koch.nim
15
koch.nim
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Maintenance program for Nim
|
# Maintenance program for Nim
|
||||||
# (c) Copyright 2015 Andreas Rumpf
|
# (c) Copyright 2016 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -30,7 +30,7 @@ const
|
||||||
+-----------------------------------------------------------------+
|
+-----------------------------------------------------------------+
|
||||||
| Maintenance program for Nim |
|
| Maintenance program for Nim |
|
||||||
| Version $1|
|
| Version $1|
|
||||||
| (c) 2015 Andreas Rumpf |
|
| (c) 2016 Andreas Rumpf |
|
||||||
+-----------------------------------------------------------------+
|
+-----------------------------------------------------------------+
|
||||||
Build time: $2, $3
|
Build time: $2, $3
|
||||||
|
|
||||||
|
|
@ -80,17 +80,17 @@ proc findNim(): string =
|
||||||
# assume there is a symlink to the exe or something:
|
# assume there is a symlink to the exe or something:
|
||||||
return nim
|
return nim
|
||||||
|
|
||||||
proc exec(cmd: string, errorcode: int = QuitFailure, additionalPATH = "") =
|
proc exec(cmd: string, errorcode: int = QuitFailure, additionalPath = "") =
|
||||||
let prevPATH = getEnv("PATH")
|
let prevPath = getEnv("PATH")
|
||||||
if additionalPATH.len > 0:
|
if additionalPath.len > 0:
|
||||||
var absolute = additionalPATH
|
var absolute = additionalPATH
|
||||||
if not absolute.isAbsolute:
|
if not absolute.isAbsolute:
|
||||||
absolute = getCurrentDir() / absolute
|
absolute = getCurrentDir() / absolute
|
||||||
echo("Adding to $PATH: ", absolute)
|
echo("Adding to $PATH: ", absolute)
|
||||||
putEnv("PATH", prevPATH & PathSep & absolute)
|
putEnv("PATH", prevPath & PathSep & absolute)
|
||||||
echo(cmd)
|
echo(cmd)
|
||||||
if execShellCmd(cmd) != 0: quit("FAILURE", errorcode)
|
if execShellCmd(cmd) != 0: quit("FAILURE", errorcode)
|
||||||
putEnv("PATH", prevPATH)
|
putEnv("PATH", prevPath)
|
||||||
|
|
||||||
proc execCleanPath(cmd: string,
|
proc execCleanPath(cmd: string,
|
||||||
additionalPath = ""; errorcode: int = QuitFailure) =
|
additionalPath = ""; errorcode: int = QuitFailure) =
|
||||||
|
|
@ -433,6 +433,7 @@ of cmdArgument:
|
||||||
of "boot": boot(op.cmdLineRest)
|
of "boot": boot(op.cmdLineRest)
|
||||||
of "clean": clean(op.cmdLineRest)
|
of "clean": clean(op.cmdLineRest)
|
||||||
of "web": web(op.cmdLineRest)
|
of "web": web(op.cmdLineRest)
|
||||||
|
of "json2": web("--json2 " & op.cmdLineRest)
|
||||||
of "website": website(op.cmdLineRest & " --googleAnalytics:UA-48159761-1")
|
of "website": website(op.cmdLineRest & " --googleAnalytics:UA-48159761-1")
|
||||||
of "web0":
|
of "web0":
|
||||||
# undocumented command for Araq-the-merciful:
|
# undocumented command for Araq-the-merciful:
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ type
|
||||||
TRssItem = object
|
TRssItem = object
|
||||||
year, month, day, title, url, content: string
|
year, month, day, title, url, content: string
|
||||||
TAction = enum
|
TAction = enum
|
||||||
actAll, actOnlyWebsite, actPdf
|
actAll, actOnlyWebsite, actPdf, actJson2
|
||||||
|
|
||||||
Sponsor = object
|
Sponsor = object
|
||||||
logo: string
|
logo: string
|
||||||
|
|
@ -157,6 +157,7 @@ proc parseCmdLine(c: var TConfigData) =
|
||||||
c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
|
c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
|
||||||
of "website": action = actOnlyWebsite
|
of "website": action = actOnlyWebsite
|
||||||
of "pdf": action = actPdf
|
of "pdf": action = actPdf
|
||||||
|
of "json2": action = actJson2
|
||||||
of "googleanalytics":
|
of "googleanalytics":
|
||||||
c.gaId = val
|
c.gaId = val
|
||||||
c.nimArgs.add("--doc.googleAnalytics:" & val & " ")
|
c.nimArgs.add("--doc.googleAnalytics:" & val & " ")
|
||||||
|
|
@ -379,7 +380,7 @@ proc genNewsLink(title: string): string =
|
||||||
result = title
|
result = title
|
||||||
result.insert("Z")
|
result.insert("Z")
|
||||||
for i in 1..len(result)-1:
|
for i in 1..len(result)-1:
|
||||||
let letter = result[i].toLower()
|
let letter = result[i].toLowerAscii()
|
||||||
if letter in validAnchorCharacters:
|
if letter in validAnchorCharacters:
|
||||||
result[i] = letter
|
result[i] = letter
|
||||||
else:
|
else:
|
||||||
|
|
@ -487,7 +488,6 @@ proc buildNews(c: var TConfigData, newsDir: string, outputDir: string) =
|
||||||
echo("Skipping file in news directory: ", path)
|
echo("Skipping file in news directory: ", path)
|
||||||
|
|
||||||
proc buildWebsite(c: var TConfigData) =
|
proc buildWebsite(c: var TConfigData) =
|
||||||
|
|
||||||
if c.ticker.len > 0:
|
if c.ticker.len > 0:
|
||||||
try:
|
try:
|
||||||
c.ticker = readFile("web" / c.ticker)
|
c.ticker = readFile("web" / c.ticker)
|
||||||
|
|
@ -512,6 +512,19 @@ proc main(c: var TConfigData) =
|
||||||
buildDocSamples(c, "doc")
|
buildDocSamples(c, "doc")
|
||||||
buildDoc(c, "doc")
|
buildDoc(c, "doc")
|
||||||
|
|
||||||
|
proc json2(c: var TConfigData) =
|
||||||
|
const destPath = "web/json2"
|
||||||
|
var commands = newSeq[string](c.srcdoc2.len)
|
||||||
|
var i = 0
|
||||||
|
for d in items(c.srcdoc2):
|
||||||
|
createDir(destPath / splitFile(d).dir)
|
||||||
|
commands[i] = findNim() & " jsondoc2 $# --docSeeSrcUrl:$#/$#/$# -o:$# --index:on $#" %
|
||||||
|
[c.nimArgs, c.gitRepo, c.gitCommit, d.pathPart,
|
||||||
|
destPath / changeFileExt(d, "json"), d]
|
||||||
|
i.inc
|
||||||
|
|
||||||
|
mexec(commands, c.numProcessors)
|
||||||
|
|
||||||
var c: TConfigData
|
var c: TConfigData
|
||||||
initConfigData(c)
|
initConfigData(c)
|
||||||
parseCmdLine(c)
|
parseCmdLine(c)
|
||||||
|
|
@ -520,3 +533,4 @@ case action
|
||||||
of actOnlyWebsite: buildWebsite(c)
|
of actOnlyWebsite: buildWebsite(c)
|
||||||
of actPdf: buildPdfDoc(c, "doc")
|
of actPdf: buildPdfDoc(c, "doc")
|
||||||
of actAll: main(c)
|
of actAll: main(c)
|
||||||
|
of actJson2: json2(c)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue