mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-12-25 17:17:54 +01:00
updates schema generator (#2244)
This commit is contained in:
parent
300a511bde
commit
f498bde89a
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# reStructuredText (RST) to GitHub-flavored Markdown converter
|
# reStructuredText (RST) to GitHub-flavored Markdown converter
|
||||||
|
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
from docutils import core, nodes, writers
|
from docutils import core, nodes, writers
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
@ -32,8 +31,7 @@ class Translator(nodes.NodeVisitor):
|
|||||||
raise nodes.StopTraversal
|
raise nodes.StopTraversal
|
||||||
|
|
||||||
def visit_title(self, node):
|
def visit_title(self, node):
|
||||||
self.version = re.match(r"(\d+\.\d+\.\d+).*", node.children[0]).group(1)
|
pass
|
||||||
raise nodes.SkipChildren
|
|
||||||
|
|
||||||
def visit_title_reference(self, node):
|
def visit_title_reference(self, node):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
|
@ -834,7 +834,14 @@ class SchemaGeneratorVisitor(nodes.NodeVisitor):
|
|||||||
self.app.config.html_baseurl,
|
self.app.config.html_baseurl,
|
||||||
self.docname + ".html#" + title.parent["ids"][0],
|
self.docname + ".html#" + title.parent["ids"][0],
|
||||||
)
|
)
|
||||||
markdown += f"\n\n*See also: [{self.props_section_title}]({url})*"
|
if (
|
||||||
|
self.props_section_title is not None
|
||||||
|
and self.props_section_title.endswith(title.astext())
|
||||||
|
):
|
||||||
|
markdown += f"\n\n*See also: [{self.props_section_title}]({url})*"
|
||||||
|
else:
|
||||||
|
markdown += f"\n\n*See also: [{self.getMarkdown(title)}]({url})*"
|
||||||
|
|
||||||
return markdown
|
return markdown
|
||||||
|
|
||||||
def update_prop(self, node, props):
|
def update_prop(self, node, props):
|
||||||
|
Loading…
Reference in New Issue
Block a user