aboutsummaryrefslogtreecommitdiff
path: root/src/ee/templates
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/templates')
-rw-r--r--src/ee/templates/bom.rst.j289
1 files changed, 89 insertions, 0 deletions
diff --git a/src/ee/templates/bom.rst.j2 b/src/ee/templates/bom.rst.j2
new file mode 100644
index 0000000..3463d90
--- /dev/null
+++ b/src/ee/templates/bom.rst.j2
@@ -0,0 +1,89 @@
+{% set bom_part_uri_idx = bom_parts.index("uri") -%}
+BOM
+===
+
+{% if unresolved_parts %}
+Unresolved parts:
+{% for op in unresolved_parts %}
+* `{{ op.ref }} <ref-{{ op.ref }}_>`_
+{%- endfor %}
+{%- endif %}
+
+Parts for BOM
+===============
+{% for op in bom_parts %}
+.. _ref-{{ op.ref }}:
+
+{{ op.ref | subsection }}
+{% if op.available_from|length == 0 %}
+Could not find part.
+
+{% if op.part.get_mpns()|length == 1 -%}
+MPN: {{ op.part.get_mpns()[0].valueProp }}
+{% elif op.part.get_mpns()|length > 1 -%}
+{%- for mpn in op.part.get_mpns() %}
+MPNs:
+* {{ mpn.valueProp }}
+{%- endfor %}
+{%- endif -%}
+{% if op.part.get_spns()|length == 1 -%}
+SPN: {{ op.part.get_spns()[0].valueProp }}
+{% elif op.part.get_spns()|length > 1 -%}
+{%- for spn in op.part.get_spns() %}
+SPNs:
+* {{ spn.valueProp }}
+{%- endfor %}
+{%- endif -%}
+
+{% elif op.available_from|length == 1 %}
+{%- set part=op.available_from.values()|first %}
+{%- set pn=part|first_pn %}
+{%- set spn=part|first_spn %}
+Selected supplier: {{ part.supplier }}{{ (", pn: " + pn.valueProp) if pn else "" }}{{ (", spn: " + spn.valueProp) if spn else "" }}.
+Part: `{{pn.valueProp}} <part-{{pn.valueProp}}_>`_
+{% else %}
+MANY
+{% endif %}
+{%- endfor %}
+
+Part details
+============
+{%- set part_by_uri=supplier_parts.index("uri") %}
+{% for supplier, partUris in bom_parts.index("supplier,part").items() %}
+{{ ("From " + supplier) | subsection }}
+{% for partUri in partUris %}
+{%- set part=part_by_uri.get_single(partUri) %}
+{%- set pn=part|first_pn %}
+{%- set spn=part|first_spn %}
+{%- set title=pn.valueProp if pn else (spn.valueProp if spn else "???") %}
+.. _part-{{title}}:
+
+{{ title|subsubsection }}
+
+=========== ===
+{%- if part.description %}
+Description {{ part.description }}
+{%- endif %}
+MPN {{ pn.value }}
+SPN {{ spn.value }}
+Used by: {% for op in bom_part_uri_idx.get(part.uriProp) %}`{{ op.ref }} <ref-{{ op.ref }}_>`_{{ ", " if not loop.last }}{% endfor %}
+=========== ===
+{#
+Facts
+.....
+
+{% for f in part.facts.fact %}
+f={{f}}
+{% endfor %}
+
+#}
+Documentation
+.............
+
+{% for l in part.get_links() %}
+{%- if l.relationProp == "http://purl.org/ee/link-relation#documentation" %}
+* `{{ l.title }} <{{ l.url }}>`__
+{%- endif %}
+{%- endfor %}
+{% endfor %}
+{% endfor %}