Skip to content

Commit 0388706

Browse files
author
Kevin Paul
authored
New Portal Landing Page (#115)
* Moving content directory out of way to make copy * Save copy of content directory * Restoring original content directory * Add local theme to repo (much easier to dev) * Change case of section titles * Update extensions location and remove comm gallery * Update and move out of pages * Update ignores related to move * Update ignores * Update index * Updated makefiles * Updating images for new theme * Explicitly add pythia extension * Update pages and content for new theme * Update Sphinx config for new theme * Remove explicit custom.js load (done in extension) * Add links to gallery * Formatting only * For model displays in new theme * Change name of gallery and affiliation link * Remove subtitle * Add HTML logo usage * Add HTML logo setting and fix img locations * Fix references with pathto * Logo and title * Fix dropdowns to use BS5 * Hide gallery (and some tweaks) * Gallery formatting * Rename links to gallery * New images * New landing page content * Match navbar items to new content * Move custom styling/JS to pythia theme * Update names in CI * Point RTD to new portal * Fix about link * Fix linting * Replace divs with sections when appropriate * Return soup object * Support div.section and section * Add extension to dropdown option urls * Add Code of Conduct button * Fix link in COC * Fix copyright flex issue in footer * Fix button layout * Add latest contributing to new portal * Fix prettier ugliness that breaks pre tags * Admonition styling * Add seealso admonition * Move gallery styling/js to custom files * Attempt a wide-card gallery style
1 parent 1220a6e commit 0388706

File tree

173 files changed

+50542
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+50542
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ jobs:
2828
- name: Build
2929
run: |
3030
conda env list
31-
cd content
31+
cd portal
3232
make -j4 html
3333
3434
- name: Deploy
3535
uses: peaceiris/[email protected]
3636
with:
3737
github_token: ${{ secrets.GITHUB_TOKEN }}
38-
publish_dir: ./content/_build/html
38+
publish_dir: ./portal/_build/html
3939
cname: projectpythia.org

.github/workflows/update-external-links-gallery.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ jobs:
9292
9393
yaml = YAML()
9494
submission_file = 'gallery-submission-input.json'
95-
links_file = 'content/links.yaml'
95+
gallery_file = 'portal/gallery.yaml'
9696
with open(submission_file) as f:
9797
data = json.load(f)
9898
99-
with open(links_file) as f:
100-
links = yaml.load(f)
99+
with open(gallery_file) as f:
100+
gallery = yaml.load(f)
101101
102-
with open(links_file, 'w') as f:
103-
links.append(data)
104-
yaml.dump(links, f)
102+
with open(gallery_file, 'w') as f:
103+
gallery.append(data)
104+
yaml.dump(gallery, f)
105105
106106
- name: Run pre-commit hooks
107107
run: |

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,10 @@ dmypy.json
131131
*.DS_Store
132132
_build/
133133
_thumbnails/
134-
content/pages/communications.md
135134
content/pages/code_of_conduct.md
136135
content/pages/links.md
137136
content/pages/links/*.md
138-
content/notebooks_gallery/
137+
portal/code_of_conduct.md
138+
portal/gallery.md
139+
portal/gallery/*.md
139140
gallery-submission-input.json

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.3.0
3+
rev: v4.0.1
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
@@ -10,17 +10,17 @@ repos:
1010
- id: double-quote-string-fixer
1111

1212
- repo: https://github.com/ambv/black
13-
rev: 20.8b1
13+
rev: 21.6b0
1414
hooks:
1515
- id: black
1616

1717
- repo: https://github.com/keewis/blackdoc
18-
rev: v0.3
18+
rev: v0.3.3
1919
hooks:
2020
- id: blackdoc
2121

2222
- repo: https://gitlab.com/pycqa/flake8
23-
rev: 3.8.4
23+
rev: 3.9.2
2424
hooks:
2525
- id: flake8
2626

@@ -29,17 +29,17 @@ repos:
2929
hooks:
3030
- id: seed-isort-config
3131
- repo: https://github.com/pre-commit/mirrors-isort
32-
rev: v5.6.4
32+
rev: v5.8.0
3333
hooks:
3434
- id: isort
3535

36-
- repo: https://github.com/prettier/pre-commit
37-
rev: 57f39166b5a5a504d6808b87ab98d41ebf095b46
38-
hooks:
39-
- id: prettier
36+
# - repo: https://github.com/prettier/pre-commit
37+
# rev: 57f39166b5a5a504d6808b87ab98d41ebf095b46
38+
# hooks:
39+
# - id: prettier
4040

4141
- repo: https://github.com/nbQA-dev/nbQA
42-
rev: 0.5.1
42+
rev: 0.13.0
4343
hooks:
4444
- id: nbqa-black
4545
additional_dependencies: [black==20.8b1]

.readthedocs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ conda:
88
environment: ci/environment.yml
99

1010
sphinx:
11+
configuration: portal/conf.py
1112
fail_on_warning: false

CODEOFCONDUCT.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Code of Conduct
22

3-
## OUR PLEDGE
3+
## Our Pledge
44

55
We, as contributors, creators, stewards, and maintainers (participants), of Project Pythia pledge to make participation in our software, system or hardware project and community a safe, productive, welcoming and inclusive experience for everyone. All participants are required to abide by this Code of Conduct. This includes respectful treatment of everyone regardless of age, body size, disability, ethnicity, gender identity or expression, level of experience, nationality, political affiliation, veteran status, pregnancy, genetic information, physical appearance, race, religion, or sexual orientation, as well as any other characteristic protected under applicable US federal or state law.
66

7-
## OUR STANDARDS
7+
## Our Standards
88

99
Examples of behaviors that contribute to a positive environment include:
1010

@@ -29,26 +29,26 @@ Examples of unacceptable behavior include, but are not limited to:
2929
- Threatening or stalking anyone, including a participant
3030
- Other conduct which could reasonably be considered inappropriate in a professional setting
3131

32-
## SCOPE
32+
## Scope of this Code
3333

3434
This Code of Conduct applies to all spaces managed by the Project whether they be physical, online or face-to-face. This includes project code, code repository, associated web pages, documentation, mailing lists, project websites and wiki pages, issue tracker, meetings, telecons, events, project social media accounts, and any other forums created by the project team which the community uses for communication. In addition, violations of this Code of Conduct outside these spaces may affect a person's ability to participate within them. Representation of a project may be further defined and clarified by project maintainers.
3535

36-
## COMMUNITY RESPONSIBILITIES
36+
## Community Responsibilities
3737

3838
Everyone in the community is empowered to respond to people who are showing unacceptable behavior. They can talk to them privately or publicly. Anyone requested to stop unacceptable behavior is expected to comply immediately. If the behavior continues concerns may be brought to the project administrators or to any other party listed in the Reporting section below.
3939

40-
## PROJECT ADMINISTRATOR RESPONSIBILITIES
40+
## Project Administrator Responsibilities
4141

4242
Project administrators are responsible for clarifying the standards of acceptable behavior and are encouraged to model appropriate behavior and provide support when people in the community point out inappropriate behavior. Project administrator(s) are normally the ones that would be tasked to carry out the actions in the Consequences section below.
4343

44-
## REPORTING
44+
## Reporting
4545

4646
Instances of unacceptable behavior can be brought to the attention of the project administrator(s) who may take any action as outlined in the Consequences section below.
4747

48-
## CONSEQUENCES
48+
## Consequences
4949

5050
Upon receipt of a complaint, the project administrator(s) may take any action deemed necessary and appropriate under the circumstances. Such action can include things such as: removing, editing, or rejecting comments, commits, code, wiki edits, email, issues, and other contributions that are not aligned to this Code of Conduct, or banning temporarily or permanently any contributor for other behaviors that are deemed inappropriate, threatening, offensive, or harmful. Project administrators also have the right to report violations to UCAR HR and/or UCAR’s Office of Diversity, Equity and Inclusion (ODEI), as well as a participant’s home institution and/or law enforcement. In the event an incident is reported to UCAR, UCAR will follow its Harassment Reporting and Complaint Procedure.
5151

52-
## ATTRIBUTION
52+
## Attribution
5353

54-
This Code of Conduct was originally adapted from the Contributor Covenant, version 1.4. We then aligned it with the UCAR Participant Code of Conduct, which also borrows from the American Geophysical Union (AGU) Code of Conduct. The UCAR Participant Code of Conduct applies to both UCAR employees as well as participants in activities run by UCAR. The original version of this for all software projects that have strong management from UCAR or UCAR staff is available on the UCAR website at https://doi.org/10.5065/6w2c-a132. The date that it was adopted by this project was 20 December 2020. When responding to complaints, UCAR HR and ODEI will do so based on the latest published version. Therefore, any project-specific changes should follow the Process for Changes section above.
54+
This Code of Conduct was originally adapted from the Contributor Covenant, version 1.4. We then aligned it with the UCAR Participant Code of Conduct, which also borrows from the American Geophysical Union (AGU) Code of Conduct. The UCAR Participant Code of Conduct applies to both UCAR employees as well as participants in activities run by UCAR. The original version of this for all software projects that have strong management from UCAR or UCAR staff is available on the UCAR website at [https://doi.org/10.5065/6w2c-a132](https://doi.org/10.5065/6w2c-a132). The date that it was adopted by this project was 20 December 2020. When responding to complaints, UCAR HR and ODEI will do so based on the latest published version. Therefore, any project-specific changes should follow the Process for Changes section above.

portal/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

portal/_extensions/pythia.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from bs4 import BeautifulSoup as bs
2+
from sphinx.application import Sphinx
3+
4+
5+
def add_functions_to_context(app, pagename, templatename, context, doctree):
6+
def denest_sections(html):
7+
soup = bs(html, 'html.parser')
8+
9+
sections = []
10+
for h1 in soup.find_all(['h1']):
11+
sections.append(h1.parent)
12+
for child in h1.parent.children:
13+
if (child.name == 'section') or (child.name == 'div' and 'section' in child['class']):
14+
sections.append(child.extract())
15+
16+
return '\n'.join(str(s) for s in sections)
17+
18+
def bootstrapify(html):
19+
soup = bs(html, 'html.parser')
20+
21+
for s in soup.select('section,div.section'):
22+
h = s.find(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
23+
if not h:
24+
continue
25+
26+
i = h.name[-1]
27+
28+
h['class'] = [f'display-{i}'] + h.get('class', [])
29+
30+
if h.name in ['h1', 'h2']:
31+
s.wrap(soup.new_tag('div', **{'class': f'container-fluid sectionwrapper-{i}'}))
32+
s.wrap(soup.new_tag('div', **{'class': f'container section-{i}'}))
33+
34+
if h.name == 'h2':
35+
h.wrap(soup.new_tag('div', **{'class': 'section-title-wrapper'}))
36+
h.wrap(soup.new_tag('div', **{'class': 'section-title'}))
37+
38+
return str(soup)
39+
40+
context['bootstrapify'] = bootstrapify
41+
context['denest_sections'] = denest_sections
42+
43+
44+
def setup(app: Sphinx):
45+
app.require_sphinx('3.5')
46+
app.connect('html-page-context', add_functions_to_context)
47+
48+
return {
49+
'parallel_read_safe': True,
50+
'parallel_write_safe': True,
51+
}

0 commit comments

Comments
 (0)