Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ondratu/docutils-tinyhtmlwriter
HTML Writer for Docutils with tiny output.
https://github.com/ondratu/docutils-tinyhtmlwriter
Last synced: about 1 month ago
JSON representation
HTML Writer for Docutils with tiny output.
- Host: GitHub
- URL: https://github.com/ondratu/docutils-tinyhtmlwriter
- Owner: ondratu
- License: other
- Created: 2015-10-07T21:13:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-17T21:12:52.000Z (almost 4 years ago)
- Last Synced: 2024-11-18T19:09:03.019Z (2 months ago)
- Language: Python
- Size: 35.2 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: ChangeLog
- License: COPYING
Awesome Lists containing this project
README
Docutils Tiny HTML Writer
-------------------------
Docutils Tiny HTML Writer is another docutils html writer, with very light html
output. It was create mainly for use in other project's like doc generators or
web publishers, which wants to use their own html headers and footers.One of possible use:
.. code-block:: python
:name: examplefrom docutils.core import publish_string, publish_parts
from docutils_tinyhtml import Writer
from sys import version_infoif version_info[0] < 3:
from io import openwriter = Writer()
with open("README.rst", encoding="utf-8") as f:
rst = f.read()# store full html output to html variable
html = publish_string(source=rst,
writer=writer,
writer_name='html',
settings_overrides={'link': 'link', 'top': 'top'})# disable system message in html, no in stderr
parts = publish_parts(source=rst,
writer=writer,
writer_name='html',
settings_overrides={'no_system_messages': True})# store only html body
body = parts['html_title'] + parts['body'] + parts['html_line'] + \
parts['html_footnotes'] + parts['html_citations'] + \
parts['html_hyperlinks']Or you can use rst2html-tiny command tool like standard rst2html:
.. code-block:: sh
~$ rst2html-tiny README.rst > README.html # generate html from reStructured text
~$ rst2html-tiny -h # help outputIf you have installed `m2r `_ package, you can
use ``m2dhtml-tiny`` tool fro MarkDouwn source codes.Installation
------------
.. code-block:: sh~$ pip install docutils-tinyhtmlwriter