Skip to content

Commit

Permalink
PPF-415: still needs test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
chinapandaman committed Dec 8, 2023
1 parent deb3fc1 commit 7e83ff9
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions PyPDFForm/core/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,18 @@ def get_paragraph_lines(element_middleware: Text) -> List[str]:
value = element_middleware.value or ""
if element_middleware.max_length is not None:
value = value[: element_middleware.max_length]
characters = value.split(" ")
current_line = ""
for each in characters:
line_extended = f"{current_line} {each}" if current_line else each
if len(line_extended) <= text_wrap_length:
current_line = line_extended
else:
lines.append(current_line)
current_line = each
lines.append(current_line)

for line in value.split("\n"):
characters = line.split(" ")
current_line = ""
for each in characters:
line_extended = f"{current_line} {each}" if current_line else each
if len(line_extended) <= text_wrap_length:
current_line = line_extended
else:
lines.append(current_line)
current_line = each
lines.append(current_line)

for each in lines:
while len(each) > text_wrap_length:
Expand Down

0 comments on commit 7e83ff9

Please sign in to comment.