From 6b99b7ef4f0b3935daa705d43d42fdd7eaf72db4 Mon Sep 17 00:00:00 2001 From: medmunds Date: Sun, 19 Aug 2018 16:17:07 -0700 Subject: [PATCH] Docs: update readme test rendering to new PyPI layout, styles --- docs/_readme/docutils.cfg | 5 ++- docs/_readme/readme.css | 74 --------------------------------------- docs/_readme/template.txt | 51 +++++++++++++++++++++++++++ tox.ini | 2 +- 4 files changed, 54 insertions(+), 78 deletions(-) delete mode 100644 docs/_readme/readme.css create mode 100644 docs/_readme/template.txt diff --git a/docs/_readme/docutils.cfg b/docs/_readme/docutils.cfg index 00d52a2..a5ab359 100644 --- a/docs/_readme/docutils.cfg +++ b/docs/_readme/docutils.cfg @@ -9,7 +9,6 @@ [general] # Duplicate docutils config used by PyPA readme_renderer. # https://github.com/pypa/readme_renderer/blob/master/readme_renderer/rst.py -# (This isn't exactly what's used on legacy PyPI, but it's close enough.) cloak_email_addresses = True doctitle_xform = True sectsubtitle_xform = True @@ -27,5 +26,5 @@ halt_level = 2 # (We're not running inside readme_renderer, so *do* want to see warnings and errors.) # report_level = 5 -# Approximate PyPI's styles: -stylesheet = docs/_readme/readme.css +# Approximate PyPI's layout and styles: +template = docs/_readme/template.txt diff --git a/docs/_readme/readme.css b/docs/_readme/readme.css deleted file mode 100644 index 75c0df5..0000000 --- a/docs/_readme/readme.css +++ /dev/null @@ -1,74 +0,0 @@ -/* - readme.css - Approximates PyPI package description rendering as of 3/2018, - using docutils rst2html output. - */ - -/* Borrow base docutils and pygments styles directly from PyPI: */ -@import url("https://pypi.python.org/static/css/docutils.css"); -@import url("https://pypi.python.org/static/css/pygments.css"); /* requires rst2html 'short' classnames */ - -/* Subset of PyPI site styles applicable to package description: */ -HTML, BODY { - font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; - font-size: 103%; - color: #000; - background-color: #FFF; -} -H1, H2, H3, H4, H5 { - font-family: Georgia, "Bitstream Vera Serif", "New York", Palatino, serif; - font-weight: normal; - line-height: 1em; -} -H1 { - font-size: 160%; - color: #234764; - margin: 0.7em 0; - text-decoration: none; -} -H2 { - font-size: 140%; - color: #366D9C; - margin: 0.7em 0 0.7em 0; -} -IMG { - border: 0; -} -A:link { - color: #00A; -} -A:visited { - color: #551A8B; -} -P A:link, P A:visited, -UL A:link, UL A:visited, -OL A:link, OL A:visited { - text-decoration: none; - border-bottom: 1px dashed #ccc; -} - -/* Additional styles, to account for not having all of PyPI's wrapper and navigation divs: */ -body { - line-height: 1.5; - font-size: 14.6px; /* ~computed font-size in PyPI's div#content */ -} -h1.title { - text-align: left; -} -ul, li { - margin-left: 1em; - padding-left: 0; -} -pre { - padding: 10px; - font-size: 11.9px; /* ~computed font-size in PyPI's div#content pre */ -} - -/* Give the page a little breathing room: */ -.document { - max-width: 960px; - margin: 0 auto; -} -body { - padding: 1em; -} diff --git a/docs/_readme/template.txt b/docs/_readme/template.txt new file mode 100644 index 0000000..50f679e --- /dev/null +++ b/docs/_readme/template.txt @@ -0,0 +1,51 @@ +%(head_prefix)s + + + +%(head)s + + + + + + + + + + +%(body_prefix)s + +
+ + + +
+
+
+
+
+

Project description

+ +
+ %(body)s +
+
+
+
+
+
+ +
+%(body_suffix)s diff --git a/tox.ini b/tox.ini index d6f957a..9f8a01e 100644 --- a/tox.ini +++ b/tox.ini @@ -77,7 +77,7 @@ commands = sphinx-build -W -b dirhtml docs {env:DOCS_BUILD_DIR} # Build README.rst into html: /bin/bash -c 'python setup.py --long-description \ - | rst2html.py --config=docs/_readme/docutils.cfg \ + | rst2html5.py --config=docs/_readme/docutils.cfg \ > {env:DOCS_BUILD_DIR}/readme.html' [travis]