Amateja updates
Contents (#27)
Incorporates extensive and excellent work from @amateja - Thanks very much Andrzej!
Features
-
Use tabulate to replace table handling code as suggested in #9.
BREAKING CHANGE: tabulate is now a dependency. -
Add list-table support
-
Store reStructuredText data into stream instead of list (faster, especially if piping into a file)
BREAKING CHANGE: TheRstCloth().data
property is no longer a list but a stream, by default going to sys.stdout
BREAKING CHANGE: Thewrite()
method was removed. Instead of:your_doc.write(output_filename)
You can either open the doc in an
open
context:with open(output_filename, "w", encoding="utf-8") as fp: d = RstCloth(fp) d.title('Example Use')
Or, for minimal changes to your code if you were already using
write
, create the doc as you would before, but stream into a memory buffer, then write to file at the end:import io d = RstCloth(stream=io.StringIO()) d.title('Example Use') with open(output_filename, "w", encoding="utf-8") as fp: fp.write(str(d))
-
List table width and widths options expansion
-
Admonitions added
-
Bibliographic fields added
-
Raw directives added
-
Contents directive added
-
Transition marker added
Enhancements
- Field structure and wrapping improved
BREAKING-CHANGE: Indentation and wrapping may change (although all documents should still render) - Table indentation improved
- Parameter type verification changed to type declaration
- Type annotations added and docstrings supplemented
- Quick start documentation updated and unified
Fixes
- Fixed incorrect formatting of long bullet list point
- Paragraph folding fixed
- Directive folding fixed
- Bullet list item wrapping fixed
- Footnote reference should end with _
Refactoring
- Replaced different header methods with generic template
- Drop unused wrap parameter
- Reusing existing code for hyperlink formatting
- Variables names refactoring
- Drop unused BaseTestCase class
- Drop unused Table class
- YAML table translator removed
Testing
- Basic tests of RstCloth.table method added