Skip to content

Commit

Permalink
Add PDF download links
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepak Khatri committed Mar 28, 2024
1 parent d351781 commit 7f07336
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
Empty file removed _templates/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions _templates/pdf.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% for hardware_part_path in hardware_part_paths %}
{% if hardware_part_path+'/' in pagename %}
{% set pdf_name = hardware_part_path.split('/')[-1] %}
<a role="button" href="{{docs_url}}/{{pdf_name}}.pdf" target="_blank">
<i class="fa-solid fa-download"></i> Download PDF
</a>
{% endif %}
{% endfor %}
27 changes: 21 additions & 6 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import os
import sys
from pathlib import Path
from typing import Any, Dict
Expand All @@ -18,6 +19,16 @@
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

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

Expand Down Expand Up @@ -123,9 +134,9 @@
"footer_start": ["copyright"],
"footer_end": ["last-updated"],
# "content_footer_items": ["last-updated"],
# "secondary_sidebar_items": {
# "**": ["page-toc", "edit-this-page", "sourcelink","pdf"]
# }
"secondary_sidebar_items": {
"**": ["page-toc", "edit-this-page", "sourcelink","pdf"]
}
}

html_context = {
Expand All @@ -142,8 +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",
"hardware_part_paths": hardware_part_paths
}

latex_documents = [
("bioamp-exg-pill", "bioamp-exg-pill.tex", "BioAmp EXG Pill", author, "manual"),
]
# -- 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"))
2 changes: 1 addition & 1 deletion hardware/bioamp/bioamp-v1.5/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Features & Specifications
+-----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Minimum Input Voltage | 7-9 V |
+-----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Input Impedance | 10^7 ohm |
| Input Impedance | 10^7 ohm |
+-----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Fixed Gain | ~200x |
+-----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down

0 comments on commit 7f07336

Please sign in to comment.