Convert unwrapped paragraphs to hard wrapped paragraphs whenthere's no blank lines.

Linux for blind general discussion blinux-list at redhat.com
Fri Mar 27 21:43:01 UTC 2020


> I don't understand how paragraphs start and end in these files. Otherwise
> you
> can try using one of the text processing tools mentioned here:
>
> * https://www.shlomifish.org/open-source/resources/text-processing-tools/
>
> * https://www.computerhope.com/unix/ufold.htm
>
> * https://en.wikipedia.org/wiki/Fmt_(Unix)
>
> * https://en.wikipedia.org/wiki/Par_(command)
>
> Note that you may have better luck converting EPUBs (assuming they lack
> https://en.wikipedia.org/wiki/Digital_rights_management ) to plaintext using
> tools such as https://pandoc.org/ ,
> https://metacpan.org/search?q=html%3A%3Awikiconverter&size=20 , etc.

Of that list of programs, I'd be inclined to use Pandoc. It permits
you to write filters in (embedded) Lua, which is a quick-to-learn
programming language. For example, this Lua one-liner converts a
string ("s") to add a line break after each existing line break:

s = string.gsub(s, "<BR>", "<BR>\n<BR>")

On writing Pandoc filters with Lua, see <https://pandoc.org/lua-filters.html>.

Best regards,

Paul

-- 
[Notice not included in the above original message:  The U.S. National
Security Agency neither confirms nor denies that it intercepted this
message.]
                                                ¯\_(ツ)_/¯





More information about the Blinux-list mailing list