diff --git a/web/_static/css/team.css b/web/_static/css/team.css new file mode 100644 index 0000000000..77ecaaa6c5 --- /dev/null +++ b/web/_static/css/team.css @@ -0,0 +1,38 @@ +.member-card { + background-color: #E6E6E6; + margin-bottom: 2.5rem; +} + +.member-header { + background-color: #2D2D2D; + color: #EBEBEB; + padding: 0.5em; + font-weight: 500; +} + +.member-header:hover .headerlink { + display: inline-block; +} + +.member-body { + display: flex; + /* Padding on all sides except the bottom, + as the right-panel takes care of this padding */ + padding: 1em 1em 0em 1em; +} + +.member-left-panel { + /* This panel only exists if there is an image to fill it. */ + padding-right: 1em; +} + +.member-right-panel { + /* This panel extends as far as it can */ + flex: 1; + /* padding-left: 1em; */ +} + +.github-link { + font-weight: 200; + float: right; +} diff --git a/web/images/book.gif b/web/_static/images/book.gif similarity index 100% rename from web/images/book.gif rename to web/_static/images/book.gif diff --git a/web/images/tree.gif b/web/_static/images/tree.gif similarity index 100% rename from web/images/tree.gif rename to web/_static/images/tree.gif diff --git a/web/_templates/doctest.rst b/web/_templates/doctest.rst index 143710147b..c0e6408af9 100644 --- a/web/_templates/doctest.rst +++ b/web/_templates/doctest.rst @@ -1,3 +1,10 @@ +{# The :autogenerated: tag is picked up by breadcrumbs.html to suppress "Edit on Github" link #} +:autogenerated: +.. + This file is autogenerated by `generate_custom_files` in conf.py, + and ought to be generated via building the documentation through Sphinx, e.g. + with `sphinx-build ./web ./build` from the root directory. + {% for item in range(17 + module_name|length) -%}#{%- endfor %} Sample usage for {{ module_name }} {% for item in range(17 + module_name|length) -%}#{%- endfor %} diff --git a/web/_templates/module.rst b/web/_templates/module.rst index b10806e453..87ebe3a1be 100644 --- a/web/_templates/module.rst +++ b/web/_templates/module.rst @@ -1,5 +1,9 @@ {# The :autogenerated: tag is picked up by breadcrumbs.html to suppress "Edit on Github" link #} :autogenerated: +.. + This file is autogenerated by `generate_custom_files` in conf.py, + and ought to be generated via building the documentation through Sphinx, e.g. + with `sphinx-build ./web ./build` from the root directory. {{ fullname }} module {% for item in range(7 + fullname|length) -%}={%- endfor %} diff --git a/web/_templates/package.rst b/web/_templates/package.rst index e207a71285..9cd2e60271 100644 --- a/web/_templates/package.rst +++ b/web/_templates/package.rst @@ -1,5 +1,9 @@ {# The :autogenerated: tag is picked up by breadcrumbs.html to suppress "Edit on Github" link #} :autogenerated: +.. + This file is autogenerated by `generate_custom_files` in conf.py, + and ought to be generated via building the documentation through Sphinx, e.g. + with `sphinx-build ./web ./build` from the root directory. {{ fullname }} package {% for item in range(8 + fullname|length) -%}={%- endfor %} diff --git a/web/_templates/team.html b/web/_templates/team.html new file mode 100644 index 0000000000..de6ec54fda --- /dev/null +++ b/web/_templates/team.html @@ -0,0 +1,58 @@ + + + +{% for member in members -%} +
+
+ {%- if member.personal_website_url %} + + {{ member.full_name }} + + {%- else %} + {{ member.full_name }} + {%- endif %} + + + @{{ member.github_username }} + +
+ +
+
+ + {{ member.full_name }} + +
+ +
+
+ {%- if member.location %} +
Location
+
+

{{ member.location }}

+
+ {%- endif %} + + {%- if member.role %} +
Role
+
+

{{ member.role }}

+
+ {%- endif %} + + {%- if member.active_range %} +
Active Range
+
+

{{ member.active_range }}

+
+ {%- endif %} +
+
+
+
+{% endfor %} diff --git a/web/conf.py b/web/conf.py index e71b5d219d..5dd08eba58 100644 --- a/web/conf.py +++ b/web/conf.py @@ -54,11 +54,14 @@ def run_apidoc(app): ) -def generate_howto(): - """Custom function for generating contents in the ``howto`` folder, - based on the ``ntlk/test/*.doctest`` files. +def generate_custom_files(): + """Generating contents in the ``howto`` folder, + based on the ``ntlk/test/*.doctest`` files, as well + as contents in the ``team`` folder, based on + ``team.json``. """ import glob + import json import re from jinja2 import Template @@ -91,8 +94,24 @@ def generate_howto(): print(f"Generated {len(modules)} HOWTO pages.") + # Load the team JSON data + with open(os.path.join(web_folder, "team", "team.json")) as f: + full_data = json.load(f) + print("Team data loaded!") -generate_howto() + # Load the team jinja template + with open(os.path.join(web_folder, "_templates", "team.html")) as f: + team_template = Template(f.read()) + + for members_type, members_data in full_data.items(): + team_template.stream(members=members_data).dump( + os.path.join(web_folder, "team", f"{members_type}_team.html") + ) + print(f"{members_type.title()} team HTML page written!") + + +# Build the Team & HOWTO page before creating the Sphinx build +generate_custom_files() # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -194,7 +213,7 @@ def setup(app): # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ["_static"] +html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/web/index.rst b/web/index.rst index 87af6abffe..e957957f7b 100644 --- a/web/index.rst +++ b/web/index.rst @@ -56,7 +56,7 @@ Display a parse tree: >>> t = treebank.parsed_sents('wsj_0001.mrg')[0] >>> t.draw() -.. image:: images/tree.gif +.. image:: _static/images/tree.gif NB. If you publish work that uses NLTK, please cite the NLTK book as follows: diff --git a/web/team.rst b/web/team.rst index 59853b0f73..21b12f3ae5 100644 --- a/web/team.rst +++ b/web/team.rst @@ -1,12 +1,11 @@ NLTK Team ========= -The NLTK project is led by `Steven Bird and Liling Tan `_. -Individual packages are maintained by the following people: +.. raw:: html + :file: team/current_team.html -:Semantics: `Dan Garrette `_, Austin, USA (``nltk.sem, nltk.inference``) -:Parsing: `Peter Ljunglöf `_, Gothenburg, Sweden (``nltk.parse, nltk.featstruct``) -:Metrics: `Joel Nothman `_, Sydney, Australia (``nltk.metrics, nltk.tokenize.punkt``) -:Python 3: `Mikhail Korobov `_, Ekaterinburg, Russia -:Releases: `Steven Bird `_, Melbourne, Australia -:NLTK-Users: `Alexis Dimitriadis `_, Utrecht, Netherlands +Former NLTK Team Members +------------------------ + +.. raw:: html + :file: team/former_team.html diff --git a/web/team/current_team.html b/web/team/current_team.html new file mode 100644 index 0000000000..f09e62aded --- /dev/null +++ b/web/team/current_team.html @@ -0,0 +1,80 @@ + + + +
+ + +
+
+ + Tom Aarsen + +
+ +
+
+
Location
+
+

Nijmegen, Netherlands

+
+
Role
+
+

Core Maintainer. Issue triaging, bug fixing, documentation, website.

+
+
Active Range
+
+

Since 2020

+
+
+
+
+
+
+ + +
+
+ + Arbitrary Human + +
+ +
+
+
Location
+
+

Within the Milky Way, hypothetically

+
+
Role
+
+

Introducing bugs

+
+
Active Range
+
+

For far too long

+
+
+
+
+
diff --git a/web/team/former_team.html b/web/team/former_team.html new file mode 100644 index 0000000000..62f8e978f6 --- /dev/null +++ b/web/team/former_team.html @@ -0,0 +1,42 @@ + + + +
+ + +
+
+ + Someone else + +
+ +
+
+
Location
+
+

Earth

+
+
Role
+
+

Absolutely nothing

+
+
Active Range
+
+

Who knows?

+
+
+
+
+
diff --git a/web/team/team.json b/web/team/team.json new file mode 100644 index 0000000000..5d70c86870 --- /dev/null +++ b/web/team/team.json @@ -0,0 +1,29 @@ +{ + "current": [ + { + "full_name": "Tom Aarsen", + "github_username": "tomaarsen", + "personal_website_url": "https://www.tomaarsen.com", + "location": "Nijmegen, Netherlands", + "role": "Core Maintainer. Issue triaging, bug fixing, documentation, website.", + "active_range": "Since 2020" + }, + { + "full_name": "Arbitrary Human", + "github_username": "this-user-hopefully-does-not-exist", + "personal_website_url": "https://www.google.com", + "location": "Within the Milky Way, hypothetically", + "role": "Introducing bugs", + "active_range": "For far too long" + } + ], + "former": [ + { + "full_name": "Someone else", + "github_username": "presumably-this-user-doesnt-exist-either", + "location": "Earth", + "role": "Absolutely nothing", + "active_range": "Who knows?" + } + ] +}