Skip to content

Commit

Permalink
Merge pull request #2855 from tomaarsen/feature/team-page
Browse files Browse the repository at this point in the history
Reworked team page look and building process
  • Loading branch information
stevenbird committed Jan 24, 2022
2 parents 3f74ac5 + 5c49e41 commit 1dcc201
Show file tree
Hide file tree
Showing 13 changed files with 294 additions and 14 deletions.
38 changes: 38 additions & 0 deletions 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;
}
File renamed without changes
File renamed without changes
7 changes: 7 additions & 0 deletions 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 %}
Expand Down
4 changes: 4 additions & 0 deletions 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 %}
Expand Down
4 changes: 4 additions & 0 deletions 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 %}
Expand Down
58 changes: 58 additions & 0 deletions web/_templates/team.html
@@ -0,0 +1,58 @@
<!-- 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.
Updating this file should be done by modifying `web/team/team.json`.
-->
<link rel="stylesheet" href="_static/css/team.css">

{% for member in members -%}
<div class="member-card" id="{{ member.github_username }}">
<div class="member-header">
{%- if member.personal_website_url %}
<a href="{{ member.personal_website_url }}">
{{ member.full_name }}
</a>
{%- else %}
{{ member.full_name }}
{%- endif %}
<a class="headerlink" href="#{{ member.github_username }}" title="Permalink to {{ member.full_name }}">&para;</a>
<a class="reference internal github-link" href="https://www.github.com/{{ member.github_username}}">
@{{ member.github_username }}
</a>
</div>

<div class="member-body">
<div class="member-left-panel">
<a class="reference internal" href="https://www.github.com/{{ member.github_username }}">
<img src="https://www.github.com/{{ member.github_username }}.png" alt="{{ member.full_name }}" width="200" height="200">
</a>
</div>

<div class="member-right-panel">
<dl class="field-list">
{%- if member.location %}
<dt>Location</dt>
<dd>
<p>{{ member.location }}</p>
</dd>
{%- endif %}

{%- if member.role %}
<dt>Role</dt>
<dd>
<p>{{ member.role }}</p>
</dd>
{%- endif %}

{%- if member.active_range %}
<dt>Active Range</dt>
<dd>
<p>{{ member.active_range }}</p>
</dd>
{%- endif %}
</dl>
</div>
</div>
</div>
{% endfor %}
29 changes: 24 additions & 5 deletions web/conf.py
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion web/index.rst
Expand Up @@ -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:
Expand Down
15 changes: 7 additions & 8 deletions web/team.rst
@@ -1,12 +1,11 @@
NLTK Team
=========

The NLTK project is led by `Steven Bird and Liling Tan <mailto:stevenbird1@gmail.com,alvations@gmail.com>`_.
Individual packages are maintained by the following people:
.. raw:: html
:file: team/current_team.html

:Semantics: `Dan Garrette <http://www.cs.utexas.edu/~dhg/>`_, Austin, USA (``nltk.sem, nltk.inference``)
:Parsing: `Peter Ljunglöf <https://www.cse.chalmers.se/~peb/>`_, Gothenburg, Sweden (``nltk.parse, nltk.featstruct``)
:Metrics: `Joel Nothman <http://joelnothman.com/>`_, Sydney, Australia (``nltk.metrics, nltk.tokenize.punkt``)
:Python 3: `Mikhail Korobov <http://kmike.ru/>`_, Ekaterinburg, Russia
:Releases: `Steven Bird <http://stevenbird.net>`_, Melbourne, Australia
:NLTK-Users: `Alexis Dimitriadis <A.Dimitriadis@uu.nl>`_, Utrecht, Netherlands
Former NLTK Team Members
------------------------

.. raw:: html
:file: team/former_team.html
80 changes: 80 additions & 0 deletions web/team/current_team.html
@@ -0,0 +1,80 @@
<!-- 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.
Updating this file should be done by modifying `web/team/team.json`.
-->
<link rel="stylesheet" href="_static/css/team.css">

<div class="member-card" id="tomaarsen">
<div class="member-header">
<a href="https://www.tomaarsen.com">
Tom Aarsen
</a>
<a class="headerlink" href="#tomaarsen" title="Permalink to Tom Aarsen">&para;</a>
<a class="reference internal github-link" href="https://www.github.com/tomaarsen">
@tomaarsen
</a>
</div>

<div class="member-body">
<div class="member-left-panel">
<a class="reference internal" href="https://www.github.com/tomaarsen">
<img src="https://www.github.com/tomaarsen.png" alt="Tom Aarsen" width="200" height="200">
</a>
</div>

<div class="member-right-panel">
<dl class="field-list">
<dt>Location</dt>
<dd>
<p>Nijmegen, Netherlands</p>
</dd>
<dt>Role</dt>
<dd>
<p>Core Maintainer. Issue triaging, bug fixing, documentation, website.</p>
</dd>
<dt>Active Range</dt>
<dd>
<p>Since 2020</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="member-card" id="this-user-hopefully-does-not-exist">
<div class="member-header">
<a href="https://www.google.com">
Arbitrary Human
</a>
<a class="headerlink" href="#this-user-hopefully-does-not-exist" title="Permalink to Arbitrary Human">&para;</a>
<a class="reference internal github-link" href="https://www.github.com/this-user-hopefully-does-not-exist">
@this-user-hopefully-does-not-exist
</a>
</div>

<div class="member-body">
<div class="member-left-panel">
<a class="reference internal" href="https://www.github.com/this-user-hopefully-does-not-exist">
<img src="https://www.github.com/this-user-hopefully-does-not-exist.png" alt="Arbitrary Human" width="200" height="200">
</a>
</div>

<div class="member-right-panel">
<dl class="field-list">
<dt>Location</dt>
<dd>
<p>Within the Milky Way, hypothetically</p>
</dd>
<dt>Role</dt>
<dd>
<p>Introducing bugs</p>
</dd>
<dt>Active Range</dt>
<dd>
<p>For far too long</p>
</dd>
</dl>
</div>
</div>
</div>
42 changes: 42 additions & 0 deletions web/team/former_team.html
@@ -0,0 +1,42 @@
<!-- 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.
Updating this file should be done by modifying `web/team/team.json`.
-->
<link rel="stylesheet" href="_static/css/team.css">

<div class="member-card" id="presumably-this-user-doesnt-exist-either">
<div class="member-header">
Someone else
<a class="headerlink" href="#presumably-this-user-doesnt-exist-either" title="Permalink to Someone else">&para;</a>
<a class="reference internal github-link" href="https://www.github.com/presumably-this-user-doesnt-exist-either">
@presumably-this-user-doesnt-exist-either
</a>
</div>

<div class="member-body">
<div class="member-left-panel">
<a class="reference internal" href="https://www.github.com/presumably-this-user-doesnt-exist-either">
<img src="https://www.github.com/presumably-this-user-doesnt-exist-either.png" alt="Someone else" width="200" height="200">
</a>
</div>

<div class="member-right-panel">
<dl class="field-list">
<dt>Location</dt>
<dd>
<p>Earth</p>
</dd>
<dt>Role</dt>
<dd>
<p>Absolutely nothing</p>
</dd>
<dt>Active Range</dt>
<dd>
<p>Who knows?</p>
</dd>
</dl>
</div>
</div>
</div>
29 changes: 29 additions & 0 deletions 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?"
}
]
}

0 comments on commit 1dcc201

Please sign in to comment.