Fix docs for subdirs too (#13180)
* Fix doc subdirs * Extract to helper proc, and fix on windows
This commit is contained in:
parent
f51613e262
commit
451c47634c
3 changed files with 17 additions and 13 deletions
|
|
@ -1009,6 +1009,9 @@ proc genSection(d: PDoc, kind: TSymKind) =
|
||||||
"sectionid", "sectionTitle", "sectionTitleID", "content"], [
|
"sectionid", "sectionTitle", "sectionTitleID", "content"], [
|
||||||
ord(kind).rope, title, rope(ord(kind) + 50), d.toc[kind]])
|
ord(kind).rope, title, rope(ord(kind) + 50), d.toc[kind]])
|
||||||
|
|
||||||
|
proc cssHref(outDir: AbsoluteDir, destFile: AbsoluteFile): Rope =
|
||||||
|
rope($relativeTo(outDir / RelativeFile"nimdoc.out.css", destFile.splitFile().dir, '/'))
|
||||||
|
|
||||||
proc genOutFile(d: PDoc): Rope =
|
proc genOutFile(d: PDoc): Rope =
|
||||||
var
|
var
|
||||||
code, content: Rope
|
code, content: Rope
|
||||||
|
|
@ -1042,12 +1045,11 @@ proc genOutFile(d: PDoc): Rope =
|
||||||
rope(getClockStr()), code, d.modDeprecationMsg])
|
rope(getClockStr()), code, d.modDeprecationMsg])
|
||||||
if optCompileOnly notin d.conf.globalOptions:
|
if optCompileOnly notin d.conf.globalOptions:
|
||||||
# XXX what is this hack doing here? 'optCompileOnly' means raw output!?
|
# XXX what is this hack doing here? 'optCompileOnly' means raw output!?
|
||||||
code = ropeFormatNamedVars(d.conf, getConfigVar(d.conf, "doc.file"), ["title",
|
code = ropeFormatNamedVars(d.conf, getConfigVar(d.conf, "doc.file"), [
|
||||||
"tableofcontents", "moduledesc", "date", "time",
|
"nimdoccss", "title", "tableofcontents", "moduledesc", "date", "time",
|
||||||
"content", "author", "version", "analytics", "deprecationMsg"],
|
"content", "author", "version", "analytics", "deprecationMsg"],
|
||||||
[title.rope, toc, d.modDesc, rope(getDateStr()),
|
[cssHref(d.conf.outDir, d.destFile), title.rope, toc, d.modDesc, rope(getDateStr()), rope(getClockStr()),
|
||||||
rope(getClockStr()), content, d.meta[metaAuthor].rope,
|
content, d.meta[metaAuthor].rope, d.meta[metaVersion].rope, d.analytics.rope, d.modDeprecationMsg])
|
||||||
d.meta[metaVersion].rope, d.analytics.rope, d.modDeprecationMsg])
|
|
||||||
else:
|
else:
|
||||||
code = content
|
code = content
|
||||||
result = code
|
result = code
|
||||||
|
|
@ -1183,15 +1185,17 @@ proc commandTags*(cache: IdentCache, conf: ConfigRef) =
|
||||||
proc commandBuildIndex*(cache: IdentCache, conf: ConfigRef) =
|
proc commandBuildIndex*(cache: IdentCache, conf: ConfigRef) =
|
||||||
var content = mergeIndexes(conf.projectFull.string).rope
|
var content = mergeIndexes(conf.projectFull.string).rope
|
||||||
|
|
||||||
let code = ropeFormatNamedVars(conf, getConfigVar(conf, "doc.file"), ["title",
|
|
||||||
"tableofcontents", "moduledesc", "date", "time",
|
|
||||||
"content", "author", "version", "analytics"],
|
|
||||||
["Index".rope, nil, nil, rope(getDateStr()),
|
|
||||||
rope(getClockStr()), content, nil, nil, nil])
|
|
||||||
# no analytics because context is not available
|
|
||||||
var outFile = RelativeFile"theindex"
|
var outFile = RelativeFile"theindex"
|
||||||
if conf.outFile != RelativeFile"":
|
if conf.outFile != RelativeFile"":
|
||||||
outFile = conf.outFile
|
outFile = conf.outFile
|
||||||
let filename = getOutFile(conf, outFile, HtmlExt)
|
let filename = getOutFile(conf, outFile, HtmlExt)
|
||||||
|
|
||||||
|
let code = ropeFormatNamedVars(conf, getConfigVar(conf, "doc.file"), [
|
||||||
|
"nimdoccss", "title", "tableofcontents", "moduledesc", "date", "time",
|
||||||
|
"content", "author", "version", "analytics"],
|
||||||
|
[cssHref(conf.outDir, filename), rope"Index", nil, nil, rope(getDateStr()),
|
||||||
|
rope(getClockStr()), content, nil, nil, nil])
|
||||||
|
# no analytics because context is not available
|
||||||
|
|
||||||
if not writeRope(code, filename):
|
if not writeRope(code, filename):
|
||||||
rawMessage(conf, errCannotOpenFile, filename.string)
|
rawMessage(conf, errCannotOpenFile, filename.string)
|
||||||
|
|
|
||||||
|
|
@ -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.out.css">
|
<link rel="stylesheet" type="text/css" href="$nimdoccss">
|
||||||
|
|
||||||
<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.out.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>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue