GraphicsMagick: Replaced rst2htmldeco.py with rst2html5.py as we...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.10915.1664650803.1826.graphicsmagick-commit@lists.sourceforge.net>
changeset dfd44d12d98e in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=dfd44d12d98e
summary: Replaced rst2htmldeco.py with rst2html5.py as well as fix non-utf8 characters in some files.

diffstat:

 ChangeLog                           |    11 +-
 ChangeLog.2006                      |     2 +-
 ChangeLog.2008                      |     2 +-
 ChangeLog.2012                      |     2 +-
 Makefile.in                         |    13 +-
 scripts/docutils_htmldeco_writer.py |    71 -
 scripts/html_fragments.py           |    14 +
 scripts/rst2html5.py                |   378 ++
 scripts/rst2htmldeco.py             |   233 -
 www/ChangeLog-2001.html             |   444 ---
 www/ChangeLog-2002.html             |  1757 ------------
 www/ChangeLog-2003.html             |  4768 ---------------------------------
 www/ChangeLog-2004.html             |  1612 -----------
 www/ChangeLog-2005.html             |  1068 -------
 www/ChangeLog-2006.html             |   283 -
 www/ChangeLog-2007.html             |  1083 -------
 www/ChangeLog-2008.html             |  2333 ----------------
 www/ChangeLog-2009.html             |  1927 -------------
 www/ChangeLog-2010.html             |   781 -----
 www/ChangeLog-2011.html             |   735 -----
 www/ChangeLog-2012.html             |  1062 -------
 www/ChangeLog-2013.html             |   645 ----
 www/ChangeLog-2014.html             |  1035 -------
 www/ChangeLog-2015.html             |  2047 --------------
 www/ChangeLog-2016.html             |  1065 -------
 www/ChangeLog-2017.html             |  1287 ---------
 www/ChangeLog-2018.html             |  3070 ---------------------
 www/ChangeLog-2019.html             |  1510 ----------
 www/ChangeLog-2020.html             |  1367 ---------
 www/ChangeLog-2021.html             |   744 -----
 www/Changelog.html                  |   243 +-
 www/Changes.html                    |    76 -
 www/Copyright.html                  |   268 -
 www/FAQ.html                        |   365 +-
 www/Hg.html                         |   157 +-
 www/INSTALL-unix.html               |   947 +++---
 www/INSTALL-windows.html            |   498 +-
 www/ImageMagickObject.html          |    48 +-
 www/Magick++/Blob.html              |    27 +-
 www/Magick++/ChangeLog.html         |  1312 ++++----
 www/Magick++/CoderInfo.html         |    33 +-
 www/Magick++/Color.html             |   153 +-
 www/Magick++/Drawable.html          |   571 +--
 www/Magick++/Enumerations.html      |  1359 ++++----
 www/Magick++/Exception.html         |   215 +-
 www/Magick++/FormatCharacters.html  |    91 +-
 www/Magick++/Geometry.html          |   355 +-
 www/Magick++/Image.html             |  1941 +++++--------
 www/Magick++/ImageDesign.html       |    21 +-
 www/Magick++/Montage.html           |    33 +-
 www/Magick++/PixelPacket.html       |   129 +-
 www/Magick++/Pixels.html            |    33 +-
 www/Magick++/TypeMetric.html        |    31 +-
 www/Magick++/index.html             |   103 +-
 www/Makefile.am                     |    13 +-
 www/NEWS.html                       |  4967 +++++++++++++++++-----------------
 www/OpenMP.html                     |    35 +-
 www/README.html                     |   109 +-
 www/api/api.html                    |   143 +-
 www/api/types.html                  |  3721 ++++++++++++-------------
 www/authors.html                    |   189 +-
 www/benchmarks.html                 |    39 +-
 www/bugs.html                       |    41 +-
 www/contribute.html                 |    93 +-
 www/docutils-articles.css           |    39 +-
 www/download.html                   |    56 +-
 www/formats.html                    |  1834 ++++++------
 www/index.html                      |   118 +-
 www/links.html                      |    53 +-
 www/miff.html                       |   358 +-
 www/mission.html                    |    45 +-
 www/motion-picture.html             |   630 ++--
 www/perl.html                       |  2207 +++++++--------
 www/process.html                    |    21 +-
 www/programming.html                |   106 +-
 www/project.html                    |    21 +-
 www/quantize.html                   |   101 +-
 www/reference.html                  |    21 +-
 www/security.html                   |    62 +-
 www/thanks.html                     |   118 +-
 www/thanks.rst                      |     2 +-
 www/tools.html                      |    78 +-
 www/utilities.html                  |    90 +-
 www/wand/wand.html                  |    37 +-
 84 files changed, 12071 insertions(+), 43634 deletions(-)

