REFLOW(1p)
β¨ REFLOW(1p) β¨
okay bestie, gather round, because this is reflow β a Perl script that reflows text files using Knuth's paragraphing algorithm π and honestly? it's giving scholar energy.
πΈ NAME πΈ
reflow β a Perl script for reflowing text files using Knuth's paragraphing algorithm. no cap, that's the whole job. π
π SYNOPSIS π
reflow < input > output
reflow file1 file2 ... > output
like. that's it. that's the vibe. π¦
β¨ DESCRIPTION β¨
So here's the tea π: this thing uses Knuth's paragraphing algorithm β yes, the same one TeX uses, she's famous β to "reflow" text files by picking "good" places to break the line. not just any place. the good places. there's a difference and the algorithm cares deeply.
It takes an ascii text file (with paragraphs separated by blank lines) and reflows the paragraphs. π
Now, the iconic bit: if two or more lines in a row are "indented" then they are assumed to be a quoted poem and are passed through unchanged. leaving the poem alone. respecting the poem. we love to see it π«Ά (and the -skipindented flag causes ALL indented lines to be passed unchanged, if you're in that kind of mood)
The algorithm tries to keep the lines the same length but also tries to break at punctuation, and avoid breaking within a proper name or after certain "connectives" ("a", "the", etc.). she's picky! she's discerning! she ate π
π OPTIONS π
-skipindentedβ Cause ALL indented lines to be passed unchanged. Normally a single indented line is included in the paragraph, while two or more indented lines are considered to be a quotation or poem and are passed through unchanged. so this flag is like "bestie, do NOT touch the indents, any of them, periodt."-fastβ Sets the optimum line width to 65 characters. This is the default. it's the default for a reason, it's fast, it's chill, it's the main character. π-slowβ Tries line widths of 60, 65 and 70 characters and picks the best one. more effort, more polish β¨-veryslowβ Tries all line widths between 60 and 70 characters inclusive, and picks the best one. With the-slowand-veryslowoptions the line widths within a paragraph will vary less, but the line widths may vary from one paragraph to the next. so yeah β gorgeous results, but she takes her time and the widths be jumping between paragraphs. iykyk π-skiptopattern β Skip to the first line starting with the given pattern before starting to reflow. This is useful for skipping Project Gutenberg headers or contents tables. literally the "okay skip to the good part" flag π
SeeText::Reflow(3) for more options: all the keyword options defined inText::Refloware also available via thereflowscript. so if you want the full menu, that's where it lives π§
π AUTHOR π
Original reflow perl script written by Michael Larsen, larsen@edu.upenn.math.
Modified, enhanced and converted to a perl module with XSUB by Martin Ward, martin@gkc.org.uk. absolute legends, both of them π«Ά
π SEE ALSO π
Text::Reflow(3).perl(1).- See "TeX the Program" by Donald Knuth for a description of the algorithm used. (the source material! the blueprint! the origin story! π)
and that's the whole page bestie π this was perl v5.34.0, dated 2022-02-06, and yeah β it's REFLOW(1p), the one and only. slay, go reflow something pretty πΈπ
β¨
π¦ where this page comes from
- ubuntu jammy: libtext-reflow-perl 1.17-1build5 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms