Index of /sandbox/html4trans

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory   -  
[TXT]html4trans.py 2018-06-17 08:52 8.5K 
[DIR]tools/ 2018-06-17 08:52 -  
[DIR]docs/ 2018-06-17 08:53 -  
[DIR]data/ 2018-06-17 08:52 -  

HTML writer for lightweight browsers

HTML writer for lightweight browsers

Author:

Guenter Milde <milde@users.sf.net>

Date:
2021-05-08

Motivation

The HTML Writer module, docutils.writers.html4css1 produces XHTML compatible with the XHTML 1.0 specification. Correct rendering of the HTML produced depends on the CSS support of the browser. Browsers without full CSS support (lightweight browsers, older browsers, text-only browsers, help viewers) produce inferior results.

CSS is the state-of-the art technology for styling of html output and provides many advantages. However, correct rendering of HTML+CSS requires considerable resources in form of program code, memory space and computation time.

On older machines or in embedded devices this might pose a serious problem. Another example is a HTML help viewer of a program. It should start up fast ("immediately") and not take too much resources.

Editing and generating documentation with reStructuredText is possible with modest requirements on computer power. Viewing the result should be as well.

Solution

A separate HTML-transitional writer producing non-CSS based HTML.

The html4trans writer module subclasses the html4css1.HTMLTranslator and modifies it to remove the dependency on CSS browser support.

The output conforms to the XHTML version 1.0 Transitional DTD and contains enough formatting information to be viewed without a cascading style sheet by a lightweight html browser (e.g. Dillo or the console browser elinks).

Drawbacks

Doing without CSS styling comes at a cost.

Files

Installation

Place rst2html_trans.py in the binary PATH and html4trans.py in the PYTHONPATH or in the working directory (from where you start rst2html_trans.py).

Usage

Similar to the standard rst2html front end:

rst2html_trans.py [options] [<source> [<destination>]]

The full usage text can be obtained with the --help option.