diffs (truncated from 69085 to 500 lines):

diff -r 61655f932785 -r dfd44d12d98e ChangeLog
--- a/ChangeLog	Sat Oct 01 09:39:55 2022 -0500
+++ b/ChangeLog	Sat Oct 01 13:59:41 2022 -0500
@@ -1,6 +1,15 @@
 2022-10-01  Bob Friesenhahn  <[email protected]>
 
-	* PerlMagick/t/read.t: Added input_mono.tga to PerlMagick test suite.
+	* scripts/rst2html5.py: Applied patch by Mark Mitchell which
+	replaces rst2htmldeco.py with rst2html5.py. rst2html5.py does
+	essentially the same job as rst2htmldeco.py, but in a different
+	way.  docutils_htmldeco_writer.py is no longer used or needed.
+
+	Also fixed thanks.rst file which had non-utf8 characters, as well
+	as ChangeLog.2006, ChangeLog.2008 and ChangeLog.2012.
+
+	* PerlMagick/t/read.t: Added input_mono.tga to PerlMagick test
+	suite.
 
 	* coders/tga.c: White-space normalization.  Eliminate compilation
 	warning about unused indexes variable.
diff -r 61655f932785 -r dfd44d12d98e ChangeLog.2006
--- a/ChangeLog.2006	Sat Oct 01 09:39:55 2022 -0500
+++ b/ChangeLog.2006	Sat Oct 01 13:59:41 2022 -0500
@@ -173,7 +173,7 @@
         log.mgk has been loaded.
 
 	* magick/attribute.c (GenerateEXIFAttribute): Fix memory leak on
-	error which was reported by Micha³ Kowalczuk.
+	error which was reported by Michal Kowalczuk.
 
 2006-01-03  Bob Friesenhahn  <[email protected]>
 
diff -r 61655f932785 -r dfd44d12d98e ChangeLog.2008
--- a/ChangeLog.2008	Sat Oct 01 09:39:55 2022 -0500
+++ b/ChangeLog.2008	Sat Oct 01 13:59:41 2022 -0500
@@ -1906,7 +1906,7 @@
 
 	* magick/utility.c (TranslateTextEx): Check if the pixel cache is
 	initialized before using a function which requires using it.
-	Thanks to Micha³ Kowalczuk for bringing this issue to my
+	Thanks to Michal Kowalczuk for bringing this issue to my
 	attention.
 
 	* magick/attribute.c (SetImageAttribute): Only apply
diff -r 61655f932785 -r dfd44d12d98e ChangeLog.2012
--- a/ChangeLog.2012	Sat Oct 01 09:39:55 2022 -0500
+++ b/ChangeLog.2012	Sat Oct 01 13:59:41 2022 -0500
@@ -590,7 +590,7 @@
 	* PerlMagick/t/jpeg/read.t: Add a test for reading Seattle
 	FilmWorks format based on the sample image from
 	http://www.algonet.se/~cyren/sfw/.  Image was approved for
-	distribution in GraphicsMagick by Bengt Cyrén.
+	distribution in GraphicsMagick by Bengt Cyrén.
 
 	* magick/analyze.c (GetImageBoundingBox): Only apply opacity-based
 	bounding box detection if all three test points are non-opaque and
diff -r 61655f932785 -r dfd44d12d98e Makefile.in
--- a/Makefile.in	Sat Oct 01 09:39:55 2022 -0500
+++ b/Makefile.in	Sat Oct 01 13:59:41 2022 -0500
@@ -4624,10 +4624,9 @@
 WWWW_EXTRA_DIST = $(WWW_HTML_FILES) $(WWW_RST_FILES)
 WWW_MAINTAINER_TARGETS = $(WWW_HTML_FILES) $(WWWDIR)/color.html
 @MAINTAINER_MODE_TRUE@NAMED_COLORS = $(top_srcdir)/scripts/named_colors.py
