Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge team page into develop #2941

Merged
merged 17 commits into from Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 %}
35 changes: 29 additions & 6 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 All @@ -71,7 +74,9 @@ def generate_howto():
os.makedirs(howto_folder)

# Load jinja template
with open(os.path.join(web_folder, "_templates", "doctest.rst")) as f:
with open(
os.path.join(web_folder, "_templates", "doctest.rst"), encoding="utf8"
) as f:
doctest_template = Template(f.read())

print("Generating HOWTO pages...")
Expand All @@ -91,8 +96,26 @@ 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"), encoding="utf8") 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"), encoding="utf8"
) 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 +217,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