parent
5ef0494677
commit
1b54be7779
13 changed files with 28 additions and 16 deletions
|
|
@ -17,7 +17,7 @@ import
|
|||
packages/docutils/rst, packages/docutils/rstgen,
|
||||
json, xmltree, cgi, trees, types,
|
||||
typesrenderer, astalgo, lineinfos, intsets,
|
||||
pathutils, trees
|
||||
pathutils, trees, nimconf
|
||||
|
||||
const
|
||||
exportSection = skField
|
||||
|
|
@ -43,6 +43,7 @@ type
|
|||
destFile*: AbsoluteFile
|
||||
thisDir*: AbsoluteDir
|
||||
examples: string
|
||||
wroteCss*: bool
|
||||
|
||||
PDoc* = ref TDocumentor ## Alias to type less.
|
||||
|
||||
|
|
@ -1069,10 +1070,16 @@ proc writeOutput*(d: PDoc, useWarning = false) =
|
|||
template outfile: untyped = d.destFile
|
||||
#let outfile = getOutFile2(d.conf, shortenDir(d.conf, filename), outExt, "htmldocs")
|
||||
createDir(outfile.splitFile.dir)
|
||||
d.conf.outFile = outfile.extractFilename.RelativeFile
|
||||
if not writeRope(content, outfile):
|
||||
rawMessage(d.conf, if useWarning: warnCannotOpenFile else: errCannotOpenFile,
|
||||
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) =
|
||||
runAllExamples(d)
|
||||
|
|
|
|||
|
|
@ -139,4 +139,4 @@ licenses: "bin/nim,MIT;lib/*,MIT;"
|
|||
|
||||
[nimble]
|
||||
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 = %[
|
||||
(key: "version", val: %VersionAsString),
|
||||
(key: "prefixdir", val: %conf.getPrefixDir().string),
|
||||
(key: "project_path", val: %conf.projectFull.string),
|
||||
(key: "defined_symbols", val: definedSymbols),
|
||||
(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``
|
||||
## 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
|
||||
else: result = AbsoluteDir splitPath(getAppDir()).head
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue