diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2019-11-04 21:14:43 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2019-11-04 21:14:43 +0000 |
| commit | fd6e9d9f8211ebaec4dd0f894706b9e16f5c4179 (patch) | |
| tree | 9e1bb74fe2b86318629a2695af1be715bb35bd3b /docutils/tools | |
| parent | 76bb23e89c001ae9a286d239d31161f39220d72e (diff) | |
| download | docutils-fd6e9d9f8211ebaec4dd0f894706b9e16f5c4179.tar.gz | |
buildhtml.py: New option "--html-writer".
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8410 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/tools')
| -rwxr-xr-x | docutils/tools/buildhtml.py | 20 | ||||
| -rwxr-xr-x | docutils/tools/rst2html5.py | 4 |
2 files changed, 18 insertions, 6 deletions
diff --git a/docutils/tools/buildhtml.py b/docutils/tools/buildhtml.py index e1d58432c..46eeba0b2 100755 --- a/docutils/tools/buildhtml.py +++ b/docutils/tools/buildhtml.py @@ -32,7 +32,7 @@ from docutils import core, frontend, utils from docutils.utils.error_reporting import ErrorOutput, ErrorString from docutils.parsers import rst from docutils.readers import standalone, pep -from docutils.writers import html4css1, pep_html +from docutils.writers import html4css1, html5_polyglot, pep_html usage = '%prog [options] [<directory> ...]' @@ -75,6 +75,12 @@ class SettingsSpec(docutils.SettingsSpec): {'metavar': '<patterns>', 'action': 'append', 'default': [], 'validator': frontend.validate_colon_separated_string_list}), + ('HTML version, one of "html", "html4", "html5". ' + 'Default: "html" (use Docutils\' default HTML writer).', + ['--html-writer'], + {'metavar': '<html_writer>', + 'choices': ['html', 'html4', 'html5'], + 'default': 'html'}), ('Work silently (no progress messages). Independent of "--quiet".', ['--silent'], {'action': 'store_true', 'validator': frontend.validate_boolean}), @@ -121,10 +127,14 @@ class Builder(object): self.publishers = { '': Struct(components=(pep.Reader, rst.Parser, pep_html.Writer, SettingsSpec)), - '.txt': Struct(components=(rst.Parser, standalone.Reader, + 'html4': Struct(components=(rst.Parser, standalone.Reader, html4css1.Writer, SettingsSpec), reader_name='standalone', - writer_name='html'), + writer_name='html4'), + 'html5': Struct(components=(rst.Parser, standalone.Reader, + html5_polyglot.Writer, SettingsSpec), + reader_name='standalone', + writer_name='html5'), 'PEPs': Struct(components=(rst.Parser, pep.Reader, pep_html.Writer, SettingsSpec), reader_name='pep', @@ -134,6 +144,8 @@ class Builder(object): all components used by individual publishers.""" self.setup_publishers() + # default html writer (may change to html5 some time): + self.publishers['html'] = self.publishers['html4'] def setup_publishers(self): """ @@ -223,7 +235,7 @@ class Builder(object): if name.startswith('pep-'): publisher = 'PEPs' else: - publisher = '.txt' + publisher = self.initial_settings.html_writer settings = self.get_settings(publisher, directory) errout = ErrorOutput(encoding=settings.error_encoding) pub_struct = self.publishers[publisher] diff --git a/docutils/tools/rst2html5.py b/docutils/tools/rst2html5.py index 763f55725..7bcb57924 100755 --- a/docutils/tools/rst2html5.py +++ b/docutils/tools/rst2html5.py @@ -14,7 +14,7 @@ # Date: $Date$ """ -A minimal front end to the Docutils Publisher, producing HTMLÂ 5 documents. +A minimal front end to the Docutils Publisher, producing HTML 5 documents. The output also conforms to XHTML 1.0 transitional (except for the doctype declaration). @@ -28,7 +28,7 @@ except locale.Error: from docutils.core import publish_cmdline, default_description -description = (u'Generates HTMLÂ 5 documents from standalone ' +description = (u'Generates HTML 5 documents from standalone ' u'reStructuredText sources ' + default_description) |
