Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add project authors, auto-link GitHub usernames (#2066)

Madison Swain-Bowdene5659baec492
diff --git a/documentation/_ext/link_usernames.py b/documentation/_ext/link_usernames.py
new file mode 100644
index 000000000..f4c52560a
--- /dev/null
+++ b/documentation/_ext/link_usernames.py
@@ -0,0 +1,54 @@
+"""GitHub Username Linking
+
+Based on: https://www.sphinx-doc.org/en/master/extdev/appapi.html#event-source-read
+and: https://stackoverflow.com/a/31924901/3277713 CC BY-SA 3.0 by C_Z_
+
+This extension replaces username references of the form `@username` with a link
+to the user's GitHub profile. In order to prevent adding references to existing
+existing links (e.g. `[@username](...)`, whitespace is required in front of the `@`.
+
+The GITHUB_IGNORE_USERNAMES set contains usernames that should not be linked but may
+appear to be usernames in the documentation.
+"""
+import re
+
+from sphinx.application import Sphinx
+from sphinx.util import logging
+
+
+logger = logging.getLogger(__name__)
+
+# Format to use for the link to the GitHub profile
+GITHUB_USERNAME_TEMPLATE = "https://github.com/{}"
+# Regex to match username references
+GITHUB_USERNAME_REGEX = re.compile(
+ r"""
+\ # Required initial whitespace
+@([A-Za-z0-9-]+) # Match @ then any alphanumeric character or - for the username
+""",
+ flags=re.VERBOSE,
+)
+GITHUB_IGNORE_USERNAMES = {"todo", "WordPress", "username", "defaultValue"}
+
+
+def _replace_username(match: re.Match) -> str:
+ username = match.group(1)
+ if username in GITHUB_IGNORE_USERNAMES:
+ logger.debug(f"Ignoring username reference: {username}")
+ return match.group(0)
+ logger.debug(f"Replacing username reference: {username}")
+ return f" [@{username}]({GITHUB_USERNAME_TEMPLATE.format(username)})"
+
+
+def replace_username_references(app, docname, source):
+ # Changelogs are already created with the usernames as references, so these files
+ # should just be skipped entirely
+ if docname.startswith("changelogs"):
+ return
+ logger.debug(f"In file: {docname}")
+ source[0] = GITHUB_USERNAME_REGEX.sub(_replace_username, source[0])
+
+
+def setup(app: Sphinx):
+ # Hook for running the replace username references when the source file is read
+ app.connect("source-read", replace_username_references)
diff --git a/documentation/conf.py b/documentation/conf.py
index c11c67473..a73626e9d 100644
--- a/documentation/conf.py
+++ b/documentation/conf.py
@@ -31,6 +31,7 @@ extensions = [
"myst_parser",
"sphinxcontrib.mermaid",
"link_issues",
+ "link_usernames",
"sphinx_copybutton",
]
myst_heading_anchors = 6 # Add anchors to all headers, this is disabled by default.
diff --git a/documentation/meta/documentation/link_issues.md b/documentation/meta/documentation/extensions.md
similarity index 55%
rename from documentation/meta/documentation/link_issues.md
rename to documentation/meta/documentation/extensions.md
index 042e58f6f..d56470971 100644
--- a/documentation/meta/documentation/link_issues.md
+++ b/documentation/meta/documentation/extensions.md
@@ -1,4 +1,6 @@
-# Sphinx GitHub issue resolver plugin (`link_issues`)
+# Sphinx extensions
+
+## GitHub issue resolver plugin (`link_issues`)
The `link_issues` Sphinx plugin is copied directly into the repository to
accommodate updates necessary to support modern Sphinx versions.
@@ -10,3 +12,11 @@ authentication tokens to prevent rate limiting from breaking issue resolution.
If you want to test issue resolution locally, add a `LINK_ISSUES_GITHUB_TOKEN`
environment variable when running the documentation stack. The token must have
read permissions for public repositories.
+
+## GitHub username link plugin (`link_usernames`)
+
+The `link_usernames` Sphinx plugin is a simple, custom plugin which modifies the
+source of documentation files to change `@username` to a link to the user's
+GitHub profile. Changelog files are excluded from this process since those
+username references are already linked when creating the changelog. See the
+[plugin code and docstring](/_ext/link_usernames.py) for more information.
diff --git a/documentation/meta/documentation/index.md b/documentation/meta/documentation/index.md
index 09e9b2e3b..92dc3d51d 100644
--- a/documentation/meta/documentation/index.md
+++ b/documentation/meta/documentation/index.md
@@ -5,5 +5,5 @@
quickstart
guidelines
-link_issues
+extensions
```
diff --git a/documentation/projects/proposals/3d_model_support/20220221-project_proposal.md b/documentation/projects/proposals/3d_model_support/20220221-project_proposal.md
index 8098011d0..75cfda4a0 100644
--- a/documentation/projects/proposals/3d_model_support/20220221-project_proposal.md
+++ b/documentation/projects/proposals/3d_model_support/20220221-project_proposal.md
@@ -1,5 +1,7 @@
# 2022-02-21 Project Proposal: 3D model support
+**Author**: @aetherunbound
+
- [x] @sarayourfriend
- [x] @panchovm
diff --git a/documentation/projects/proposals/analytics/20221006-implementation_plan_frontend.md b/documentation/projects/proposals/analytics/20221006-implementation_plan_frontend.md
index 0e15e06b0..5d26c9966 100644
--- a/documentation/projects/proposals/analytics/20221006-implementation_plan_frontend.md
+++ b/documentation/projects/proposals/analytics/20221006-implementation_plan_frontend.md
@@ -1,4 +1,6 @@
-# 2022-10-06 Implentation Plan: Frontend event tracking
+# 2022-10-06 Implementation Plan: Frontend event tracking
+
+**Author**: @zackkrida
A proposal to emit frontend events based on user interactions and page visits.
diff --git a/documentation/projects/proposals/analytics/20230307-backend_service.md b/documentation/projects/proposals/analytics/20230307-backend_service.md
index 123f5d3f3..1f2378f15 100644
--- a/documentation/projects/proposals/analytics/20230307-backend_service.md
+++ b/documentation/projects/proposals/analytics/20230307-backend_service.md
@@ -1,5 +1,7 @@
# 2023-03-07 Implementation Plan: Analytics backend and visualisation service
+**Author**: @dhruvkb
+
This RFC deals with the backend of analytics, about how we record events sent
from the frontend and what we do with those events.
diff --git a/documentation/projects/proposals/core_user_interface_improvement/20230314-project_proposal_core_ui_improvement.md b/documentation/projects/proposals/core_user_interface_improvement/20230314-project_proposal_core_ui_improvement.md
index 3889ab9ac..6bb69b95e 100644
--- a/documentation/projects/proposals/core_user_interface_improvement/20230314-project_proposal_core_ui_improvement.md
+++ b/documentation/projects/proposals/core_user_interface_improvement/20230314-project_proposal_core_ui_improvement.md
@@ -1,5 +1,7 @@
# 2023-03-14 Project Proposal: Core UI Improvement
+**Author**: @fcoveram
+
## Reviewers
- [x] @obulat
diff --git a/documentation/projects/proposals/document_all_media_properties/20230307-project_proposal.md b/documentation/projects/proposals/document_all_media_properties/20230307-project_proposal.md
index 9233f52f2..10318a674 100644
--- a/documentation/projects/proposals/document_all_media_properties/20230307-project_proposal.md
+++ b/documentation/projects/proposals/document_all_media_properties/20230307-project_proposal.md
@@ -1,5 +1,7 @@
# 2023-03-07 Project proposal for [Document all media properties](https://github.com/WordPress/openverse/issues/412)
+**Author**: @obulat
+
## Due date:
2023-03-21
diff --git a/documentation/projects/proposals/feature_flags/20220309-project_proposal.md b/documentation/projects/proposals/feature_flags/20220309-project_proposal.md
index 0f72e5e7c..04f3a6ca1 100644
--- a/documentation/projects/proposals/feature_flags/20220309-project_proposal.md
+++ b/documentation/projects/proposals/feature_flags/20220309-project_proposal.md
@@ -1,5 +1,7 @@
# 2022-03-09 Project Proposal: Feature flags
+**Author**: @dhruvkb
+
## Reviewers
- [x] @sarayourfriend
diff --git a/documentation/projects/proposals/frontend_ui_state_cookie/20220218-project_proposal.md b/documentation/projects/proposals/frontend_ui_state_cookie/20220218-project_proposal.md
index ebb32fc3d..be3d75ca9 100644
--- a/documentation/projects/proposals/frontend_ui_state_cookie/20220218-project_proposal.md
+++ b/documentation/projects/proposals/frontend_ui_state_cookie/20220218-project_proposal.md
@@ -1,5 +1,7 @@
# 2022-02-18 Project Propsal: Frontend UI State Cookie
+**Author**: @sarayourfriend
+
- [x] @obulat
- [x] @zackkrida
diff --git a/documentation/projects/proposals/monitoring/20220307-project_proposal.md b/documentation/projects/proposals/monitoring/20220307-project_proposal.md
index ee6ef31d7..328f88faa 100644
--- a/documentation/projects/proposals/monitoring/20220307-project_proposal.md
+++ b/documentation/projects/proposals/monitoring/20220307-project_proposal.md
@@ -1,5 +1,7 @@
# 2022-03-07 Project Proposal: Monitoring
+**Author**: @sarayourfriend
+
Note: Because I had to spend a good deal of time sketching out how this stuff
works, I wrote a good deal of preliminary code. It's probably not perfect so
it's really only a starting point, but it at least gives a vision for how we
diff --git a/documentation/projects/proposals/monorepo/20221124-project_proposal.md b/documentation/projects/proposals/monorepo/20221124-project_proposal.md
index bf0943107..55c606301 100644
--- a/documentation/projects/proposals/monorepo/20221124-project_proposal.md
+++ b/documentation/projects/proposals/monorepo/20221124-project_proposal.md
@@ -1,5 +1,7 @@
# 2022-11-24 Project Proposal: Monorepo
+**Author**: @dhruvkb
+
## Reviewers
- [x] @zackkrida
diff --git a/documentation/projects/proposals/popularity_optimizations/20230406-project_proposal_popularity_optimizations.md b/documentation/projects/proposals/popularity_optimizations/20230406-project_proposal_popularity_optimizations.md
index b8470e089..fc74152dd 100644
--- a/documentation/projects/proposals/popularity_optimizations/20230406-project_proposal_popularity_optimizations.md
+++ b/documentation/projects/proposals/popularity_optimizations/20230406-project_proposal_popularity_optimizations.md
@@ -1,5 +1,7 @@
# 2023-04-06 Project Proposal: Popularity Calculation Optimizations
+**Author**: @stacimc
+
## Reviewers
<!-- Choose two people at your discretion who make sense to review this based on their existing expertise. Check in to make sure folks aren't currently reviewing more than one other proposal or RFC. -->
diff --git a/documentation/projects/proposals/search_relevancy_sandbox/20230331-project_proposal_search_relevancy_sandbox.md b/documentation/projects/proposals/search_relevancy_sandbox/20230331-project_proposal_search_relevancy_sandbox.md
index c4c5564f5..3f96382c0 100644
--- a/documentation/projects/proposals/search_relevancy_sandbox/20230331-project_proposal_search_relevancy_sandbox.md
+++ b/documentation/projects/proposals/search_relevancy_sandbox/20230331-project_proposal_search_relevancy_sandbox.md
@@ -1,12 +1,14 @@
# 2023-03-31 Project Proposal: Search relevancy sandbox
+**Author**: @aetherunbound
+
## Reviewers
<!-- Choose two people at your discretion who make sense to review this based on their existing expertise. Check in to make sure folks aren't currently reviewing more than one other proposal or RFC. -->
-- [x] sarayourfriend
-- [x] zackkrida
-- [x] krysal
+- [x] @sarayourfriend
+- [x] @zackkrida
+- [x] @krysal
## Project summary
diff --git a/documentation/projects/proposals/search_relevancy_sandbox/20230406-implementation_plan_update_staging_database.md b/documentation/projects/proposals/search_relevancy_sandbox/20230406-implementation_plan_update_staging_database.md
index 1bdbd4002..d09daf479 100644
--- a/documentation/projects/proposals/search_relevancy_sandbox/20230406-implementation_plan_update_staging_database.md
+++ b/documentation/projects/proposals/search_relevancy_sandbox/20230406-implementation_plan_update_staging_database.md
@@ -1,5 +1,7 @@
# 2023-04-06 Implementation Plan: Update Staging Database
+**Author**: @aetherunbound
+
<!-- See the implementation plan guide for more information: https://github.com/WordPress/openverse/tree/19791f51c063d0979112f4b9f4eeace04c8cf5ff/docs/projects#implementation-plans-status-in-rfc -->
<!-- This template is exhaustive and may include sections which aren't relevant to your project. Feel free to remove any sections which would not be useful to have. -->
diff --git a/documentation/projects/proposals/trust_and_safety/content_report_moderation/20230411-project_proposal_content_report_moderation.md b/documentation/projects/proposals/trust_and_safety/content_report_moderation/20230411-project_proposal_content_report_moderation.md
index e13c30e80..93202dedf 100644
--- a/documentation/projects/proposals/trust_and_safety/content_report_moderation/20230411-project_proposal_content_report_moderation.md
+++ b/documentation/projects/proposals/trust_and_safety/content_report_moderation/20230411-project_proposal_content_report_moderation.md
@@ -1,5 +1,7 @@
# 2023-04-11 Project Proposal: Sensitive content report moderation: initial practices
+**Author**: @sarayourfriend
+
## Reviewers
<!-- Choose two people at your discretion who make sense to review this based on their existing expertise. Check in to make sure folks aren't currently reviewing more than one other proposal or RFC. -->
diff --git a/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230309-implementation_plan_sensitive_terms_list.md b/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230309-implementation_plan_sensitive_terms_list.md
index 124f13379..cf3d27a82 100644
--- a/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230309-implementation_plan_sensitive_terms_list.md
+++ b/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230309-implementation_plan_sensitive_terms_list.md
@@ -1,5 +1,7 @@
# 2023-03-09 Implementation Plan: Sensitive Terms List
+**Author**: @zackkrida
+
> **Content Warning**
>
> This document **does not** include sensitive content or direct links to
diff --git a/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230309-project_proposal_detecting_sensitive_textual_content.md b/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230309-project_proposal_detecting_sensitive_textual_content.md
index 1b4e2c029..248d630f5 100644
--- a/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230309-project_proposal_detecting_sensitive_textual_content.md
+++ b/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230309-project_proposal_detecting_sensitive_textual_content.md
@@ -1,5 +1,7 @@
# 2023-03-09 Project Proposal: Detecting sensitive textual content and blurring all sensitive results
+**Author**: @sarayourfriend
+
## Reviewers
- [x] @aetherunbound
diff --git a/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230330-implementation_plan_filtering_and_designating_results_with_sensitive_textual_content.md b/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230330-implementation_plan_filtering_and_designating_results_with_sensitive_textual_content.md
index e449a7ef4..d97d99c54 100644
--- a/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230330-implementation_plan_filtering_and_designating_results_with_sensitive_textual_content.md
+++ b/documentation/projects/proposals/trust_and_safety/detecting_sensitive_textual_content/20230330-implementation_plan_filtering_and_designating_results_with_sensitive_textual_content.md
@@ -1,5 +1,7 @@
# 2023-03-30 Implementation Plan: Filtering and designating results with sensitive textual content
+**Author**: @sarayourfriend
+
## Reviewers
- [x] @stacimc
diff --git a/documentation/projects/proposals/visual_regression_testing/20220217-implementation_plan.md b/documentation/projects/proposals/visual_regression_testing/20220217-implementation_plan.md
index e9bbbd3f9..80299db47 100644
--- a/documentation/projects/proposals/visual_regression_testing/20220217-implementation_plan.md
+++ b/documentation/projects/proposals/visual_regression_testing/20220217-implementation_plan.md
@@ -1,5 +1,7 @@
# 2022-02-17 Implementation Plan: Visual regression testing
+**Author**: @sarayourfriend
+
A proposal to integrate visual regression testing into the Openverse frontend's
automated testing suite.
diff --git a/documentation/projects/proposals/vuex_to_pina_conversion/20220223-project_proposal.md b/documentation/projects/proposals/vuex_to_pina_conversion/20220223-project_proposal.md
index b9057f042..7532bfffd 100644
--- a/documentation/projects/proposals/vuex_to_pina_conversion/20220223-project_proposal.md
+++ b/documentation/projects/proposals/vuex_to_pina_conversion/20220223-project_proposal.md
@@ -1,5 +1,7 @@
# 2022-02-23 Project Proposal: Vuex to Pinia conversion
+**Author**: @obulat
+
- [x] @dhruvkb
- [x] @sarayourfriend
diff --git a/documentation/projects/templates/implementation-plan.md b/documentation/projects/templates/implementation-plan.md
index c1e8a667a..c5824e03c 100644
--- a/documentation/projects/templates/implementation-plan.md
+++ b/documentation/projects/templates/implementation-plan.md
@@ -3,6 +3,8 @@
```md
# {YYYY-MM-DD} Implementation Plan: {Piece of project or project being implemented}
+**Author**: @username
+
<!-- See the implementation plan guide for more information: https://github.com/WordPress/openverse/tree/19791f51c063d0979112f4b9f4eeace04c8cf5ff/docs/projects#implementation-plans-status-in-rfc -->
<!-- This template is exhaustive and may include sections which aren't relevant to your project. Feel free to remove any sections which would not be useful to have. -->
diff --git a/documentation/projects/templates/project-proposal.md b/documentation/projects/templates/project-proposal.md
index 88090e940..c517a3b77 100644
--- a/documentation/projects/templates/project-proposal.md
+++ b/documentation/projects/templates/project-proposal.md
@@ -3,6 +3,8 @@
```md
# {YYYY-MM-DD} Project Proposal
+**Author**: @username
+
## Reviewers
<!-- Choose two people at your discretion who make sense to review this based on their existing expertise. Check in to make sure folks aren't currently reviewing more than one other proposal or RFC. -->