Skip to content

Commit

Permalink
Fix warning directive rendering (#369)
Browse files Browse the repository at this point in the history
I _think_ this is what we want. It does fix the rendering for the
warning directive but I'm not sure why this wasn't showing up in other
directives...

Closes #367
  • Loading branch information
Carreau authored Jan 11, 2024
2 parents 34d9203 + 89f9171 commit c551c5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion papyri/tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def test_parse_warning_directive():
.. warning:: Title
The warning directive does not admit a title.
Just testing now.
"""
)
Expand All @@ -108,7 +109,10 @@ def test_parse_warning_directive():
assert items[0].name == "warning"
assert items[0].args == ""
assert items[0].options == dict()
assert items[0].value == "Title The warning directive does not admit a title."
assert (
items[0].value
== "Title The warning directive does not admit a title.\nJust testing now."
)
assert items[0].children == []


Expand Down
2 changes: 1 addition & 1 deletion papyri/ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def visit_directive(self, node):
raise ValueError(f"{role} directive has no content")

padding = (content_node[0].start_point[1] - _1.start_point[1]) * " "
content = dedent(padding + content)
content = dedent(padding + content).lstrip(" ")
argument = ""
options = []
groups = []
Expand Down

0 comments on commit c551c5f

Please sign in to comment.