codegen: Do not add extra paragraph elements while parsing

When parsing a comment we're adding <para> elements ourselves, but the
DocBook generator already wraps any block of text that does not start
with a <para> element with one.
This commit is contained in:
Emmanuele Bassi
2022-01-20 15:15:49 +00:00
parent c6a9113da6
commit 5013d08315
2 changed files with 16 additions and 9 deletions

View File

@@ -345,9 +345,17 @@ class DocbookCodeGenerator:
def expand_paras(self, s, expandParamsAndConstants):
s = self.expand(s, expandParamsAndConstants).strip()
res = []
if not s.startswith("<para"):
s = "<para>%s</para>" % s
return s
res.append("<para>")
for line in s.split("\n"):
line = line.strip()
if not line:
line = "</para><para>"
res.append(line)
if not s.endswith("</para>"):
res.append("</para>")
return "\n".join(res)
def generate_expand_dicts(self):
self.expand_member_dict = {}