-@MAINTAINER_MODE_TRUE@RST2HTMLDECO = $(top_srcdir)/scripts/rst2htmldeco.py
+@MAINTAINER_MODE_TRUE@RST2HTML5 = $(top_srcdir)/scripts/rst2html5.py
 @MAINTAINER_MODE_TRUE@RELPATH = $(top_srcdir)/scripts/relpath.py
 @MAINTAINER_MODE_TRUE@OMP_DECIMAL_ALIGN = $(top_srcdir)/scripts/omp_decimal_align.py
-@MAINTAINER_MODE_TRUE@RST2HTML_COMMAND = $(RST2HTMLDECO) --cloak-email-addresses --link-stylesheet=docutils-articles.css
 
 #
 # Build HTML version of ChangeLogs
@@ -11077,18 +11076,18 @@
 
 @MAINTAINER_MODE_TRUE@$(RST2HTML_TARGETS) : \
 @MAINTAINER_MODE_TRUE@	$(top_srcdir)/scripts/html_fragments.py \
-@MAINTAINER_MODE_TRUE@	$(top_srcdir)/scripts/rst2htmldeco.py \
+@MAINTAINER_MODE_TRUE@	$(top_srcdir)/scripts/rst2html5.py \
 @MAINTAINER_MODE_TRUE@	$(top_srcdir)/scripts/omp_decimal_align.py \
 @MAINTAINER_MODE_TRUE@	$(WWWDIR)/Makefile.am
 
 # Build HTML version of RST file
 @MAINTAINER_MODE_TRUE@$(top_srcdir)/www/%.html: $(top_srcdir)/%.txt
-@MAINTAINER_MODE_TRUE@	$(RST2HTMLDECO) --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
-@MAINTAINER_MODE_TRUE@	--url-prefix=`$(RELPATH) $(top_srcdir)/www $@` $< | grep -v '\"generator\"' > $@
+@MAINTAINER_MODE_TRUE@	$(RST2HTML5) --stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
+@MAINTAINER_MODE_TRUE@	--url-prefix=`$(RELPATH) $(top_srcdir)/www $@` $<  > $@
 
 @MAINTAINER_MODE_TRUE@$(top_srcdir)/%.html: $(top_srcdir)/%.rst
-@MAINTAINER_MODE_TRUE@	$(RST2HTMLDECO)  --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
-@MAINTAINER_MODE_TRUE@	--url-prefix=`$(RELPATH) $(top_srcdir)/www $@` $< | grep -v '\"generator\"' | $(OMP_DECIMAL_ALIGN) > $@
+@MAINTAINER_MODE_TRUE@	$(RST2HTML5)  --stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
+@MAINTAINER_MODE_TRUE@	--url-prefix=`$(RELPATH) $(top_srcdir)/www $@` $<  | $(OMP_DECIMAL_ALIGN) > $@
 
 @MAINTAINER_MODE_TRUE@$(top_srcdir)/www/Changelog.rst: $(top_srcdir)/ChangeLog
 @MAINTAINER_MODE_TRUE@	$(CHANGELOG2RST) < $^ > $@
diff -r 61655f932785 -r dfd44d12d98e scripts/docutils_htmldeco_writer.py
--- a/scripts/docutils_htmldeco_writer.py	Sat Oct 01 09:39:55 2022 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# vim:ts=4:sw=4:expandtab:tw=100:
-
-#* Author: Mark Mitchell
-#* Copyright 2005-2008  Mark Mitchell, All Rights Reserved
-#* License: see __license__ below.
-
-__doc__ = """
-A specialized subclass of the docutils html4css1 writer.
-
-It includes some additional HTML in the HTMLTranslator body_prefix and body_suffix
-so as to put a standard banner and navigation menus on the page.
-"""
-
-__copyright__ = "2005, 2008, Mark Mitchell"
-
-__license__ = """
-Copyright 2005, 2008, Mark Mitchell
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this oftware and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-The Software is provided "as is", without warranty of any kind,
-express or implied, including but not limited to the warranties of
-merchantability, fitness for a particular purpose and noninfringement.
-In no event shall the authors or copyright holders be liable for any
-claim, damages or other liability, whether in an action of contract,
-tort or otherwise, arising from, out of or in connection with Software
-or the use or other dealings in the Software.
-"""
-
-
-import sys
-
-from docutils.writers import html4css1
-from docutils import nodes
-# the html fragments for banner, navigation menu, and footer
-import html_fragments
-
-
-class Writer(html4css1.Writer):
-    '''My derived Writer class'''
-
-    super_init = html4css1.Writer.__init__
-    def __init__(self):
-        self.super_init()
-        self.translator_class = MmHtmlTranslator
-
-
-class MmHtmlTranslator(html4css1.HTMLTranslator):
-    """My HTML translator which alters body_prefix to include
-    some extra HTML after the body opening tag, and alters body_suffix
-    to include a bit more before the body closing tag."""
-
-    def __init__(self, document):
-        html4css1.HTMLTranslator.__init__(self, document)
-
-        self.body_prefix.append(html_fragments.banner)
-        self.body_prefix.append(html_fragments.nav)
-        self.body_suffix = [html_fragments.footer, '</body>\n</html>\n']
-        #self.body_suffix = ['</body>\n</html>\n']
-
diff -r 61655f932785 -r dfd44d12d98e scripts/html_fragments.py
--- a/scripts/html_fragments.py	Sat Oct 01 09:39:55 2022 -0500
+++ b/scripts/html_fragments.py	Sat Oct 01 13:59:41 2022 -0500
@@ -18,6 +18,17 @@
 
 banner_logo = 'images/gm-107x76.png' # relative to top directory
 
+html_head_template = """<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta content="en" name="language">
+	<title>{title}</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+	<link media="screen" href="{url_screen_css}" type="text/css" rel="stylesheet">
+{metas}
+</head>
+"""
 
 # banner_template and nav_template contain chunk which has to be created at
 # runtime: the path to the image directory, and the path to the top directory.
