There's a new tool in brltty's Tools/ directory named rst2text. The primary 
motivation was to be able to convert brltty's README.* documents, which are in 
rst (reStructured text), to plain text with helpful markup. I'm letting all of 
you know about it in case you've been similary frustrated with being able to 
convert documents to plain text and/or would just like to give it a try. As 
always, feedback would be welcome so that this tool can be improved.

While its name is rst2text, that's a bit misleading. It's default is to assume 
that the document is in reStructured text, if you specify its -x option then it 
looks at the extension of the input file to determine the actual format. The 
following input file extensions are supported:

   csv, db, docbook, docx, epub, htm, html, json, man, md, odt, rst, rtf, tex, 
tsv

This tool essentially runs rst2html followed by pandoc - the rst2html step is 
skipped if the input format isn't rst. It also uses a pandoc Lua filter to add 
markup to the plain text output. The following markup is currently added:

   [# document header #]
   # level 1 header #
   ## level 2 header ##
   ### level 3 header ###
   [internal reference text]
   [external reference text] {URL}
   <-- Table - caption text -->
   **bold text**
   <italic text>
   __underlined text__
   `literal text`
   "quoted text"
   ~~strike text~~
   ^(superscript text)
   _(subscript text)

   <```
   literal block
   ```>

   <"""
   block quote
   """>

As usual, rst2text has a -h option for full details.

-- 
I believe the Bible to be the very Word of God: http://Mielke.cc/bible/
Dave Mielke            | 2213 Fox Crescent | WebHome: http://Mielke.cc/
EMail: [email protected]  | Ottawa, Ontario   | Twitter: @Dave_Mielke
Phone: +1 613 726 0014 | Canada  K2A 1H7   |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://mielke.cc/xmother.html (Letter from a Feminist ex-Mother)
_______________________________________________
This message was sent via the BRLTTY mailing list.
To post a message, send an e-mail to: [email protected]
For general information, go to: http://brltty.app/mailman/listinfo/brltty

Reply via email to