parent
5ef0494677
commit
1b54be7779
13 changed files with 28 additions and 16 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -89,3 +89,5 @@ megatest.nim
|
||||||
|
|
||||||
# ignore debug dirs generated by dsymutil on OSX
|
# ignore debug dirs generated by dsymutil on OSX
|
||||||
*.dSYM
|
*.dSYM
|
||||||
|
|
||||||
|
nimdoc.out.css
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import
|
||||||
packages/docutils/rst, packages/docutils/rstgen,
|
packages/docutils/rst, packages/docutils/rstgen,
|
||||||
json, xmltree, cgi, trees, types,
|
json, xmltree, cgi, trees, types,
|
||||||
typesrenderer, astalgo, lineinfos, intsets,
|
typesrenderer, astalgo, lineinfos, intsets,
|
||||||
pathutils, trees
|
pathutils, trees, nimconf
|
||||||
|
|
||||||
const
|
const
|
||||||
exportSection = skField
|
exportSection = skField
|
||||||
|
|
@ -43,6 +43,7 @@ type
|
||||||
destFile*: AbsoluteFile
|
destFile*: AbsoluteFile
|
||||||
thisDir*: AbsoluteDir
|
thisDir*: AbsoluteDir
|
||||||
examples: string
|
examples: string
|
||||||
|
wroteCss*: bool
|
||||||
|
|
||||||
PDoc* = ref TDocumentor ## Alias to type less.
|
PDoc* = ref TDocumentor ## Alias to type less.
|
||||||
|
|
||||||
|
|
@ -1069,10 +1070,16 @@ proc writeOutput*(d: PDoc, useWarning = false) =
|
||||||
template outfile: untyped = d.destFile
|
template outfile: untyped = d.destFile
|
||||||
#let outfile = getOutFile2(d.conf, shortenDir(d.conf, filename), outExt, "htmldocs")
|
#let outfile = getOutFile2(d.conf, shortenDir(d.conf, filename), outExt, "htmldocs")
|
||||||
createDir(outfile.splitFile.dir)
|
createDir(outfile.splitFile.dir)
|
||||||
|
d.conf.outFile = outfile.extractFilename.RelativeFile
|
||||||
if not writeRope(content, outfile):
|
if not writeRope(content, outfile):
|
||||||
rawMessage(d.conf, if useWarning: warnCannotOpenFile else: errCannotOpenFile,
|
rawMessage(d.conf, if useWarning: warnCannotOpenFile else: errCannotOpenFile,
|
||||||
outfile.string)
|
outfile.string)
|
||||||
d.conf.outFile = outfile.extractFilename.RelativeFile
|
elif not d.wroteCss:
|
||||||
|
let cssSource = $d.conf.getPrefixDir() / "doc" / "nimdoc.css"
|
||||||
|
let cssDest = $d.conf.outDir / "nimdoc.out.css"
|
||||||
|
# renamed to make it easier to use with gitignore in user's repos
|
||||||
|
copyFile(cssSource, cssDest)
|
||||||
|
d.wroteCss = true
|
||||||
|
|
||||||
proc writeOutputJson*(d: PDoc, useWarning = false) =
|
proc writeOutputJson*(d: PDoc, useWarning = false) =
|
||||||
runAllExamples(d)
|
runAllExamples(d)
|
||||||
|
|
|
||||||
|
|
@ -139,4 +139,4 @@ licenses: "bin/nim,MIT;lib/*,MIT;"
|
||||||
|
|
||||||
[nimble]
|
[nimble]
|
||||||
pkgName: "compiler"
|
pkgName: "compiler"
|
||||||
pkgFiles: "compiler/*;doc/basicopt.txt;doc/advopt.txt"
|
pkgFiles: "compiler/*;doc/basicopt.txt;doc/advopt.txt;doc/nimdoc.css"
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,7 @@ proc mainCommand*(graph: ModuleGraph) =
|
||||||
|
|
||||||
var dumpdata = %[
|
var dumpdata = %[
|
||||||
(key: "version", val: %VersionAsString),
|
(key: "version", val: %VersionAsString),
|
||||||
|
(key: "prefixdir", val: %conf.getPrefixDir().string),
|
||||||
(key: "project_path", val: %conf.projectFull.string),
|
(key: "project_path", val: %conf.projectFull.string),
|
||||||
(key: "defined_symbols", val: definedSymbols),
|
(key: "defined_symbols", val: definedSymbols),
|
||||||
(key: "lib_paths", val: %libpaths),
|
(key: "lib_paths", val: %libpaths),
|
||||||
|
|
|
||||||
|
|
@ -509,6 +509,9 @@ proc getPrefixDir*(conf: ConfigRef): AbsoluteDir =
|
||||||
##
|
##
|
||||||
## This is overridden by some tools (namely nimsuggest) via the ``conf.prefixDir``
|
## This is overridden by some tools (namely nimsuggest) via the ``conf.prefixDir``
|
||||||
## field.
|
## field.
|
||||||
|
## This should resolve to root of nim sources, whether running nim from a local
|
||||||
|
## clone or using installed nim, so that these exist: `result/doc/advopt.txt`
|
||||||
|
## and `result/lib/system.nim`
|
||||||
if not conf.prefixDir.isEmpty: result = conf.prefixDir
|
if not conf.prefixDir.isEmpty: result = conf.prefixDir
|
||||||
else: result = AbsoluteDir splitPath(getAppDir()).head
|
else: result = AbsoluteDir splitPath(getAppDir()).head
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ doc.file = """<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<title>$title</title>
|
<title>$title</title>
|
||||||
<link rel="stylesheet" type="text/css" href="nimdoc.css">
|
<link rel="stylesheet" type="text/css" href="/nimdoc.out.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="dochack.js"></script>
|
<script type="text/javascript" src="dochack.js"></script>
|
||||||
|
|
||||||
|
|
|
||||||
4
koch.nim
4
koch.nim
|
|
@ -24,7 +24,7 @@ when defined(i386) and defined(windows) and defined(vcc):
|
||||||
{.link: "icons/koch-i386-windows-vcc.res".}
|
{.link: "icons/koch-i386-windows-vcc.res".}
|
||||||
|
|
||||||
import
|
import
|
||||||
os, strutils, parseopt, osproc, streams
|
os, strutils, parseopt, osproc
|
||||||
|
|
||||||
import tools / kochdocs
|
import tools / kochdocs
|
||||||
|
|
||||||
|
|
@ -45,6 +45,7 @@ Options:
|
||||||
--help, -h shows this help and quits
|
--help, -h shows this help and quits
|
||||||
--latest bundle the installers with a bleeding edge Nimble
|
--latest bundle the installers with a bleeding edge Nimble
|
||||||
--stable bundle the installers with a stable Nimble (default)
|
--stable bundle the installers with a stable Nimble (default)
|
||||||
|
--nim:path use specified path for nim binary
|
||||||
Possible Commands:
|
Possible Commands:
|
||||||
boot [options] bootstraps with given command line options
|
boot [options] bootstraps with given command line options
|
||||||
distrohelper [bindir] helper for distro packagers
|
distrohelper [bindir] helper for distro packagers
|
||||||
|
|
@ -605,6 +606,7 @@ when isMainModule:
|
||||||
case normalize(op.key)
|
case normalize(op.key)
|
||||||
of "latest": latest = true
|
of "latest": latest = true
|
||||||
of "stable": latest = false
|
of "stable": latest = false
|
||||||
|
of "nim": nimExe = op.val.absolutePath # absolute so still works with changeDir
|
||||||
else: showHelp()
|
else: showHelp()
|
||||||
of cmdArgument:
|
of cmdArgument:
|
||||||
case normalize(op.key)
|
case normalize(op.key)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<title>foo</title>
|
<title>foo</title>
|
||||||
<link rel="stylesheet" type="text/css" href="nimdoc.css">
|
<link rel="stylesheet" type="text/css" href="/nimdoc.out.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="dochack.js"></script>
|
<script type="text/javascript" src="dochack.js"></script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<title>Index</title>
|
<title>Index</title>
|
||||||
<link rel="stylesheet" type="text/css" href="nimdoc.css">
|
<link rel="stylesheet" type="text/css" href="/nimdoc.out.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="dochack.js"></script>
|
<script type="text/javascript" src="dochack.js"></script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<title>utils</title>
|
<title>utils</title>
|
||||||
<link rel="stylesheet" type="text/css" href="nimdoc.css">
|
<link rel="stylesheet" type="text/css" href="/nimdoc.out.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="dochack.js"></script>
|
<script type="text/javascript" src="dochack.js"></script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<title>testproject</title>
|
<title>testproject</title>
|
||||||
<link rel="stylesheet" type="text/css" href="nimdoc.css">
|
<link rel="stylesheet" type="text/css" href="/nimdoc.out.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="dochack.js"></script>
|
<script type="text/javascript" src="dochack.js"></script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<title>Index</title>
|
<title>Index</title>
|
||||||
<link rel="stylesheet" type="text/css" href="nimdoc.css">
|
<link rel="stylesheet" type="text/css" href="/nimdoc.out.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="dochack.js"></script>
|
<script type="text/javascript" src="dochack.js"></script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,15 @@ const
|
||||||
webUploadOutput = "web/upload"
|
webUploadOutput = "web/upload"
|
||||||
docHackDir = "tools/dochack"
|
docHackDir = "tools/dochack"
|
||||||
|
|
||||||
|
var nimExe*: string
|
||||||
|
|
||||||
proc exe*(f: string): string =
|
proc exe*(f: string): string =
|
||||||
result = addFileExt(f, ExeExt)
|
result = addFileExt(f, ExeExt)
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
result = result.replace('/','\\')
|
result = result.replace('/','\\')
|
||||||
|
|
||||||
proc findNim*(): string =
|
proc findNim*(): string =
|
||||||
|
if nimExe.len > 0: return nimExe
|
||||||
var nim = "nim".exe
|
var nim = "nim".exe
|
||||||
result = "bin" / nim
|
result = "bin" / nim
|
||||||
if existsFile(result): return
|
if existsFile(result): return
|
||||||
|
|
@ -366,14 +369,11 @@ proc buildJS() =
|
||||||
proc buildDocs*(args: string) =
|
proc buildDocs*(args: string) =
|
||||||
const
|
const
|
||||||
docHackJs = "dochack.js"
|
docHackJs = "dochack.js"
|
||||||
css = "nimdoc.css"
|
|
||||||
let
|
let
|
||||||
a = nimArgs & " " & args
|
a = nimArgs & " " & args
|
||||||
docHackJsSource = docHackDir / docHackJs
|
docHackJsSource = docHackDir / docHackJs
|
||||||
docHackJsDest = docHtmlOutput / docHackJs
|
docHackJsDest = docHtmlOutput / docHackJs
|
||||||
|
|
||||||
cssSource = "doc" / css
|
|
||||||
cssDest = docHtmlOutput / css
|
|
||||||
buildJS() # This call generates docHackJsSource
|
buildJS() # This call generates docHackJsSource
|
||||||
let docup = webUploadOutput / NimVersion
|
let docup = webUploadOutput / NimVersion
|
||||||
createDir(docup)
|
createDir(docup)
|
||||||
|
|
@ -387,6 +387,3 @@ proc buildDocs*(args: string) =
|
||||||
buildDoc(nimArgs, docHtmlOutput)
|
buildDoc(nimArgs, docHtmlOutput)
|
||||||
copyFile(docHackJsSource, docHackJsDest)
|
copyFile(docHackJsSource, docHackJsDest)
|
||||||
copyFile(docHackJsSource, docup / docHackJs)
|
copyFile(docHackJsSource, docup / docHackJs)
|
||||||
|
|
||||||
copyFile(cssSource, cssDest)
|
|
||||||
copyFile(cssSource, docup / css)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue