Now makes the build instruction TOC manually because GFM does not implement [TOC]
This commit is contained in:
parent
bdbe6c1ed1
commit
8297dc75ba
|
@ -1,3 +1,4 @@
|
|||
<a name="TOP"/>
|
||||
# MainsBreakOutBox
|
||||
13A socket break out box with 4mm jacks to measure voltage and / or load current and earth leakage current.
|
||||
|
||||
|
@ -17,11 +18,16 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
|||
|
||||
---
|
||||
## Table of Contents
|
||||
[TOC]
|
||||
1. [Parts list](#Parts_list)
|
||||
1. [Base Assembly](#base_assembly)
|
||||
1. [Feet Assembly](#feet_assembly)
|
||||
1. [Mains In Assembly](#mains_in_assembly)
|
||||
1. [Main Assembly](#main_assembly)
|
||||
|
||||
[Top](#mainsbreakoutbox)
|
||||
[Top](#TOP)
|
||||
|
||||
---
|
||||
<a name="Parts_list"/>
|
||||
## Parts list
|
||||
| <span style="writing-mode: vertical-rl; text-orientation: mixed;">Base</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Feet</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Mains In</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Main</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |
|
||||
|--:|--:|--:|--:|--:|:--|
|
||||
|
@ -44,9 +50,11 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
|||
| | | | | | **3D Printed parts** |
|
||||
| . | 4 | . | . | 4 | foot.stl |
|
||||
| 1 | . | . | . | 1 | socket_box.stl |
|
||||
[Top](#mainsbreakoutbox)
|
||||
|
||||
[Top](#TOP)
|
||||
|
||||
---
|
||||
<a name="base_assembly"/>
|
||||
## Base Assembly
|
||||
### Vitamins
|
||||
|Qty|Description|
|
||||
|
@ -70,9 +78,10 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
|||
|
||||
![base_assembled](assemblies/base_assembled_tn.png)
|
||||
|
||||
[Top](#mainsbreakoutbox)
|
||||
[Top](#TOP)
|
||||
|
||||
---
|
||||
<a name="feet_assembly"/>
|
||||
## Feet Assembly
|
||||
### Vitamins
|
||||
|Qty|Description|
|
||||
|
@ -105,9 +114,10 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
|||
|
||||
![feet_assembled](assemblies/feet_assembled_tn.png)
|
||||
|
||||
[Top](#mainsbreakoutbox)
|
||||
[Top](#TOP)
|
||||
|
||||
---
|
||||
<a name="mains_in_assembly"/>
|
||||
## Mains In Assembly
|
||||
### Vitamins
|
||||
|Qty|Description|
|
||||
|
@ -143,9 +153,10 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
|||
|
||||
![mains_in_assembled](assemblies/mains_in_assembled_tn.png)
|
||||
|
||||
[Top](#mainsbreakoutbox)
|
||||
[Top](#TOP)
|
||||
|
||||
---
|
||||
<a name="main_assembly"/>
|
||||
## Main Assembly
|
||||
### Vitamins
|
||||
|Qty|Description|
|
||||
|
@ -185,4 +196,4 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
|||
|
||||
![main_assembled](assemblies/main_assembled_tn.png)
|
||||
|
||||
[Top](#mainsbreakoutbox)
|
||||
[Top](#TOP)
|
||||
|
|
|
@ -65,12 +65,12 @@ def bom_to_assemblies(bom_dir):
|
|||
flat_bom = flat_bom[:-1]
|
||||
return [assembly["name"] for assembly in flat_bom]
|
||||
|
||||
def eop(print_mode, project, doc_file, last = False, first = False):
|
||||
def eop(print_mode, doc_file, last = False, first = False):
|
||||
if print_mode:
|
||||
print('\n<div style="page-break-after: always;"></div>', file = doc_file)
|
||||
else:
|
||||
if not first:
|
||||
print('[Top](#%s)' % project.lower().replace(' ', '-'), file = doc_file)
|
||||
print('[Top](#TOP)', file = doc_file)
|
||||
if not last:
|
||||
print("\n---", file = doc_file)
|
||||
|
||||
|
@ -178,6 +178,7 @@ def views(target, do_assemblies = None):
|
|||
# Title, description and picture
|
||||
#
|
||||
project = ' '.join(word[0].upper() + word[1:] for word in os.path.basename(os.getcwd()).split('_'))
|
||||
print('<a name="TOP"/>', file = doc_file)
|
||||
print('# %s' % project, file = doc_file)
|
||||
main_file = bom.find_scad_file('main_assembly')
|
||||
if not main_file:
|
||||
|
@ -189,16 +190,22 @@ def views(target, do_assemblies = None):
|
|||
if print_mode:
|
||||
print(Fore.MAGENTA + "Missing project description" + Fore.WHITE)
|
||||
print('![Main Assembly](assemblies/%s.png)\n' % flat_bom[-1]["name"].replace('_assembly', '_assembled'), file = doc_file)
|
||||
eop(print_mode, project, doc_file, first = True)
|
||||
eop(print_mode, doc_file, first = True)
|
||||
#
|
||||
# Build TOC
|
||||
#
|
||||
print('## Table of Contents', file = doc_file)
|
||||
print('[TOC]\n', file = doc_file)
|
||||
eop(print_mode, project, doc_file)
|
||||
print('1. [Parts list](#Parts_list)', file = doc_file)
|
||||
for ass in flat_bom:
|
||||
name = ass["name"]
|
||||
cap_name = name.replace('_', ' ').title()
|
||||
print('1. [%s](#%s)' % (cap_name, name), file = doc_file)
|
||||
print(file = doc_file)
|
||||
eop(print_mode, doc_file)
|
||||
#
|
||||
# Global BOM
|
||||
#
|
||||
print('<a name="Parts_list"/>', file = doc_file)
|
||||
print('## Parts list', file = doc_file)
|
||||
vitamins = {}
|
||||
printed = {}
|
||||
|
@ -230,13 +237,16 @@ def views(target, do_assemblies = None):
|
|||
count = ass["printed"][p] if p in ass["printed"] else '.'
|
||||
print('| %s ' % pad(count, 2, 1), file = doc_file, end = '')
|
||||
print('| %s | %s |' % (pad(printed[p], 2, 1), pad(p, 3)), file = doc_file)
|
||||
eop(print_mode, project, doc_file)
|
||||
print(file = doc_file)
|
||||
eop(print_mode, doc_file)
|
||||
#
|
||||
# Assembly instructions
|
||||
#
|
||||
for ass in flat_bom:
|
||||
name = ass["name"]
|
||||
cap_name = name.replace('_', ' ').title()
|
||||
|
||||
print('<a name="%s"/>' % name, file = doc_file)
|
||||
if ass["count"] > 1:
|
||||
print("## %d x %s" % (ass["count"], cap_name), file = doc_file)
|
||||
else:
|
||||
|
@ -311,19 +321,19 @@ def views(target, do_assemblies = None):
|
|||
|
||||
name = name.replace('_assembly', '_assembled')
|
||||
print('![%s](assemblies/%s)\n' % (name, name + suffix), file = doc_file)
|
||||
eop(print_mode, project, doc_file, last = ass == flat_bom[-1] and not main_blurb)
|
||||
eop(print_mode, doc_file, last = ass == flat_bom[-1] and not main_blurb)
|
||||
#
|
||||
# If main module is suppressed print any blurb here
|
||||
#
|
||||
if main_blurb:
|
||||
print(main_blurb, file = doc_file)
|
||||
eop(print_mode, project, doc_file, last = True)
|
||||
eop(print_mode, doc_file, last = True)
|
||||
#
|
||||
# Convert to HTML
|
||||
#
|
||||
html_name = "printme.html" if print_mode else "readme.html"
|
||||
with open(top_dir + html_name, "wt") as html_file:
|
||||
do_cmd(("python -m markdown -x tables -x toc -x sane_lists " + doc_name).split(), html_file)
|
||||
do_cmd(("python -m markdown -x tables -x sane_lists " + doc_name).split(), html_file)
|
||||
#
|
||||
# Spell check
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue