File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,20 @@ def main(config):
3737 max_line_width = 12
3838 lines_per_page = 4
3939
40- lines_to_display = [content [i :i + max_line_width ] for i in range (0 , len (content ), max_line_width )]
40+ words = content .split ()
41+ lines_to_display = []
42+ current_line = ""
43+
44+ for word in words :
45+ if len (current_line ) + len (word ) + 1 > max_line_width and current_line :
46+ lines_to_display .append (current_line )
47+ current_line = word
48+ else :
49+ current_line = current_line + (" " + word if current_line else word )
50+
51+ if current_line :
52+ lines_to_display .append (current_line )
53+
4154 pages_to_display = [lines_to_display [i :i + lines_per_page ] for i in range (0 , len (lines_to_display ), lines_per_page )]
4255
4356 frames = []
You can’t perform that action at this time.
0 commit comments