diff --git a/.gitignore b/.gitignore index 70b1a3fa9..ebdfb3f26 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ scripts/cppcheck_res.txt scripts/built_in_font/lv_font_* docs/doxygen_html docs/xml +docs/out_latex +docs/_static/built_lv_examples +docs/LVGL.pdf out_html __pycache__ /emscripten_builder diff --git a/docs/_ext/lv_example.py b/docs/_ext/lv_example.py index 9e0cde96a..4e5557d44 100644 --- a/docs/_ext/lv_example.py +++ b/docs/_ext/lv_example.py @@ -16,16 +16,19 @@ class LvExample(Directive): if self.arguments[2] == 'py': paragraph_node = nodes.raw(text=f"Click to try in the simulator!
{example_name}", format='html') else: - paragraph_node = nodes.raw(text=f"", format='html') + paragraph_node = nodes.raw(text=f"", format='html') toggle = nodes.container('', literal_block=False, classes=['toggle']) header = nodes.container('', literal_block=False, classes=['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: - contents = f.read() - literal_list = nodes.literal_block(contents, contents) - literal_list['language'] = self.arguments[2] + try: + with open(example_file) as f: + contents = f.read() + 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) header.append(nodes.paragraph(text="code")) if env.app.tags.has('html'): diff --git a/docs/build.py b/docs/build.py index 3919be80c..a1db5c1a1 100755 --- a/docs/build.py +++ b/docs/build.py @@ -57,12 +57,12 @@ cmd("cd ../scripts && doxygen Doxyfile") # 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("sphinx-build -b latex . en/latex") +cmd("sphinx-build -b latex . out_latex") -# Generat PDF -#cmd("cd " + lang + "/latex && xelatex -interaction=batchmode *.tex") -# Copy the result PDF to the main diractory to make it avaiable for the HTML build -#cmd("cd " + lang + "/latex && cp -f LVGL.pdf ../../LVGL.pdf") +# Generate PDF +cmd("cd out_latex && xelatex -interaction=batchmode *.tex") +# Copy the result PDF to the main directory to make it avaiable for the HTML build +cmd("cd out_latex && cp -f LVGL.pdf ../LVGL.pdf") # BULD HTML cmd("sphinx-build -b html . ../out_html") diff --git a/docs/conf.py b/docs/conf.py index e8bda51ee..ab2ad52e2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,7 +43,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx_markdown_tables', 'breathe', 'sphinx_sitemap', - #'lv_example' + 'lv_example' ] # Add any paths that contain templates here, relative to this directory. @@ -67,7 +67,7 @@ master_doc = 'index' # General information about the project. project = 'LVGL' 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 # |version| and |release|, also used in various other places throughout the @@ -169,8 +169,6 @@ latex_elements = { 'preamble': r''' \usepackage{fontspec} \setmonofont{DejaVu Sans Mono} -\usepackage{xeCJK} -\setCJKmainfont{SimSun} \usepackage{silence} \WarningsOff* ''', @@ -181,7 +179,7 @@ latex_elements = { # author, documentclass [howto, manual, or own class]). latex_documents = [ (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_stylesheet('css/custom.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) - """ diff --git a/docs/index.md b/docs/index.md index 0f8e3845f..8f540e71b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,6 +3,11 @@ :github_url: |github_link_base|/index.md ``` +```eval_rst + +PDF version: :download:`LVGL.pdf ` +``` + # Welcome to the documentation of LVGL! diff --git a/examples/widgets/arc/index.rst b/examples/widgets/arc/index.rst index 8c8474555..ef4b5d5b9 100644 --- a/examples/widgets/arc/index.rst +++ b/examples/widgets/arc/index.rst @@ -4,13 +4,13 @@ C Simple Arc """""""""""""""" -.. lv_example:: widgets/arc/lv_arc_example_1 +.. lv_example:: widgets/arc/lv_example_arc_1 :language: c Loader with Arc """""""""""""""" -.. lv_example:: widgets/arc/lv_arc_example_2 +.. lv_example:: widgets/arc/lv_example_arc_2 :language: c MicroPython