Created
January 25, 2019 13:51
-
-
Save abitrolly/06f2d42e024bbaa9af3f99d3c7e9a542 to your computer and use it in GitHub Desktop.
Sphinx content post-processing with JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Javascript to render AIRFLOW-XXX and PR references in text | |
as HTML links. | |
Overrides extrahead block from sphinx_rtd_theme | |
https://www.sphinx-doc.org/en/master/templating.html | |
--> | |
{% extends "!layout.html" %} | |
{% block extrahead %} | |
{{ super() }} | |
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
var el = document.getElementById('changelog'); | |
if (el !== null ) { | |
// [AIRFLOW-...] | |
el.innerHTML = el.innerHTML.replace( | |
/\[(AIRFLOW-[\d]+)\]/g, | |
`<a href="https://issues.apache.org/jira/browse/$1">[$1]</a>` | |
); | |
// (#...) | |
el.innerHTML = el.innerHTML.replace( | |
/\(#([\d]+)\)/g, | |
`<a href="https://github.com/apache/airflow/pull/$1">(#$1)</a>` | |
); | |
}; | |
}) | |
</script> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment