-
-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
Currently this will not work:
doc = document()
doc.add(comment('A comment is here'))
doc.add(comment("""
---------------------------------------------------------------------------------------------------------------------
A multi line
comment block is here
---------------------------------------------------------------------------------------------------------------------
"""))
It creates:
# A comment is here
#
---------------------------------------------------------------------------------------------------------------------
A multi line
comment block is here
---------------------------------------------------------------------------------------------------------------------
Would like it to make:
# A comment is here
# ---------------------------------------------------------------------------------------------------------------------
# A multi line
# comment block is here
# ---------------------------------------------------------------------------------------------------------------------
In api.py if def comment() is changed to:
def comment(string: str) -> Comment:
"""Create a comment item."""
lines = string.splitlines()
if len(lines) > 1:
return Comment(Trivia(comment_ws=" ", comment='\n# '.join(lines)[1:]))
else:
return Comment(Trivia(comment_ws=" ", comment="# " + string))
It will the create comments as shown above.
Possibly include that in master?
Thanks,
Curits
Metadata
Metadata
Assignees
Labels
No labels