diff --git a/CHANGELOG.md b/CHANGELOG.md index 410b00e9..c21124bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - New outputs: - KiCad netlist generation - IPC-D-356 netlist generation (#197) +- Pattern and text variables expansion on internal BoM title (#198) ### Fixed - Already configured outputs not created (i.e. when creating reports) diff --git a/kibot/out_bom.py b/kibot/out_bom.py index 6eaaa399..57d35ca3 100644 --- a/kibot/out_bom.py +++ b/kibot/out_bom.py @@ -39,7 +39,7 @@ DEFAULT_ALIASES = [['r', 'r_small', 'res', 'resistor'], ] RegDependency.register(ToolDependency('bom', 'KiCost', URL_KICOST, url_down=URL_KICOST+'/releases', in_debian=False, roles=ToolDependencyRole(desc='Find components costs and specs', version=(1, 1, 8)))) -RegDependency.register(ToolDependency('bom', 'xlsxwriter', is_python=True, +RegDependency.register(ToolDependency('bom', 'XLSXWriter', is_python=True, roles=ToolDependencyRole(desc='Create XLSX files'))) @@ -600,6 +600,12 @@ class BoMOptions(BaseOptions): # If no options get the defaults self.xlsx = BoMXLSX() self.xlsx.config(self) + # Do title %X and ${var} expansions on the BoMLinkable titles + # Here because some variables needs our parent + if self.format == 'html' and self.html.title: + self.html.title = self.expand_filename_both(self.html.title, make_safe=False) + if self.format == 'xlsx' and self.xlsx.title: + self.xlsx.title = self.expand_filename_both(self.xlsx.title, make_safe=False) # group_fields if isinstance(self.group_fields, type): self.group_fields = GroupFields.get_default() diff --git a/tests/yaml_samples/int_bom_simple_html_3.kibot.yaml b/tests/yaml_samples/int_bom_simple_html_3.kibot.yaml index dca10eb4..b961dcf1 100644 --- a/tests/yaml_samples/int_bom_simple_html_3.kibot.yaml +++ b/tests/yaml_samples/int_bom_simple_html_3.kibot.yaml @@ -10,4 +10,5 @@ outputs: options: html: logo: false + title: "%f BOM" style: 'modern-green' diff --git a/tests/yaml_samples/int_bom_simple_xlsx_3.kibot.yaml b/tests/yaml_samples/int_bom_simple_xlsx_3.kibot.yaml index e00c7278..1c15601e 100644 --- a/tests/yaml_samples/int_bom_simple_xlsx_3.kibot.yaml +++ b/tests/yaml_samples/int_bom_simple_xlsx_3.kibot.yaml @@ -10,4 +10,5 @@ outputs: options: format: XLSX xlsx: + title: "%f BOM" logo: false diff --git a/tests/yaml_samples/report_simple_2.kibot.yaml b/tests/yaml_samples/report_simple_2.kibot.yaml index 56258783..b34b3f6b 100644 --- a/tests/yaml_samples/report_simple_2.kibot.yaml +++ b/tests/yaml_samples/report_simple_2.kibot.yaml @@ -22,7 +22,7 @@ outputs: dir: Layers output_id: -front options: - title: 'Fake title for front copper and silk' + title: 'Fake title for front copper and silk (%f)' pages: - scaling: 2.0 layers: