From 78419dd7b970a4477134e9ab21a11839392ae957 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 12:49:33 +0530 Subject: [PATCH 01/14] Fix PDF build error --- _templates/pdf.html | 6 +++--- conf.py | 28 +++++++++++++++------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/_templates/pdf.html b/_templates/pdf.html index 697c7a69..77a2cc39 100644 --- a/_templates/pdf.html +++ b/_templates/pdf.html @@ -1,6 +1,6 @@ -{% for hardware_part_path in hardware_part_paths %} - {% if hardware_part_path+'/' in pagename %} - {% set pdf_name = hardware_part_path.split('/')[-1] %} +{% for pdf_path in pdf_paths %} + {% if pdf_path+'/' in pagename %} + {% set pdf_name = pdf_path.split('/')[-1] %} Download PDF diff --git a/conf.py b/conf.py index 0cf02c26..4f83d246 100644 --- a/conf.py +++ b/conf.py @@ -19,15 +19,17 @@ copyright = '2024, Upside Down Labs' author = 'Upside Down Labs' -# Hardware structure names -hardware_part_paths = [] -for (hardware_dirpath, hardware_dirnames, hardware_filenames) in os.walk("hardware"): - for hardware_dirname in hardware_dirnames: - for (part_dirpath, part_dirnames, part_filenames) in os.walk(hardware_dirpath+'/'+hardware_dirname): - for part_dirname in part_dirnames: - hardware_part_paths.append(part_dirpath+'/'+part_dirname) - break - break +# PDF path exploration + +MAX_DEPTH = 1 +walk_paths = ['hardware/bioamp'] +pdf_paths = [] +for walk_path in walk_paths: + for (dirpath, dirnames, filenames) in os.walk(walk_path, topdown=True): + for dirname in dirnames: + pdf_paths.append(dirpath+'/'+dirname) + if dirpath.count(os.sep) - walk_path.count(os.sep) == MAX_DEPTH - 1: + del dirnames[:] # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -153,12 +155,12 @@ "edit_page_url_template": "{{ my_vcs_site }}{{ file_name }}", "edit_page_provider_name": "GitHub", "my_vcs_site": "https://github.com/upsidedownlabs/upsidedownlabs.github.io/edit/main", - "hardware_part_paths": hardware_part_paths + "pdf_paths": pdf_paths } # -- Options for LaTeX output -- latex_documents = [] -for hardware_part_path in hardware_part_paths: - board_tex_name = hardware_part_path.split('/')[-1] - latex_documents.append((hardware_part_path+"/index", board_tex_name+".tex", "", author, "manual")) \ No newline at end of file +for pdf_path in pdf_paths: + board_tex_name = pdf_path.split('/')[-1] + latex_documents.append((pdf_path+"/index", board_tex_name+".tex", "", author, "manual")) \ No newline at end of file From bdb9fb60e454350cf3e370eea7a617354eff20a1 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 12:56:52 +0530 Subject: [PATCH 02/14] WIP: fix template error --- conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf.py b/conf.py index 4f83d246..71e8b89b 100644 --- a/conf.py +++ b/conf.py @@ -15,10 +15,6 @@ sys.path.append(str(Path(".").resolve())) -project = 'upsidedownlabs.github.io' -copyright = '2024, Upside Down Labs' -author = 'Upside Down Labs' - # PDF path exploration MAX_DEPTH = 1 @@ -31,6 +27,10 @@ if dirpath.count(os.sep) - walk_path.count(os.sep) == MAX_DEPTH - 1: del dirnames[:] +project = 'upsidedownlabs.github.io' +copyright = '2024, Upside Down Labs' +author = 'Upside Down Labs' + # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration From dd3ccba7bff8b028a07c5f478105d8b90565be38 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 13:19:10 +0530 Subject: [PATCH 03/14] WIP: fix dict exception --- conf.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/conf.py b/conf.py index 71e8b89b..7236e89e 100644 --- a/conf.py +++ b/conf.py @@ -15,21 +15,25 @@ sys.path.append(str(Path(".").resolve())) +project = 'upsidedownlabs.github.io' +copyright = '2024, Upside Down Labs' +author = 'Upside Down Labs' + # PDF path exploration MAX_DEPTH = 1 -walk_paths = ['hardware/bioamp'] +walk_dirpaths = ['hardware/bioamp'] pdf_paths = [] -for walk_path in walk_paths: - for (dirpath, dirnames, filenames) in os.walk(walk_path, topdown=True): - for dirname in dirnames: - pdf_paths.append(dirpath+'/'+dirname) - if dirpath.count(os.sep) - walk_path.count(os.sep) == MAX_DEPTH - 1: - del dirnames[:] -project = 'upsidedownlabs.github.io' -copyright = '2024, Upside Down Labs' -author = 'Upside Down Labs' +for walk_dirpath in walk_dirpaths: + + walk_dirnames = [] + for (dirpath, dirnames, filenames) in os.walk(walk_dirpath, topdown=True): + walk_dirnames = dirnames + break + + for walk_dirname in walk_dirnames: + pdf_paths.append(walk_dirpath+'/'+walk_dirname) # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration From d7dada7d3e910a83e6abf486ba17e95c35f41149 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 13:28:07 +0530 Subject: [PATCH 04/14] WIP: Check build exception cause --- conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.py b/conf.py index 7236e89e..6b064faa 100644 --- a/conf.py +++ b/conf.py @@ -141,7 +141,7 @@ "footer_end": ["last-updated"], # "content_footer_items": ["last-updated"], "secondary_sidebar_items": { - "**": ["page-toc", "edit-this-page", "sourcelink","pdf"] + "**": ["page-toc", "edit-this-page", "sourcelink"] } } From 8f7d5b10ae89f7abe6c74e2af03cba15a7e95962 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 13:33:04 +0530 Subject: [PATCH 05/14] WIP: fix build error --- conf.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/conf.py b/conf.py index 6b064faa..ec0e8257 100644 --- a/conf.py +++ b/conf.py @@ -24,16 +24,10 @@ MAX_DEPTH = 1 walk_dirpaths = ['hardware/bioamp'] pdf_paths = [] - for walk_dirpath in walk_dirpaths: - - walk_dirnames = [] for (dirpath, dirnames, filenames) in os.walk(walk_dirpath, topdown=True): - walk_dirnames = dirnames - break - - for walk_dirname in walk_dirnames: - pdf_paths.append(walk_dirpath+'/'+walk_dirname) + if dirpath.count('/') == 2: + pdf_paths.append(dirpath) # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration From 08a5cc6467dae0d98a8bb75f300e3df932eae9aa Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 13:39:35 +0530 Subject: [PATCH 06/14] WIP: find error cause --- conf.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/conf.py b/conf.py index ec0e8257..93ce2e0e 100644 --- a/conf.py +++ b/conf.py @@ -20,14 +20,15 @@ author = 'Upside Down Labs' # PDF path exploration - -MAX_DEPTH = 1 +MAX_DEPTH = 2 walk_dirpaths = ['hardware/bioamp'] pdf_paths = [] for walk_dirpath in walk_dirpaths: for (dirpath, dirnames, filenames) in os.walk(walk_dirpath, topdown=True): - if dirpath.count('/') == 2: - pdf_paths.append(dirpath) + if dirpath.count('/') == MAX_DEPTH: + pdf_paths.append(dirpath[:]) + +print(pdf_paths) # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration From cc2df247e7056ec4b98888ebabb35ffa9c4d61dd Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 13:46:32 +0530 Subject: [PATCH 07/14] WIP: find error root cause --- conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf.py b/conf.py index 93ce2e0e..9c91ab50 100644 --- a/conf.py +++ b/conf.py @@ -154,12 +154,12 @@ "edit_page_url_template": "{{ my_vcs_site }}{{ file_name }}", "edit_page_provider_name": "GitHub", "my_vcs_site": "https://github.com/upsidedownlabs/upsidedownlabs.github.io/edit/main", - "pdf_paths": pdf_paths + # "pdf_paths": pdf_paths } # -- Options for LaTeX output -- latex_documents = [] -for pdf_path in pdf_paths: - board_tex_name = pdf_path.split('/')[-1] - latex_documents.append((pdf_path+"/index", board_tex_name+".tex", "", author, "manual")) \ No newline at end of file +# for pdf_path in pdf_paths: +# board_tex_name = pdf_path.split('/')[-1] +# latex_documents.append((pdf_path+"/index", board_tex_name+".tex", "", author, "manual")) \ No newline at end of file From 3eee278bda5b473e26a20f93f880531ee339b135 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 13:50:54 +0530 Subject: [PATCH 08/14] WIP: fix exception root cause --- conf.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/conf.py b/conf.py index 9c91ab50..b24b4c91 100644 --- a/conf.py +++ b/conf.py @@ -11,7 +11,6 @@ from pathlib import Path from typing import Any, Dict import pydata_sphinx_theme -from sphinx.application import Sphinx sys.path.append(str(Path(".").resolve())) @@ -20,15 +19,15 @@ author = 'Upside Down Labs' # PDF path exploration -MAX_DEPTH = 2 -walk_dirpaths = ['hardware/bioamp'] -pdf_paths = [] -for walk_dirpath in walk_dirpaths: - for (dirpath, dirnames, filenames) in os.walk(walk_dirpath, topdown=True): - if dirpath.count('/') == MAX_DEPTH: - pdf_paths.append(dirpath[:]) - -print(pdf_paths) +# MAX_DEPTH = 2 +# walk_dirpaths = ['hardware/bioamp'] +# pdf_paths = [] +# for walk_dirpath in walk_dirpaths: +# for (dirpath, dirnames, filenames) in os.walk(walk_dirpath, topdown=True): +# if dirpath.count('/') == MAX_DEPTH: +# pdf_paths.append(dirpath[:]) + +# print(pdf_paths) # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration From 1943b56edbb8b30ee721cf154b1d0c9906ed8f48 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 13:55:20 +0530 Subject: [PATCH 09/14] WIP: fix error --- conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf.py b/conf.py index b24b4c91..cc0e08f3 100644 --- a/conf.py +++ b/conf.py @@ -58,9 +58,9 @@ # Pages entry without primary (left) sidebar -html_sidebars = { - "ideas/index": [], -} +# html_sidebars = { + +# } html_theme_options = { "external_links": [ From 3e4cd9a275f78c6ad561c48c45f20de90b3c9f21 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 14:00:44 +0530 Subject: [PATCH 10/14] WIP: undo changes --- conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf.py b/conf.py index cc0e08f3..2cd508f2 100644 --- a/conf.py +++ b/conf.py @@ -84,7 +84,7 @@ "url": "https://store.upsidedownlabs.tech/", "name": "Store India", }, -{ + { "url": "https://t.ly/ExlaF", "name": "GeM India", } @@ -134,9 +134,9 @@ "footer_start": ["copyright"], "footer_end": ["last-updated"], # "content_footer_items": ["last-updated"], - "secondary_sidebar_items": { - "**": ["page-toc", "edit-this-page", "sourcelink"] - } + # "secondary_sidebar_items": { + # "**": ["page-toc", "edit-this-page", "sourcelink"] + # } } html_context = { From a1d4125f1a0bf886a2997ccd5e5309473e073152 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 14:03:21 +0530 Subject: [PATCH 11/14] WIP: add PDF build options --- conf.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/conf.py b/conf.py index 2cd508f2..e7be6400 100644 --- a/conf.py +++ b/conf.py @@ -19,15 +19,15 @@ author = 'Upside Down Labs' # PDF path exploration -# MAX_DEPTH = 2 -# walk_dirpaths = ['hardware/bioamp'] -# pdf_paths = [] -# for walk_dirpath in walk_dirpaths: -# for (dirpath, dirnames, filenames) in os.walk(walk_dirpath, topdown=True): -# if dirpath.count('/') == MAX_DEPTH: -# pdf_paths.append(dirpath[:]) +MAX_DEPTH = 2 +walk_dirpaths = ['hardware/bioamp'] +pdf_paths = [] +for walk_dirpath in walk_dirpaths: + for (dirpath, dirnames, filenames) in os.walk(walk_dirpath, topdown=True): + if dirpath.count('/') == MAX_DEPTH: + pdf_paths.append(dirpath[:]) -# print(pdf_paths) +print(pdf_paths) # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -153,12 +153,12 @@ "edit_page_url_template": "{{ my_vcs_site }}{{ file_name }}", "edit_page_provider_name": "GitHub", "my_vcs_site": "https://github.com/upsidedownlabs/upsidedownlabs.github.io/edit/main", - # "pdf_paths": pdf_paths + "pdf_paths": pdf_paths } # -- Options for LaTeX output -- latex_documents = [] -# for pdf_path in pdf_paths: -# board_tex_name = pdf_path.split('/')[-1] -# latex_documents.append((pdf_path+"/index", board_tex_name+".tex", "", author, "manual")) \ No newline at end of file +for pdf_path in pdf_paths: + board_tex_name = pdf_path.split('/')[-1] + latex_documents.append((pdf_path+"/index", board_tex_name+".tex", "", author, "manual")) \ No newline at end of file From e513d1c2f2eba94a60d6698bd4aeaff1641f1ee0 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 14:14:04 +0530 Subject: [PATCH 12/14] WIP: Add PDF download link --- conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf.py b/conf.py index e7be6400..999b2fc7 100644 --- a/conf.py +++ b/conf.py @@ -124,7 +124,7 @@ "use_edit_page_button": True, "show_toc_level": 1, "navbar_align": "right", - "show_nav_level": 2, + "show_nav_level": 1, "announcement": "Welcome to Upside Down Labs docs site!", # "show_version_warning_banner": True, "navbar_center": ["navbar-nav"], @@ -134,9 +134,9 @@ "footer_start": ["copyright"], "footer_end": ["last-updated"], # "content_footer_items": ["last-updated"], - # "secondary_sidebar_items": { - # "**": ["page-toc", "edit-this-page", "sourcelink"] - # } + "secondary_sidebar_items": { + "**": ["page-toc", "edit-this-page", "sourcelink","pdf"] + }, } html_context = { From b4dc1d76fb85db530ea0aec18261519e24df9d3a Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 14:17:12 +0530 Subject: [PATCH 13/14] Update sphinx pydata theme version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 85a6759b..de07cc88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ docutils==0.20.1 -pydata-sphinx-theme==0.14.4 +pydata-sphinx-theme==0.15.2 sphinx_design==0.5.0 sphinxcontrib-youtube==1.4.1 sphinx-copybutton==0.5.2 \ No newline at end of file From b8d5484648a0a1cce74f65577332012b1a371591 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Fri, 29 Mar 2024 14:36:30 +0530 Subject: [PATCH 14/14] Fix PDF download link --- _templates/pdf.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_templates/pdf.html b/_templates/pdf.html index 77a2cc39..828c3bd2 100644 --- a/_templates/pdf.html +++ b/_templates/pdf.html @@ -1,7 +1,7 @@ {% for pdf_path in pdf_paths %} {% if pdf_path+'/' in pagename %} {% set pdf_name = pdf_path.split('/')[-1] %} - + Download PDF {% endif %}