@@ -67,6 +78,9 @@
 </div>
 """
 
+def make_html_head(url_screen_css, title, metas):
+    return html_head_template.format(url_screen_css=url_screen_css, title=title, metas=metas)
+
 def make_footer():
     return footer_template % { 'url_prefix' : url_prefix,
                                'sponsor_logo_html' : sponsor_logo_html,
diff -r 61655f932785 -r dfd44d12d98e scripts/rst2html5.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/rst2html5.py	Sat Oct 01 13:59:41 2022 -0500
@@ -0,0 +1,378 @@
+#! /usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+#* Author: Mark Mitchell
+#* Copyright 2008-2022  Mark Mitchell, All Rights Reserved
+#* License: see __license__ below.
+
+"""Renders reStructuredText files to HTML with some custom HTML parts included,
+such as a common header and navigation menu at the top of all HTML pages.
+The header and navigation HTML blobs are kept in a separate python file,
+html_fragments.py.
+
+Usage:
+    rst2html5.py [options] [<RSTDOC> [<DESTINATION>]]
+
+Options:
+    -h, --help      display the usage help message
+    -s --stylesheet=<FILE>
+                            The path to the stylesheet.
+    -e --embed-stylesheet
+                            If specified, the stylesheet will be embedded in the HTML.
+                            If unspecified, the HTML will link to the stylesheet.
+
+    -u --url-prefix=<PATH>
+                            The value of url-prefix is prefixed to all the URLs in the
+                            path to get to the top directory from the OUTFILE
+                            directory.  Used to create working relative URLs in the custom
+                            header and navigation menu.  Defaults to empty.
+                            Example: --url-prefix=../../
+
+Reads from <RSTDOC> (default is stdin) and writes to <DESTINATION> (default is stdout)
+
+If no input <RSTDOC> is specified, input will be read from stdin and output will be
+written to stdout.
+
+Note that images referenced from the stylesheet (such as background images)
+may require different image-dir paths depending on whether the stylesheet is
+embedded or linked.  If linked, image URLs in the stylesheet are relative to the
+stylesheet's location.  If embedded, image URLs in the stylesheet are relative
+to the HTML file's path.
+"""
+
+__copyright__ = "2008 - 2022, Mark Mitchell"
+
+__license__ = """
+Copyright 2008 - 2022, Mark Mitchell
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+The Software is provided "as is", without warranty of any kind,
+express or implied, including but not limited to the warranties of
+merchantability, fitness for a particular purpose and noninfringement.
+In no event shall the authors or copyright holders be liable for any
+claim, damages or other liability, whether in an action of contract,
+tort or otherwise, arising from, out of or in connection with Software
+or the use or other dealings in the Software.
+"""
+
+import sys
+import os
+
+from docutils import core
+import html_fragments
+
+top_dir = os.path.abspath(os.path.dirname(__file__))
+
+CSS = 'docutils-articles.css'
+ENCODING = 'utf-8'
+
+class Usage (Exception):
+    pass
+
+def loginfo(s):
+    print(s, file=sys.stdout)
+
+def logerror(s):
+    print(s, file=sys.stderr)
+
+
+def assemble_html(doc_parts, stylesheet_screen=None):
+    """Constructs a complete HTML document by assembling various
+    parts created by docutils.core.publish_parts and the
+    templates in html_fragments.py
+    """
+
+    if stylesheet_screen is None:
+        stylesheet_screen = CSS
+
+    def get_metas():
+        metas = doc_parts['meta'].split('\n')
+        metas = [m.strip() for m in metas if 'name="keywords"' in m or 'name="description"' in m]
+        metas = [m.replace('/>', '>') for m in metas]
+        return '\n'.join(metas)
+
+    html_head = html_fragments.make_html_head(stylesheet_screen, doc_parts['title'], get_metas())
+
+    html = '\n'.join([
+        html_head,
+        '<body>',
+        html_fragments.banner,
+        html_fragments.nav,
+        doc_parts['html_body'],
+        html_fragments.footer,
+        doc_parts['body_suffix'],
+    ])
+
+    return html
+
+
+def make_html_parts(input_string, source_path=None, destination_path=None,
+                    stylesheet=CSS, embed_stylesheet=False,
+                    doctitle=1, initial_header_level=1):
+    """
+    Given an input string which is a reStructuredText document, returns a
+    dictionary of HTML document parts created by docutils.core.publish_parts()
+
+    Dictionary keys are the names of parts, and values are Unicode strings;
+    encoding is up to the client.
+
+    Parameters:
+
+    - `input_string`: A multi-line text string; required.
+    - `source_path`: Path to the source file or object.  Optional, but useful
+      for diagnostic output (system messages).
+    - `destination_path`: Path to the file or object which will receive the
+      output; optional.  Used for determining relative paths (stylesheets,
+      source links, etc.).
+    - `doctitle`: Disable the promotion of a lone top-level section title to
+      document title (and subsequent section title to document subtitle
+      promotion); enabled by default.
+    - `initial_header_level`: The initial level for header elements (e.g. 1
+      for "<h1>").
+
+
+    Parts Provided By the HTML Writer
+    ---------------------------------
+    body
+        parts['body'] is equivalent to parts['fragment']. It is not equivalent to parts['html_body'].
+
+    body_prefix
+        parts['body_prefix'] contains:
+
+        </head>
+        <body>
+        <div class="document" ...>
+
+        and, if applicable:
+
+        <div class="header">
+        ...
+        </div>
+
+    body_pre_docinfo
+        parts['body_pre_docinfo] contains (as applicable):
+
+        <h1 class="title">...</h1>
+        <h2 class="subtitle" id="...">...</h2>
+
+    body_suffix
+        parts['body_suffix'] contains:
+
+        </div>
+
+        (the end-tag for <div class="document">), the footer division if applicable:
+
+        <div class="footer">
+        ...
+        </div>
+
+        and:
+
+        </body>
+        </html>
+
+    docinfo
+        parts['docinfo'] contains the document bibliographic data, the docinfo
+        field list rendered as a table.
+
+    footer
+        parts['footer'] contains the document footer content, meant to appear
+        at the bottom of a web page, or repeated at the bottom of every printed
+        page.
+
+    fragment
+        parts['fragment'] contains the document body (not the HTML <body>). In
+        other words, it contains the entire document, less the document title,
+        subtitle, docinfo, header, and footer.
+
+    head
+        parts['head'] contains <meta ... /> tags and the document <title>...</title>.
+
+    head_prefix
+        parts['head_prefix'] contains the XML declaration, the DOCTYPE
+        declaration, the <html ...> start tag and the <head> start tag.
+
+    header
+        parts['header'] contains the document header content, meant to appear at
+        the top of a web page, or repeated at the top of every printed page.
+
+    html_body
+        parts['html_body'] contains the HTML <body> content, less the <body> and </body> tags themselves.
+
+    html_head
+        parts['html_head'] contains the HTML <head> content, less the stylesheet
+        link and the <head> and </head> tags themselves. Since publish_parts
+        returns Unicode strings and does not know about the output encoding, the
+        "Content-Type" meta tag's "charset" value is left unresolved, as "%s":
+
+        <meta http-equiv="Content-Type" content="text/html; charset=%s" />
+
+        The interpolation should be done by client code.
+
+    html_prolog
+
+        parts['html_prolog] contains the XML declaration and the doctype
+        declaration. The XML declaration's "encoding" attribute's value is left
+        unresolved, as "%s":
+
+        <?xml version="1.0" encoding="%s" ?>
+
+        The interpolation should be done by client code.
+
+    html_subtitle
+        parts['html_subtitle'] contains the document subtitle, including the
+        enclosing <h2 class="subtitle"> & </h2> tags.
+
+    html_title
+        parts['html_title'] contains the document title, including the enclosing
+        <h1 class="title"> & </h1> tags.
+
+    meta
+        parts['meta'] contains all <meta ... /> tags.
+
+    stylesheet
+        parts['stylesheet'] contains the embedded stylesheet or stylesheet link.
+
+    subtitle
+        parts['subtitle'] contains the document subtitle text and any inline
+        markup. It does not include the enclosing <h2> & </h2> tags.
+
+    title
+        parts['title'] contains the document title text and any inline
+        markup. It does not include the enclosing <h1> & </h1> tags.
+    """
+
+    # settings for publish_parts
+    # input_encoding: The encoding of `input_string`.  If it is an encoded
+    # 8-bit string, provide the correct encoding.  If it is a Unicode string,
+    # use "unicode", the default.
+
+    overrides = {'input_encoding': 'unicode',
+                 'doctitle_xform': doctitle,
+                 'initial_header_level': initial_header_level,
+                 'stylesheet_path' : stylesheet,
+                 'embed_stylesheet' : embed_stylesheet,
+                 'cloak_email_addresses' : True,
+                }
+    parts = core.publish_parts(source=input_string, source_path=source_path,
+                           destination_path=destination_path,
+                           writer_name='html5_polyglot', settings_overrides=overrides)
+    return parts
+
+
+def make_html(src_fo, dest_fo, embed_stylesheet=False, stylesheet=CSS, url_prefix=''):
+    """Make an HTML file from a reStructuredText source file."""
+    # Fix the url_prefix path in the banner HTML.
+    # This Python tricky business is necessary because the custom docutils
+    # writer, which inserts the HTML blobs, can't do it, because docutils
+    # doesn't provide any way to pass an argument such as image_dir to the
+    # writer.
+    # There must be a better way, but I haven't figured it out yet.
+    if url_prefix:
+        html_fragments.url_prefix = url_prefix.rstrip('/') + '/'
+
+    html_fragments.nav = html_fragments.make_nav()
+    html_fragments.banner = html_fragments.make_banner()
+    html_fragments.footer = html_fragments.make_footer()
+
+    rst_string = src_fo.read()
+    doc_parts = make_html_parts(rst_string, stylesheet=stylesheet, embed_stylesheet=embed_stylesheet)
+    webpage = assemble_html(doc_parts, stylesheet_screen=stylesheet)
+    try:
+        dest_fo.write(webpage)
+    except Exception as e:
+        logerror("Failed to create output file: %s" % e)
+        return 1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.