-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into hbridge-switch
- Loading branch information
Showing
175 changed files
with
2,032 additions
and
543 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import re | ||
import string | ||
from docutils import nodes, utils | ||
|
||
|
||
value_re = re.compile(r"^(.*)\s*<(.*)>$") | ||
DOXYGEN_LOOKUP = {} | ||
for s in string.ascii_lowercase + string.digits: | ||
DOXYGEN_LOOKUP[s] = s | ||
for s in string.ascii_uppercase: | ||
DOXYGEN_LOOKUP[s] = "_{}".format(s.lower()) | ||
DOXYGEN_LOOKUP[":"] = "_1" | ||
DOXYGEN_LOOKUP["_"] = "__" | ||
DOXYGEN_LOOKUP["."] = "_8" | ||
|
||
|
||
def split_text_value(value): | ||
match = value_re.match(value) | ||
if match is None: | ||
return None, value | ||
return match.group(1), match.group(2) | ||
|
||
|
||
def encode_doxygen(value): | ||
value = value.split("/")[-1] | ||
try: | ||
return "".join(DOXYGEN_LOOKUP[s] for s in value) | ||
except KeyError: | ||
raise ValueError("Unknown character in doxygen string! '{}'".format(value)) | ||
|
||
|
||
def apiref_role(name, rawtext, text, lineno, inliner, options=None, content=None): | ||
text, value = split_text_value(text) | ||
if text is None: | ||
text = "API Reference" | ||
ref = "/api/{}.html".format(encode_doxygen(value)) | ||
return [make_link_node(rawtext, text, ref, options)], [] | ||
|
||
|
||
def apiclass_role(name, rawtext, text, lineno, inliner, options=None, content=None): | ||
text, value = split_text_value(text) | ||
if text is None: | ||
text = value | ||
ref = "/api/classesphome_1_1{}.html".format(encode_doxygen(value)) | ||
return [make_link_node(rawtext, text, ref, options)], [] | ||
|
||
|
||
def apistruct_role(name, rawtext, text, lineno, inliner, options=None, content=None): | ||
text, value = split_text_value(text) | ||
if text is None: | ||
text = value | ||
ref = "/api/structesphome_1_1{}.html".format(encode_doxygen(value)) | ||
return [make_link_node(rawtext, text, ref, options)], [] | ||
|
||
def make_link_node(rawtext, text, ref, options=None): | ||
options = options or {} | ||
node = nodes.reference(rawtext, utils.unescape(text), refuri=ref, **options) | ||
return node | ||
|
||
def setup(app): | ||
app.add_role("apiref", apiref_role) | ||
app.add_role("apiclass", apiclass_role) | ||
app.add_role("apistruct", apistruct_role) | ||
return {"version": "1.0.0", "parallel_read_safe": True, "parallel_write_safe": True} |
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
import os | ||
|
||
from docutils import nodes, utils | ||
|
||
|
||
def libpr_role(name, rawtext, text, lineno, inliner, options=None, content=None): | ||
ref = "https://github.com/esphome/esphome-core/pull/{}".format(text) | ||
return [make_link_node(rawtext, "core#{}".format(text), ref, options)], [] | ||
|
||
|
||
def yamlpr_role(name, rawtext, text, lineno, inliner, options=None, content=None): | ||
ref = "https://github.com/esphome/esphome/pull/{}".format(text) | ||
return [make_link_node(rawtext, "esphome#{}".format(text), ref, options)], [] | ||
|
||
|
||
def docspr_role(name, rawtext, text, lineno, inliner, options=None, content=None): | ||
ref = "https://github.com/esphome/esphome-docs/pull/{}".format(text) | ||
return [make_link_node(rawtext, "docs#{}".format(text), ref, options)], [] | ||
|
||
|
||
def ghuser_role(name, rawtext, text, lineno, inliner, options=None, content=None): | ||
ref = "https://github.com/{}".format(text) | ||
return [make_link_node(rawtext, "@{}".format(text), ref, options)], [] | ||
|
||
|
||
def ghedit_role(name, rawtext, text, lineno, inliner, options=None, content=None): | ||
path = os.path.relpath( | ||
inliner.document.current_source, inliner.document.settings.env.app.srcdir | ||
) | ||
ref = "https://github.com/esphome/esphome-docs/blob/current/{}".format(path) | ||
return [make_link_node(rawtext, "Edit this page on GitHub", ref, options)], [] | ||
|
||
|
||
def make_link_node(rawtext, text, ref, options=None): | ||
options = options or {} | ||
node = nodes.reference(rawtext, utils.unescape(text), refuri=ref, **options) | ||
return node | ||
|
||
|
||
def setup(app): | ||
app.add_role("libpr", libpr_role) | ||
app.add_role("corepr", libpr_role) | ||
app.add_role("yamlpr", yamlpr_role) | ||
app.add_role("esphomepr", yamlpr_role) | ||
app.add_role("docspr", docspr_role) | ||
app.add_role("ghuser", ghuser_role) | ||
app.add_role("ghedit", ghedit_role) | ||
return {"version": "1.0.0", "parallel_read_safe": True, "parallel_write_safe": True} |
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2024.11.0-dev | ||
2024.12.0-dev |
Oops, something went wrong.