refactor htmldocs; gitignore it
This commit is contained in:
parent
76ede7c198
commit
5676912209
2 changed files with 8 additions and 4 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -91,3 +91,6 @@ megatest.nim
|
||||||
*.dSYM
|
*.dSYM
|
||||||
|
|
||||||
nimdoc.out.css
|
nimdoc.out.css
|
||||||
|
|
||||||
|
# for `nim c -r nimdoc/tester` etc; this can be in multiple places
|
||||||
|
htmldocs
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import
|
||||||
|
|
||||||
const
|
const
|
||||||
exportSection = skField
|
exportSection = skField
|
||||||
|
htmldocsDir = RelativeDir"htmldocs"
|
||||||
|
|
||||||
type
|
type
|
||||||
TSections = array[TSymKind, Rope]
|
TSections = array[TSymKind, Rope]
|
||||||
|
|
@ -175,7 +176,7 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
|
||||||
rawMessage(conf, errGenerated, "executing of external program failed: " & c2)
|
rawMessage(conf, errGenerated, "executing of external program failed: " & c2)
|
||||||
result.emitted = initIntSet()
|
result.emitted = initIntSet()
|
||||||
result.destFile = getOutFile2(conf, relativeTo(filename, conf.projectPath),
|
result.destFile = getOutFile2(conf, relativeTo(filename, conf.projectPath),
|
||||||
outExt, RelativeDir"htmldocs", false)
|
outExt, htmldocsDir, false)
|
||||||
result.thisDir = result.destFile.splitFile.dir
|
result.thisDir = result.destFile.splitFile.dir
|
||||||
|
|
||||||
template dispA(conf: ConfigRef; dest: var Rope, xml, tex: string, args: openArray[Rope]) =
|
template dispA(conf: ConfigRef; dest: var Rope, xml, tex: string, args: openArray[Rope]) =
|
||||||
|
|
@ -301,7 +302,7 @@ proc externalDep(d: PDoc; module: PSym): string =
|
||||||
if optWholeProject in d.conf.globalOptions:
|
if optWholeProject in d.conf.globalOptions:
|
||||||
let full = AbsoluteFile toFullPath(d.conf, FileIndex module.position)
|
let full = AbsoluteFile toFullPath(d.conf, FileIndex module.position)
|
||||||
let tmp = getOutFile2(d.conf, full.relativeTo(d.conf.projectPath), HtmlExt,
|
let tmp = getOutFile2(d.conf, full.relativeTo(d.conf.projectPath), HtmlExt,
|
||||||
RelativeDir"htmldocs", sfMainModule notin module.flags)
|
htmldocsDir, sfMainModule notin module.flags)
|
||||||
result = relativeTo(tmp, d.thisDir, '/').string
|
result = relativeTo(tmp, d.thisDir, '/').string
|
||||||
else:
|
else:
|
||||||
result = extractFilename toFullPath(d.conf, FileIndex module.position)
|
result = extractFilename toFullPath(d.conf, FileIndex module.position)
|
||||||
|
|
@ -1057,7 +1058,7 @@ proc genOutFile(d: PDoc): Rope =
|
||||||
proc generateIndex*(d: PDoc) =
|
proc generateIndex*(d: PDoc) =
|
||||||
if optGenIndex in d.conf.globalOptions:
|
if optGenIndex in d.conf.globalOptions:
|
||||||
let dir = if not d.conf.outDir.isEmpty: d.conf.outDir
|
let dir = if not d.conf.outDir.isEmpty: d.conf.outDir
|
||||||
else: d.conf.projectPath / RelativeDir"htmldocs"
|
else: d.conf.projectPath / htmldocsDir
|
||||||
createDir(dir)
|
createDir(dir)
|
||||||
let dest = dir / changeFileExt(relativeTo(AbsoluteFile d.filename,
|
let dest = dir / changeFileExt(relativeTo(AbsoluteFile d.filename,
|
||||||
d.conf.projectPath), IndexExt)
|
d.conf.projectPath), IndexExt)
|
||||||
|
|
@ -1070,7 +1071,7 @@ proc writeOutput*(d: PDoc, useWarning = false) =
|
||||||
writeRope(stdout, content)
|
writeRope(stdout, content)
|
||||||
else:
|
else:
|
||||||
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, htmldocsDir)
|
||||||
createDir(outfile.splitFile.dir)
|
createDir(outfile.splitFile.dir)
|
||||||
d.conf.outFile = outfile.extractFilename.RelativeFile
|
d.conf.outFile = outfile.extractFilename.RelativeFile
|
||||||
if not writeRope(content, outfile):
|
if not writeRope(content, outfile):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue