Skip to content

Commit cbb1bf6

Browse files
committed
✨ print authors under each guide, add a "hall of fame"
1 parent fbe6eac commit cbb1bf6

15 files changed

+229
-17
lines changed

.gitignore

+105-8
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,116 @@
22
.DS_Store
33
.Thumbs.db
44

5-
# virtualenv
6-
venv
7-
8-
# Installer logs
9-
pip-log.txt
10-
pip-delete-this-directory.txt
11-
12-
135
# ansible
146
*.retry
157

168
# Sphinx
179
build
10+
*.doctree
11+
*.doctrees
1812

1913
# CI
2014
.sshkey
15+
16+
### Python ###
17+
# Byte-compiled / optimized / DLL files
18+
__pycache__/
19+
*.py[cod]
20+
*$py.class
21+
22+
# C extensions
23+
*.so
24+
25+
# Distribution / packaging
26+
.Python
27+
build/
28+
develop-eggs/
29+
dist/
30+
downloads/
31+
eggs/
32+
.eggs/
33+
lib/
34+
lib64/
35+
parts/
36+
sdist/
37+
var/
38+
wheels/
39+
*.egg-info/
40+
.installed.cfg
41+
*.egg
42+
43+
# PyInstaller
44+
# Usually these files are written by a python script from a template
45+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
46+
*.manifest
47+
*.spec
48+
49+
# Installer logs
50+
pip-log.txt
51+
pip-delete-this-directory.txt
52+
53+
# Unit test / coverage reports
54+
htmlcov/
55+
.tox/
56+
.coverage
57+
.coverage.*
58+
.cache
59+
.pytest_cache/
60+
nosetests.xml
61+
coverage.xml
62+
*.cover
63+
.hypothesis/
64+
65+
# Translations
66+
*.mo
67+
*.pot
68+
69+
# Flask stuff:
70+
instance/
71+
.webassets-cache
72+
73+
# Scrapy stuff:
74+
.scrapy
75+
76+
# Sphinx documentation
77+
docs/_build/
78+
79+
# PyBuilder
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# pyenv
86+
.python-version
87+
88+
# celery beat schedule file
89+
celerybeat-schedule.*
90+
91+
# SageMath parsed files
92+
*.sage.py
93+
94+
# Environments
95+
.env
96+
.venv
97+
env/
98+
venv/
99+
ENV/
100+
env.bak/
101+
venv.bak/
102+
103+
# Spyder project settings
104+
.spyderproject
105+
.spyproject
106+
107+
# Rope project settings
108+
.ropeproject
109+
110+
# mkdocs documentation
111+
/site
112+
113+
# mypy
114+
.mypy_cache/
115+
116+
117+
# End of https://www.gitignore.io/api/python

authorship/authorship/__init__.py

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import itertools
2+
3+
from docutils import nodes
4+
from sphinx.util.docutils import SphinxDirective
5+
from docutils.parsers.rst import directives
6+
7+
8+
def generate_author_list(authors):
9+
return [
10+
nodes.Text(a, a)
11+
for a in authors
12+
]
13+
14+
15+
class Author(SphinxDirective):
16+
required_arguments = 1
17+
final_argument_whitespace = True
18+
19+
def run(self):
20+
env = self.state.document.settings.env
21+
22+
env.authors.setdefault(env.docname, [])
23+
env.authors[env.docname].append(self.arguments[0])
24+
25+
return []
26+
27+
28+
class Authors(SphinxDirective):
29+
def run(self):
30+
env = self.state.document.settings.env
31+
return generate_author_list(env.authors.get(env.docname, []))
32+
33+
34+
# maker node later to be replaced by list of all authors
35+
class allauthors(nodes.General, nodes.Element):
36+
pass
37+
38+
39+
class AllAuthors(SphinxDirective):
40+
def run(self):
41+
return [allauthors('')]
42+
43+
44+
def builder_inited(app):
45+
app.builder.env.authors = {}
46+
47+
48+
def purge_authors(app, env, docname):
49+
if not hasattr(env, 'authors'):
50+
return
51+
52+
env.authors.pop(docname, None)
53+
54+
55+
def process_authorlists(app, doctree, fromdocname):
56+
env = app.builder.env
57+
authors = set(itertools.chain(*[authors for authors in env.authors.values()]))
58+
59+
for node in doctree.traverse(allauthors):
60+
node.replace_self(generate_author_list(authors))
61+
62+
63+
def setup(app):
64+
app.add_node(allauthors)
65+
66+
directives.register_directive('author', Author)
67+
directives.register_directive('authors', Authors)
68+
directives.register_directive('allauthors', AllAuthors)
69+
70+
app.connect('builder-inited', builder_inited)
71+
app.connect('env-purge-doc', purge_authors)
72+
app.connect('doctree-resolved', process_authorlists)
73+
74+
return {
75+
'version': '1.0.0',
76+
}

authorship/setup.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env python
2+
3+
from setuptools import setup, find_packages
4+
5+
setup(
6+
name = 'authorship',
7+
version = '1.0.0',
8+
author = 'uberspace.de',
9+
author_email = '[email protected]',
10+
packages = find_packages(),
11+
install_requires = [
12+
],
13+
)

requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Sphinx==1.7.*
1+
# replace with 1.7.3 once released
2+
git+git://github.com/sphinx-doc/sphinx@b5ddc8c6977ac964e3ba4a2eb4647decdc742f4f
23
sphinx-rtd-theme==0.2.*
34
sphinx-autobuild==0.7.*
45
feedgen==0.6.1
6+
./authorship

source/conf.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
# Add any Sphinx extension module names here, as strings. They can be
3333
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3434
# ones.
35-
extensions = []
35+
extensions = [
36+
'authorship',
37+
]
3638

3739
# Add any paths that contain templates here, relative to this directory.
3840
templates_path = ['_templates']

source/contributors.rst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
############
2+
Contributors
3+
############
4+
5+
.. allauthors::

source/guide_etherpad.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. sectionauthor:: ezzra <[email protected]>
1+
.. author:: ezzra <[email protected]>
22
.. highlight:: console
33

44
#############
@@ -225,3 +225,5 @@ Then you need to restart the service daemon, so the new code is used by the webs
225225
----
226226

227227
Tested with Etherpad Lite 1.6.3 and Uberspace 7.1.1
228+
229+
.. authors::

source/guide_ghost.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. sectionauthor:: Uberspace <[email protected]>
1+
.. author:: Uberspace <[email protected]>
22
.. highlight:: console
33

44
.. sidebar:: Logo
@@ -238,3 +238,5 @@ If it's not in state RUNNING, check your configuration.
238238
----
239239

240240
Tested with Ghost 1.22.1, Uberspace 7.1.1
241+
242+
.. authors::

source/guide_gitea.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. sectionauthor:: Uberspace <[email protected]>
1+
.. author:: Uberspace <[email protected]>
22
.. highlight:: console
33

44
.. sidebar:: Logo
@@ -174,3 +174,5 @@ version is available, repeat the "Installation" step followed by ``supervisorctl
174174
----
175175

176176
Tested with Gitea 1.4.0, Uberspace 7.1.3
177+
178+
.. authors::

source/guide_jingo.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. sectionauthor:: ezzra <[email protected]>
1+
.. author:: ezzra <[email protected]>
22
.. highlight:: console
33

44
#####
@@ -256,3 +256,5 @@ In the end you need to restart the service daemon, so the new code is used by th
256256
----
257257

258258
Tested with Jingo 1.8.5, Uberspace 7.1.1
259+
260+
.. authors::

source/guide_lychee.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. sectionauthor:: TheForcer <[email protected]>
1+
.. author:: TheForcer <[email protected]>
22
.. highlight:: console
33

44
.. sidebar:: Logo
@@ -90,3 +90,5 @@ If a new version is available, ``cd`` to your Lychee folder and do a simple ``gi
9090
----
9191

9292
Tested with Lychee 3.1.6, Uberspace 7.1.1
93+
94+
.. authors::

source/guide_minim.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. sectionauthor:: minim <[email protected]>
1+
.. author:: minim <[email protected]>
22
.. highlight:: console
33

44
.. sidebar:: Logo
@@ -113,3 +113,5 @@ If everything works alright you can delete your ``minim-backup`` and the ``confi
113113
----
114114

115115
Tested with minim - Blog 0.5.0.1 and minim - Wiki 0.1.0.1, Uberspace 7.1.1
116+
117+
.. authors::

source/guide_wallabag.rst

+2
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,5 @@ If there is a new version available, you can get the code using git:
156156
----
157157

158158
Tested with Wallabag 2.3.2 and Uberspace 7.1.2
159+
160+
.. authors::

source/guide_wordpress.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. sectionauthor:: Uberspace <[email protected]>
1+
.. author:: Uberspace <[email protected]>
22
.. highlight:: console
33

44
.. sidebar:: Logo
@@ -93,3 +93,5 @@ By default, WordPress `automatically updates`_ itself to the latest stable minor
9393
----
9494

9595
Tested with WordPress 4.9.5, Uberspace 7.1.2
96+
97+
.. authors::

source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ Thank you and have fun experimenting!
2626
:maxdepth: 1
2727
:glob:
2828

29+
contributors
2930
guide_*

0 commit comments

Comments
 (0)