mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-09-27 04:13:07 +02:00
Merge branch 'current' into next
This commit is contained in:
commit
d46248a030
@ -4,4 +4,4 @@ ports:
|
||||
|
||||
tasks:
|
||||
- before: pip3 install -r requirements.txt
|
||||
command: make webserver
|
||||
command: make live-html
|
||||
|
@ -186,3 +186,7 @@ div.index-shields {
|
||||
margin-left: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
.breadcrumbs li {
|
||||
display: inline;
|
||||
}
|
||||
|
@ -27,6 +27,17 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
|
||||
{% endblock %}
|
||||
|
||||
{% block relbar_top %}
|
||||
{% if parents|length > 0 %}
|
||||
<ul class="breadcrumbs">
|
||||
{%- for doc in parents %}
|
||||
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> ➔</li>
|
||||
{%- endfor %}
|
||||
<li>{{title}}</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<div id="upgrade-footer">
|
||||
A new version has been release since you last visited this page: {{ release }} 🎉
|
||||
|
42
components.py
Normal file
42
components.py
Normal file
@ -0,0 +1,42 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
|
||||
def setup(app):
|
||||
"""Setup connects events to the components output builder"""
|
||||
app.connect("html-page-context", add_component_details)
|
||||
app.connect("build-finished", create_output)
|
||||
app.compoents_output = {}
|
||||
|
||||
is_production = os.getenv("NETLIFY") == "true"
|
||||
|
||||
return {
|
||||
"version": "1.0.0",
|
||||
"parallel_read_safe": True,
|
||||
"parallel_write_safe": not is_production,
|
||||
}
|
||||
|
||||
|
||||
def add_component_details(app, pagename, templatename, context, doctree):
|
||||
"""As each page is built, collect page details for the output."""
|
||||
if pagename.startswith("components/"):
|
||||
page_key = pagename[11:].replace("/", "_")
|
||||
component_name = pagename.split("/")[-1]
|
||||
page_data = {
|
||||
"title": context["title"],
|
||||
"url": context["pageurl"],
|
||||
"path": context["pagename"],
|
||||
}
|
||||
if os.path.exists(os.path.join(app.builder.srcdir, "images", component_name + ".png")):
|
||||
page_data["image"] = app.builder.config.html_baseurl + "/_images/" + component_name + ".png"
|
||||
elif os.path.exists(os.path.join(app.builder.srcdir, "images", component_name + ".jpg")):
|
||||
page_data["image"] = app.builder.config.html_baseurl + "/_images/" + component_name + ".jpg"
|
||||
|
||||
app.compoents_output[page_key] = page_data
|
||||
|
||||
|
||||
def create_output(app, exception):
|
||||
"""Generates the components.json from the collected component pages"""
|
||||
with open(os.path.join(app.builder.outdir, "components.json"), "wt") as f:
|
||||
f.write(json.dumps(app.compoents_output))
|
3
conf.py
3
conf.py
@ -39,7 +39,8 @@ sys.path.append(os.path.abspath("."))
|
||||
extensions = [
|
||||
"github",
|
||||
"seo",
|
||||
"sitemap",
|
||||
"components",
|
||||
"sitemap"
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
|
@ -1,4 +1,4 @@
|
||||
Cookbook
|
||||
Devices
|
||||
========
|
||||
|
||||
.. toctree::
|
||||
|
@ -13,7 +13,7 @@ from docutils import nodes
|
||||
|
||||
# This file is not processed by default as extension unless added.
|
||||
# To add this extension from command line use:
|
||||
# -Dextensions=github,seo,sitemap,schema_doc"
|
||||
# -Dextensions=github,seo,sitemap,components,schema_doc"
|
||||
|
||||
# also for improve performance running old version
|
||||
# -d_build/.doctrees-schema
|
||||
|
Loading…
Reference in New Issue
Block a user