diff options
author | Ronny Berndt <ronny@apache.org> | 2023-01-07 20:46:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-07 20:46:43 +0100 |
commit | ca791828cd147590f83f31c4c4af6716ffafba90 (patch) | |
tree | 9cdb26af68b584fe59a476029d6f3182f4694c35 | |
parent | 3125bfd3c0cc571f928424e230299926f7e103d4 (diff) | |
download | couchdb-ca791828cd147590f83f31c4c4af6716ffafba90.tar.gz |
Escape special (html) chars in section names (#4350)
To correctly generate the configuration reference html output,
escape special html characters like '<' and '>' in section names.
-rw-r--r-- | src/docs/ext/configdomain.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/docs/ext/configdomain.py b/src/docs/ext/configdomain.py index 66ed53288..983ac44b0 100644 --- a/src/docs/ext/configdomain.py +++ b/src/docs/ext/configdomain.py @@ -15,6 +15,7 @@ from sphinx.roles import XRefRole from sphinx.domains import Domain, ObjType, Index from sphinx.directives import ObjectDescription from sphinx.util.nodes import make_refnode +import html class ConfigObject(ObjectDescription): @@ -62,7 +63,7 @@ class ConfigIndex(Index): def generate(self, docnames=None): content = dict( - (name, [(name, 1, info[0], name, "", "", info[1])]) + (html.escape(name), [(name, 1, info[0], name, "", "", info[1])]) for name, info in self.domain.data["section"].items() ) @@ -70,7 +71,7 @@ class ConfigIndex(Index): for idx, info in sorted(options.items()): path, descr = info section, name = idx.split("/", 1) - content[section].append( + content[html.escape(section)].append( (name, 2, path, "%s/%s" % (section, name), "", "", descr) ) |