refactor htmldocs; gitignore it

This commit is contained in:
Timothee Cour
2020-01-24 13:17:33 -07:00
committed by Dominik Picheta
parent 76ede7c198
commit 5676912209
2 changed files with 8 additions and 4 deletions

3
.gitignore vendored
View File

@@ -91,3 +91,6 @@ megatest.nim
*.dSYM
nimdoc.out.css
# for `nim c -r nimdoc/tester` etc; this can be in multiple places
htmldocs

View File

@@ -21,6 +21,7 @@ import
const
exportSection = skField
htmldocsDir = RelativeDir"htmldocs"
type
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)
result.emitted = initIntSet()
result.destFile = getOutFile2(conf, relativeTo(filename, conf.projectPath),
outExt, RelativeDir"htmldocs", false)
outExt, htmldocsDir, false)
result.thisDir = result.destFile.splitFile.dir
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:
let full = AbsoluteFile toFullPath(d.conf, FileIndex module.position)
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
else:
result = extractFilename toFullPath(d.conf, FileIndex module.position)
@@ -1057,7 +1058,7 @@ proc genOutFile(d: PDoc): Rope =
proc generateIndex*(d: PDoc) =
if optGenIndex in d.conf.globalOptions:
let dir = if not d.conf.outDir.isEmpty: d.conf.outDir
else: d.conf.projectPath / RelativeDir"htmldocs"
else: d.conf.projectPath / htmldocsDir
createDir(dir)
let dest = dir / changeFileExt(relativeTo(AbsoluteFile d.filename,
d.conf.projectPath), IndexExt)
@@ -1070,7 +1071,7 @@ proc writeOutput*(d: PDoc, useWarning = false) =
writeRope(stdout, content)
else:
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)
d.conf.outFile = outfile.extractFilename.RelativeFile
if not writeRope(content, outfile):