Skip to content

Commit 7b7bb6e

Browse files
committed
fix: wrong indentation when paragraph id
1 parent eed2dcd commit 7b7bb6e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pyconverter/xml2py/ast_tree.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,8 +1004,6 @@ def revisionflag(self):
10041004
def to_rst(self, indent="", max_length=100, links=None, base_url=None, fcache=None):
10051005
"""Return a string to enable converting the element to an RST format."""
10061006
items = []
1007-
if self.id:
1008-
items.append(f"\n.. _{self.id}:\n\n")
10091007
if self.revisionflag and self.revisionflag == "deleted":
10101008
return ""
10111009
for item in self:
@@ -1057,6 +1055,9 @@ def to_rst(self, indent="", max_length=100, links=None, base_url=None, fcache=No
10571055
)
10581056

10591057
rst_item = " ".join(items) + "\n\n"
1058+
if self.id:
1059+
rst_item = f"\n.. _{self.id}:\n\n" + rst_item
1060+
10601061
for key, value in CLEANUP.items():
10611062
rst_item = rst_item.replace(key, value)
10621063

0 commit comments

Comments
 (0)