mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-28 13:36:27 +08:00
docs(all) add live example for arc and PDF build
This commit is contained in:
@@ -8,6 +8,9 @@ scripts/cppcheck_res.txt
|
|||||||
scripts/built_in_font/lv_font_*
|
scripts/built_in_font/lv_font_*
|
||||||
docs/doxygen_html
|
docs/doxygen_html
|
||||||
docs/xml
|
docs/xml
|
||||||
|
docs/out_latex
|
||||||
|
docs/_static/built_lv_examples
|
||||||
|
docs/LVGL.pdf
|
||||||
out_html
|
out_html
|
||||||
__pycache__
|
__pycache__
|
||||||
/emscripten_builder
|
/emscripten_builder
|
||||||
|
|||||||
@@ -16,16 +16,19 @@ class LvExample(Directive):
|
|||||||
if self.arguments[2] == 'py':
|
if self.arguments[2] == 'py':
|
||||||
paragraph_node = nodes.raw(text=f"Click to try in the simulator!<br/><a target='_blank' href='https://sim.lvgl.io/v7/micropython/ports/javascript/bundle_out/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.example_commit_hash}/src/header.py&script=https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.built_example_commit_hash}/{example_name}/{example_name}.py'><img alt='{example_name}' src='https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.built_example_commit_hash}/{example_name}/{example_name}.png'/></a>", format='html')
|
paragraph_node = nodes.raw(text=f"Click to try in the simulator!<br/><a target='_blank' href='https://sim.lvgl.io/v7/micropython/ports/javascript/bundle_out/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.example_commit_hash}/src/header.py&script=https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.built_example_commit_hash}/{example_name}/{example_name}.py'><img alt='{example_name}' src='https://raw.githubusercontent.com/lvgl/lv_examples/{env.config.built_example_commit_hash}/{example_name}/{example_name}.png'/></a>", format='html')
|
||||||
else:
|
else:
|
||||||
paragraph_node = nodes.raw(text=f"<iframe class='lv-example' src='../_static/built_lv_examples/{example_name}/?w=320&h=240'></iframe>", format='html')
|
paragraph_node = nodes.raw(text=f"<iframe class='lv-example' src='../../_static/built_lv_examples?example={example_name}&w=320&h=240'></iframe>", format='html')
|
||||||
toggle = nodes.container('', literal_block=False, classes=['toggle'])
|
toggle = nodes.container('', literal_block=False, classes=['toggle'])
|
||||||
header = nodes.container('', literal_block=False, classes=['header'])
|
header = nodes.container('', literal_block=False, classes=['header'])
|
||||||
toggle.append(header)
|
toggle.append(header)
|
||||||
example_file = os.path.abspath("lv_examples/src/" + example_path + "." + self.arguments[2])
|
example_file = os.path.abspath("../examples/" + example_path + "." + self.arguments[2])
|
||||||
|
|
||||||
with open(example_file) as f:
|
try:
|
||||||
contents = f.read()
|
with open(example_file) as f:
|
||||||
literal_list = nodes.literal_block(contents, contents)
|
contents = f.read()
|
||||||
literal_list['language'] = self.arguments[2]
|
except FileNotFoundError:
|
||||||
|
contents = 'Error encountered while trying to open ' + example_file
|
||||||
|
literal_list = nodes.literal_block(contents, contents)
|
||||||
|
literal_list['language'] = self.arguments[2]
|
||||||
toggle.append(literal_list)
|
toggle.append(literal_list)
|
||||||
header.append(nodes.paragraph(text="code"))
|
header.append(nodes.paragraph(text="code"))
|
||||||
if env.app.tags.has('html'):
|
if env.app.tags.has('html'):
|
||||||
|
|||||||
+5
-5
@@ -57,12 +57,12 @@ cmd("cd ../scripts && doxygen Doxyfile")
|
|||||||
|
|
||||||
# Silly workarond to include the more or less correct PDF download link in the PDF
|
# Silly workarond to include the more or less correct PDF download link in the PDF
|
||||||
#cmd("cp -f " + lang +"/latex/LVGL.pdf LVGL.pdf | true")
|
#cmd("cp -f " + lang +"/latex/LVGL.pdf LVGL.pdf | true")
|
||||||
#cmd("sphinx-build -b latex . en/latex")
|
cmd("sphinx-build -b latex . out_latex")
|
||||||
|
|
||||||
# Generat PDF
|
# Generate PDF
|
||||||
#cmd("cd " + lang + "/latex && xelatex -interaction=batchmode *.tex")
|
cmd("cd out_latex && xelatex -interaction=batchmode *.tex")
|
||||||
# Copy the result PDF to the main diractory to make it avaiable for the HTML build
|
# Copy the result PDF to the main directory to make it avaiable for the HTML build
|
||||||
#cmd("cd " + lang + "/latex && cp -f LVGL.pdf ../../LVGL.pdf")
|
cmd("cd out_latex && cp -f LVGL.pdf ../LVGL.pdf")
|
||||||
|
|
||||||
# BULD HTML
|
# BULD HTML
|
||||||
cmd("sphinx-build -b html . ../out_html")
|
cmd("sphinx-build -b html . ../out_html")
|
||||||
|
|||||||
+3
-30
@@ -43,7 +43,7 @@ extensions = ['sphinx.ext.autodoc',
|
|||||||
'sphinx_markdown_tables',
|
'sphinx_markdown_tables',
|
||||||
'breathe',
|
'breathe',
|
||||||
'sphinx_sitemap',
|
'sphinx_sitemap',
|
||||||
#'lv_example'
|
'lv_example'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
@@ -67,7 +67,7 @@ master_doc = 'index'
|
|||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = 'LVGL'
|
project = 'LVGL'
|
||||||
copyright = '2020, LVGL LLC'
|
copyright = '2020, LVGL LLC'
|
||||||
author = 'The community of LVGL'
|
author = 'LVGL community'
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
@@ -169,8 +169,6 @@ latex_elements = {
|
|||||||
'preamble': r'''
|
'preamble': r'''
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
\setmonofont{DejaVu Sans Mono}
|
\setmonofont{DejaVu Sans Mono}
|
||||||
\usepackage{xeCJK}
|
|
||||||
\setCJKmainfont{SimSun}
|
|
||||||
\usepackage{silence}
|
\usepackage{silence}
|
||||||
\WarningsOff*
|
\WarningsOff*
|
||||||
''',
|
''',
|
||||||
@@ -181,7 +179,7 @@ latex_elements = {
|
|||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
(master_doc, 'LVGL.tex', 'LVGL Documentation ' + version,
|
(master_doc, 'LVGL.tex', 'LVGL Documentation ' + version,
|
||||||
'Contributors of LVGL', 'manual'),
|
'LVGL community', 'manual'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -230,28 +228,3 @@ def setup(app):
|
|||||||
app.add_transform(AutoStructify)
|
app.add_transform(AutoStructify)
|
||||||
app.add_stylesheet('css/custom.css')
|
app.add_stylesheet('css/custom.css')
|
||||||
app.add_stylesheet('css/fontawesome.min.css')
|
app.add_stylesheet('css/fontawesome.min.css')
|
||||||
|
|
||||||
# Attempt to checkout _static/built_lv_examples
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
if not os.path.exists('_static/built_lv_examples'):
|
|
||||||
os.system('git clone https://github.com/lvgl/lv_examples.git _static/built_lv_examples')
|
|
||||||
|
|
||||||
os.system('git -C _static/built_lv_examples fetch origin')
|
|
||||||
|
|
||||||
out = subprocess.Popen(["git", "-C", "lv_examples", "rev-parse", "HEAD"],
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT)
|
|
||||||
stdout,stderr = out.communicate()
|
|
||||||
example_commit_hash = stdout.decode("utf-8").strip()
|
|
||||||
|
|
||||||
search_command = ["git", "-C", "_static/built_lv_examples", "--no-pager", "log", "--pretty=format:'%H'", "--all", "-n", "1", f"--grep='Deploying to gh-pages from @ {example_commit_hash}'"]
|
|
||||||
log_output = subprocess.check_output(' '.join(search_command), shell=True).strip().decode("utf-8")
|
|
||||||
if len(log_output) == 0:
|
|
||||||
raise ValueError('lv_examples: cannot find corresponding deployed commit: ' + example_commit_hash)
|
|
||||||
|
|
||||||
built_example_commit_hash = log_output
|
|
||||||
os.system('git -C _static/built_lv_examples reset --hard')
|
|
||||||
os.system('git -C _static/built_lv_examples checkout ' + log_output)
|
|
||||||
"""
|
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
:github_url: |github_link_base|/index.md
|
:github_url: |github_link_base|/index.md
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```eval_rst
|
||||||
|
|
||||||
|
PDF version: :download:`LVGL.pdf <LVGL.pdf>`
|
||||||
|
```
|
||||||
|
|
||||||
# Welcome to the documentation of LVGL!
|
# Welcome to the documentation of LVGL!
|
||||||
|
|
||||||
<img src="_static/img/home_banner.jpg" style="width:100%">
|
<img src="_static/img/home_banner.jpg" style="width:100%">
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ C
|
|||||||
Simple Arc
|
Simple Arc
|
||||||
""""""""""""""""
|
""""""""""""""""
|
||||||
|
|
||||||
.. lv_example:: widgets/arc/lv_arc_example_1
|
.. lv_example:: widgets/arc/lv_example_arc_1
|
||||||
:language: c
|
:language: c
|
||||||
|
|
||||||
Loader with Arc
|
Loader with Arc
|
||||||
""""""""""""""""
|
""""""""""""""""
|
||||||
|
|
||||||
.. lv_example:: widgets/arc/lv_arc_example_2
|
.. lv_example:: widgets/arc/lv_example_arc_2
|
||||||
:language: c
|
:language: c
|
||||||
|
|
||||||
MicroPython
|
MicroPython
|
||||||
|
|||||||
Reference in New Issue
Block a user