mirror of https://github.com/streamlink/streamlink
docs: add custom html_template_vars extension
This commit is contained in:
parent
156b6602f4
commit
a7f442ae85
|
@ -3,7 +3,7 @@
|
|||
<img class="sidebar-logo" src="{{ pathto('_static/' + logo, 1) }}" alt="{{ project }}"/>
|
||||
</div>
|
||||
<p class="sidebar-brand-text">{{ project }}</p>
|
||||
<p class="sidebar-brand-oneliner">A command-line utility that extracts streams from various services and pipes them into a video player of choice.</p>
|
||||
<p class="sidebar-brand-oneliner">{{ oneliner }}</p>
|
||||
</a>
|
||||
<div class="sidebar-versions centered" role="note" aria-label="versions">
|
||||
<pre class="sidebar-versions-current">{{ release }}</pre>
|
||||
|
|
|
@ -20,6 +20,7 @@ extensions = [
|
|||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.autosectionlabel',
|
||||
'sphinx.ext.intersphinx',
|
||||
'ext_html_template_vars',
|
||||
'ext_argparse',
|
||||
'ext_github',
|
||||
'ext_plugins',
|
||||
|
@ -129,6 +130,13 @@ html_theme_options = {
|
|||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# HTML template variables via the custom ext_html_template_vars extension
|
||||
html_template_vars = {
|
||||
"oneliner": (
|
||||
"A command-line utility that extracts streams from various services and pipes them into a video player of choice."
|
||||
),
|
||||
}
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
from typing import Any, Dict
|
||||
|
||||
from sphinx.addnodes import document
|
||||
from sphinx.application import Sphinx
|
||||
|
||||
|
||||
_CONFIG_VAR = "html_template_vars"
|
||||
|
||||
|
||||
def update_context(
|
||||
app: Sphinx,
|
||||
pagename: str,
|
||||
templatename: str,
|
||||
context: Dict[str, Any],
|
||||
doctree: document,
|
||||
) -> None:
|
||||
for k, v in getattr(app.config, _CONFIG_VAR).items():
|
||||
context[k] = v
|
||||
|
||||
|
||||
def setup(app: Sphinx) -> None:
|
||||
app.add_config_value(_CONFIG_VAR, {}, "")
|
||||
app.connect("html-page-context", update_context)
|
Loading…
Reference in New Issue