Skip to content

Instantly share code, notes, and snippets.

@abitrolly
Created January 25, 2019 13:51
Show Gist options
  • Save abitrolly/06f2d42e024bbaa9af3f99d3c7e9a542 to your computer and use it in GitHub Desktop.
Save abitrolly/06f2d42e024bbaa9af3f99d3c7e9a542 to your computer and use it in GitHub Desktop.
Sphinx content post-processing with JavaScript
<!--
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