docgen: escape special characters in titles (#18014)
This commit is contained in:
parent
4857c462d5
commit
1568ae23c6
1 changed files with 3 additions and 2 deletions
|
|
@ -1217,10 +1217,11 @@ proc genOutFile(d: PDoc, groupedToc = false): string =
|
||||||
else:
|
else:
|
||||||
# Modules get an automatic title for the HTML, but no entry in the index.
|
# Modules get an automatic title for the HTML, but no entry in the index.
|
||||||
title = canonicalImport(d.conf, AbsoluteFile d.filename)
|
title = canonicalImport(d.conf, AbsoluteFile d.filename)
|
||||||
|
title = esc(d.target, title)
|
||||||
var subtitle = ""
|
var subtitle = ""
|
||||||
if d.meta[metaSubtitle] != "":
|
if d.meta[metaSubtitle] != "":
|
||||||
dispA(d.conf, subtitle, "<h2 class=\"subtitle\">$1</h2>",
|
dispA(d.conf, subtitle, "<h2 class=\"subtitle\">$1</h2>",
|
||||||
"\\\\\\vspace{0.5em}\\large $1", [d.meta[metaSubtitle]])
|
"\\\\\\vspace{0.5em}\\large $1", [esc(d.target, d.meta[metaSubtitle])])
|
||||||
|
|
||||||
var groupsection = getConfigVar(d.conf, "doc.body_toc_groupsection")
|
var groupsection = getConfigVar(d.conf, "doc.body_toc_groupsection")
|
||||||
let bodyname = if d.hasToc and not d.isPureRst and not d.conf.isLatexCmd:
|
let bodyname = if d.hasToc and not d.isPureRst and not d.conf.isLatexCmd:
|
||||||
|
|
@ -1247,7 +1248,7 @@ proc genOutFile(d: PDoc, groupedToc = false): string =
|
||||||
"title", title, "subtitle", subtitle, "tableofcontents", toc,
|
"title", title, "subtitle", subtitle, "tableofcontents", toc,
|
||||||
"moduledesc", d.modDesc, "date", getDateStr(), "time", getClockStr(),
|
"moduledesc", d.modDesc, "date", getDateStr(), "time", getClockStr(),
|
||||||
"content", content, "author", d.meta[metaAuthor],
|
"content", content, "author", d.meta[metaAuthor],
|
||||||
"version", d.meta[metaVersion], "analytics", d.analytics,
|
"version", esc(d.target, d.meta[metaVersion]), "analytics", d.analytics,
|
||||||
"deprecationMsg", d.modDeprecationMsg]
|
"deprecationMsg", d.modDeprecationMsg]
|
||||||
else:
|
else:
|
||||||
code = content
|
code = content
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue