From 091d3f39435da9de77d0492686acd7bba6f79357 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Thu, 10 Feb 2022 09:17:18 +0100 Subject: merge CONTRIBUTING.md into README.md --- CONTRIBUTING.md | 18 ------------------ README.md | 19 +++++++++++++++++++ pydoc.py | 14 +++++++++----- templates/index.html | 4 ++-- 4 files changed, 30 insertions(+), 25 deletions(-) delete mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 3e25908..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,18 +0,0 @@ -## How to contribute - -* You can give feedback and suggest packages to be included, - either by [email] or in the [#pydoc] IRC channel on [Libera.Chat]. - -* You can contribute to [pydoctor]. - -* You can contribute to the individual Python projects - to improve their [docstrings]. - -* If you want to support pydoc.dev by providing hosting, - [please get in touch][email]. - -[email]: mailto:martin@push-f.com -[#pydoc]: https://web.libera.chat/?channel=#pydoc -[Libera.Chat]: https://libera.chat/ -[pydoctor]: https://github.com/twisted/pydoctor -[docstrings]: https://www.python.org/dev/peps/pep-0257/ diff --git a/README.md b/README.md index 6f185bf..5c282c2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,26 @@ often is not structured after the Python modules. It works by downloading the source files from the [Python Package Index], the API documentation is then generated with [pydoctor]. + + +## How to contribute + +* You can give feedback and suggest packages to be included, + either by [email] or in the [#pydoc] IRC channel on [Libera.Chat]. + +* You can contribute to [pydoctor]. + +* You can contribute to the individual Python projects + to improve their [docstrings]. + +* If you want to support pydoc.dev by providing hosting, + [please get in touch][email]. + [Sphinx]: https://www.sphinx-doc.org/ [docs.rs]: https://docs.rs/ [Python Package Index]: https://pypi.org/ [pydoctor]: https://github.com/twisted/pydoctor +[email]: mailto:martin@push-f.com +[#pydoc]: https://web.libera.chat/?channel=#pydoc +[Libera.Chat]: https://libera.chat/ +[docstrings]: https://www.python.org/dev/peps/pep-0257/ diff --git a/pydoc.py b/pydoc.py index d57a062..619a1ac 100755 --- a/pydoc.py +++ b/pydoc.py @@ -3,6 +3,7 @@ import configparser import io import json import shutil +import sys import tarfile import tempfile import zipfile @@ -313,15 +314,18 @@ if __name__ == '__main__': readme_html = mistletoe.markdown( pkg_resources.resource_string(__name__, 'README.md').decode() ) - contributing_html = mistletoe.markdown( - pkg_resources.resource_string(__name__, 'CONTRIBUTING.md').decode() - ) + + sep = '' + try: + before, after = readme_html.split(sep) + except ValueError: + sys.exit(f'[fatal error] expected {sep} in README.md') with open(dist / 'index.html', 'w') as f: f.write( env.get_template('index.html').render( - readme=readme_html, - contributing=contributing_html, + before=before, packages=package_infos.items(), + after=after, ) ) diff --git a/templates/index.html b/templates/index.html index d368271..d62ddf6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,7 +9,7 @@ - {{ readme | safe }} + {{ before | safe }}

pydoc.dev is currently in early alpha and only hosts documentation for {{ packages | length }} packages:

@@ -20,6 +20,6 @@ {% endfor %} - {{ contributing | safe }} + {{ after | safe }} -- cgit v1.2.3