Skip to content

Commit

Permalink
Escape special (html) chars in section names (#4350) (#4359)
Browse files Browse the repository at this point in the history
To correctly generate the configuration reference html output,
escape special html characters like '<' and '>' in section names.
  • Loading branch information
big-r81 committed Jan 8, 2023
1 parent 1fd50b8 commit b738c27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/docs/ext/configdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from sphinx.domains import Domain, ObjType, Index
from sphinx.directives import ObjectDescription
from sphinx.util.nodes import make_refnode
import html


class ConfigObject(ObjectDescription):
Expand Down Expand Up @@ -62,15 +63,15 @@ 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()
)

options = self.domain.data["option"]
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)
)

Expand Down

0 comments on commit b738c27

Please sign in to comment.