Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Convert break elements to \n in raw text #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Convert break elements to \n in raw text #87

wants to merge 1 commit into from

Conversation

delenamalan
Copy link

Convert line breaks to \n when converting to raw text.

Since documents.Paragraph is converted text + "\n\n", I'm thinking it might make sense to convert breaks to \n?

@@ -8,5 +8,7 @@ def extract_raw_text_from_element(element):
text = "".join(map(extract_raw_text_from_element, getattr(element, "children", [])))
if isinstance(element, documents.Paragraph):
return text + "\n\n"
if isinstance(element, documents.Break):
return text + "\n"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's possible for breaks to contain text? If not, I guess we can just return \n.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant