diff --git a/docs/_ext/lv_example.py b/docs/_ext/lv_example.py index 7c5268fb9..d50851850 100644 --- a/docs/_ext/lv_example.py +++ b/docs/_ext/lv_example.py @@ -1,14 +1,17 @@ -from docutils.parsers.rst import Directive +import os + from docutils import nodes +from docutils.parsers.rst import Directive from docutils.parsers.rst.directives.images import Image from sphinx.directives.code import LiteralInclude -import os + class LvExample(Directive): required_arguments = 3 def run(self): example_path = self.arguments[0] example_name = os.path.split(example_path)[1] + language = self.arguments[2] node_list = [] env = self.state.document.settings.env @@ -28,9 +31,9 @@ class LvExample(Directive): except FileNotFoundError: contents = 'Error encountered while trying to open ' + example_file literal_list = nodes.literal_block(contents, contents) - literal_list['language'] = self.arguments[2] + literal_list['language'] = language toggle.append(literal_list) - header.append(nodes.paragraph(text="code")) + header.append(nodes.raw(text=f"

code     view on GitHub

", format='html')) if env.app.tags.has('html'): node_list.append(paragraph_node) node_list.append(toggle) @@ -38,8 +41,7 @@ class LvExample(Directive): def setup(app): app.add_directive("lv_example", LvExample) - app.add_config_value("example_commit_hash", "", "env") - app.add_config_value("built_example_commit_hash", "", "env") + app.add_config_value("repo_commit_hash", "", "env") return { 'version': '0.1', diff --git a/docs/_templates/page.html b/docs/_templates/page.html index 020e39dc5..9ceaae358 100644 --- a/docs/_templates/page.html +++ b/docs/_templates/page.html @@ -29,7 +29,9 @@ function add_version_selector() p.innerHTML = ` ` + p.innerHTML; diff --git a/docs/conf.py b/docs/conf.py index 20b775892..d0e532d3f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -224,6 +224,9 @@ StandaloneHTMLBuilder.supported_image_types = [ smartquotes = False +_, repo_commit_hash = subprocess.getstatusoutput("git rev-parse HEAD") + + # Example configuration for intersphinx: refer to the Python standard library. def setup(app): diff --git a/lv_conf_template.h b/lv_conf_template.h index 0632cb017..36a380cba 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -27,7 +27,7 @@ #define LV_COLOR_16_SWAP 0 /*Enable more complex drawing routines to manage screens transparency. - *Can be used if the UI is above an other layer, e.g. an OSD menu or video player. + *Can be used if the UI is above another layer, e.g. an OSD menu or video player. *Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/ #define LV_COLOR_SCREEN_TRANSP 0