Docutils Writer producing Tiny HTML
Project description
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:
from docutils.core import publish_string, publish_parts
from docutils_tinyhtml import Writer
from sys import version_info
if version_info[0] < 3:
from io import open
writer = 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:
~$ rst2html-tiny README.rst > README.html # generate html from reStructured text
~$ rst2html-tiny -h # help output
If you have installed m2r package, you can use m2dhtml-tiny tool fro MarkDouwn source codes.
Installation
~$ pip install docutils-tinyhtmlwriter
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file docutils-tinyhtmlwriter-1.3.0.tar.gz
.
File metadata
- Download URL: docutils-tinyhtmlwriter-1.3.0.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b42883a9f2570953ef88e0fcf65bb7bbdd2bc776c013c2adef86018940e2081a |
|
MD5 | cb5e93dc186bfb00008732b73cf7630d |
|
BLAKE2b-256 | ff6d2f1d630a77d3a0c1915a8ed875d7b77f8503d7c9567f7e9f31fae90466db |
File details
Details for the file docutils_tinyhtmlwriter-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: docutils_tinyhtmlwriter-1.3.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a66fc4c35f545717db4d02a0ce6cf9ef4bc6cd3ff45c68f7e89c383577d0cede |
|
MD5 | e6f9c77eff4589843d9a1fc799e5e6d2 |
|
BLAKE2b-256 | b0e99cde6aa6ee80e98bf5533c112ee31107096a3b1b713a0cf49e31e003ca22 |