diff --git a/nodes.py b/nodes.py index 14b8a0e..7c28a92 100644 --- a/nodes.py +++ b/nodes.py @@ -116,12 +116,10 @@ def to_asciidoc(self, **kwargs): # Combine any adjacent text nodes since we modified the tree self.node.smooth() - asciidoc_output = self.block_separator(**kwargs).join( + return self.block_separator(**kwargs).join( asciidoc for asciidoc in self.asciidoc_contents(**kwargs) if asciidoc ) - return asciidoc_output - return "".join(self.asciidoc_contents(**kwargs)) def soup(self): @@ -721,7 +719,7 @@ def block_separator(self, **_kwargs): class ParameternamelistNode(Node): def to_asciidoc(self, **kwargs): - return f"`{escape_text(self.text('parametername')).rstrip()}`::" + return f"`{escape_text(self.text('parametername'))}`::" class ParameterdescriptionNode(Node): @@ -880,7 +878,7 @@ def to_asciidoc(self, **kwargs): output = [ title(self.text("name"), 5 + kwargs.get("depth", 0), self.attributes()) ] - output.append(f"[.memname]`{escape_text(self.text('definition')).rstrip()}`") + output.append(f"[.memname]`{escape_text(self.text('definition'))}`") kwargs["depth"] = 5 + kwargs.get("depth", 0) kwargs["documentation"] = True briefdescription = self.child("briefdescription").to_asciidoc(**kwargs) @@ -901,7 +899,7 @@ def to_asciidoc(self, **kwargs): ) ] if name: - output.append(f"[.memname]`enum {escape_text(name).rstrip()}`") + output.append(f"[.memname]`enum {escape_text(name)}`") else: output.append("[.memname]`anonymous enum`") kwargs["depth"] = 5 + kwargs.get("depth", 0) @@ -955,7 +953,7 @@ def to_asciidoc(self, **kwargs): ) ) else: - output.append(f"[.memname]`{escape_text(definition).rstrip()}`") + output.append(f"[.memname]`{escape_text(definition)}`") kwargs["depth"] = 5 + kwargs.get("depth", 0) kwargs["documentation"] = True briefdescription = self.child("briefdescription").to_asciidoc(**kwargs) @@ -998,7 +996,7 @@ def to_asciidoc(self, **kwargs): ) else: output.append( - f"[.memname]`#define {escape_text(name)}{escape_text(argsstring).rstrip()}`" + f"[.memname]`#define {escape_text(name)}{escape_text(argsstring)}`" ) kwargs["depth"] = 5 + kwargs.get("depth", 0) kwargs["documentation"] = True @@ -1038,7 +1036,7 @@ def to_asciidoc(self, **kwargs): function.append( f" <<{memberdef.id},{escape_text(memberdef.text('name'))}>> " ) - function.append(f"{escape_text(memberdef.text('argsstring')).rstrip()}`:: ") + function.append(f"{escape_text(memberdef.text('argsstring'))}`:: ") briefdescription = memberdef.child("briefdescription").to_asciidoc(**kwargs) if briefdescription: function.append(briefdescription) diff --git a/tests/test_doxygenindex_node.py b/tests/test_doxygenindex_node.py index d823a84..19fa04a 100644 --- a/tests/test_doxygenindex_node.py +++ b/tests/test_doxygenindex_node.py @@ -6,7 +6,7 @@ def test_to_asciidoc(tmp_path): with open(f"{tmp_path}/group__hardware.xml", "w", encoding="utf-8") as hardware: hardware.write( - """ + """\ @@ -78,8 +78,6 @@ def test_to_asciidoc(tmp_path): BeautifulSoup(xml, "xml").doxygenindex, xmldir=tmp_path ).to_asciidoc() - print(asciidoc) - assert asciidoc == dedent( """\ [#group_hardware,reftext="Hardware APIs"]