From a83e4f9f13e1f49eb2520ab88d8f31406ef6a3bf Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Mon, 18 Sep 2023 12:19:26 +0200 Subject: [PATCH 1/2] write dynamic length fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Lauser Signed-off-by: Katja Köhler --- .../macros/printDynamicLengthField.xml.jinja2 | 21 +++++++++++++++++++ .../templates/macros/printVariant.xml.jinja2 | 8 +++++++ 2 files changed, 29 insertions(+) create mode 100644 odxtools/templates/macros/printDynamicLengthField.xml.jinja2 diff --git a/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 b/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 new file mode 100644 index 00000000..3a9a3202 --- /dev/null +++ b/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 @@ -0,0 +1,21 @@ +{#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*- + # + # SPDX-License-Identifier: MIT +-#} + +{%- macro printDynamicLengthField(dlf) -%} + + {{dlf.short_name}} + {{dlf.long_name|e}} + + {{dlf.offset}} + + {%- set dni = dlf.determine_number_of_items %} + {{dni.byte_position}} + {%- if dni.bit_position is not none %} + {{dni.bit_position}} + {%- endif %} + + + +{%- endmacro -%} diff --git a/odxtools/templates/macros/printVariant.xml.jinja2 b/odxtools/templates/macros/printVariant.xml.jinja2 index ce938e97..ed74014d 100644 --- a/odxtools/templates/macros/printVariant.xml.jinja2 +++ b/odxtools/templates/macros/printVariant.xml.jinja2 @@ -8,6 +8,7 @@ {%- import('macros/printFunctionalClass.xml.jinja2') as pfc %} {%- import('macros/printStructure.xml.jinja2') as pst %} {%- import('macros/printEndOfPdu.xml.jinja2') as peopdu %} +{%- import('macros/printDynamicLengthField.xml.jinja2') as pdlf %} {%- import('macros/printMux.xml.jinja2') as pm %} {%- import('macros/printEnvData.xml.jinja2') as ped %} {%- import('macros/printEnvDataDesc.xml.jinja2') as pedd %} @@ -72,6 +73,13 @@ {%- endfor %} {%- endif %} + {%- if ddds.dynamic_length_fields %} + + {%- for dlf in ddds.dynamic_length_fields %} + {{ pdlf.printDynamicLengthField(dlf)|indent(3) }} + {%- endfor %} + + {%- endif %} {%- if ddds.end_of_pdu_fields %} {%- for eopdu in ddds.end_of_pdu_fields %} From c39d1e16938195507fa5e450837b1ab8ad39a282 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 19 Sep 2023 15:42:43 +0200 Subject: [PATCH 2/2] centralize writing of the ELEMENT-ID subtags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this simplifies the writing macros because there are quite a few bells and whistles to correctly writing the ELEMENT-ID fields... thanks to [at]kayoub5 for pointing out the inconsistency in the macro for DYNAMIC-LENGTH-FIELD which motivated this. Signed-off-by: Andreas Lauser Signed-off-by: Katja Köhler --- .../templates/macros/printAudience.xml.jinja2 | 12 ++----- .../macros/printCompanyData.xml.jinja2 | 31 +++---------------- .../templates/macros/printComparam.xml.jinja2 | 22 +++---------- odxtools/templates/macros/printDOP.xml.jinja2 | 12 ++----- .../macros/printDynamicLengthField.xml.jinja2 | 5 +-- .../macros/printElementID.xml.jinja2 | 12 +++---- .../templates/macros/printEndOfPdu.xml.jinja2 | 5 +-- .../templates/macros/printEnvData.xml.jinja2 | 4 +-- .../macros/printEnvDataDesc.xml.jinja2 | 5 +-- .../macros/printFunctionalClass.xml.jinja2 | 12 ++----- odxtools/templates/macros/printMux.xml.jinja2 | 11 +++---- .../templates/macros/printParam.xml.jinja2 | 9 ++---- .../templates/macros/printRequest.xml.jinja2 | 11 ++----- .../templates/macros/printResponse.xml.jinja2 | 11 ++----- .../templates/macros/printService.xml.jinja2 | 11 ++----- .../macros/printSpecialData.xml.jinja2 | 2 +- .../templates/macros/printState.xml.jinja2 | 12 ++----- .../macros/printStateChart.xml.jinja2 | 11 ++----- .../macros/printStateTransition.xml.jinja2 | 12 ++----- .../macros/printStructure.xml.jinja2 | 6 ++-- .../templates/macros/printTable.xml.jinja2 | 9 ++---- .../templates/macros/printUnitSpec.xml.jinja2 | 6 ++-- .../templates/macros/printVariant.xml.jinja2 | 11 ++----- 23 files changed, 65 insertions(+), 177 deletions(-) diff --git a/odxtools/templates/macros/printAudience.xml.jinja2 b/odxtools/templates/macros/printAudience.xml.jinja2 index b7918011..6c9e4c16 100644 --- a/odxtools/templates/macros/printAudience.xml.jinja2 +++ b/odxtools/templates/macros/printAudience.xml.jinja2 @@ -3,17 +3,11 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printAdditionalAudience(audience) -%} - {{audience.short_name}} -{%- if audience.long_name %} - {{audience.long_name}} -{%- endif %} -{%- if audience.description is string and audience.description.strip() %} - -{{audience.description}} - -{%- endif %} + {{ peid.printElementID(audience)|indent(1) }} {%- endmacro -%} diff --git a/odxtools/templates/macros/printCompanyData.xml.jinja2 b/odxtools/templates/macros/printCompanyData.xml.jinja2 index 6a0cd90c..32cc1602 100644 --- a/odxtools/templates/macros/printCompanyData.xml.jinja2 +++ b/odxtools/templates/macros/printCompanyData.xml.jinja2 @@ -3,19 +3,12 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printSpecialData.xml.jinja2') as psd %} {%- macro printCompanyData(company_data) -%} - {{company_data.short_name|e}} - {%- if company_data.long_name is not none %} - {{company_data.long_name|e}} - {%- endif %} - {%- if company_data.description is not none %} - -{{company_data.description}} - - {%- endif %} + {{ peid.printElementID(company_data)|indent(1) }} {%- if company_data.roles is not none %} {%- for role in company_data.roles %} @@ -27,15 +20,7 @@ {%- for team_member in company_data.team_members %} - {{team_member.short_name|e}} - {%- if company_data.long_name is not none %} - {{team_member.long_name|e}} - {%- endif %} - {%- if company_data.description is not none %} - -{{team_member.description}} - - {%- endif %} + {{ peid.printElementID(team_member)|indent(3) }} {%- if team_member.roles is not none %} {%- for role in team_member.roles %} @@ -75,15 +60,7 @@ {%- if rd.xdoc is not none %} - {{rd.xdoc.short_name|e}} - {%- if rd.xdoc.long_name is not none %} - {{rd.xdoc.long_name|e}} - {%- endif %} - {%- if rd.xdoc.description is not none %} - -{{rd.xdoc.description}} - - {%- endif %} + {{ peid.printElementID(rd.xdoc)|indent(5) }} {%- if rd.xdoc.number is not none %} {{rd.xdoc.number|e}} {%- endif %} diff --git a/odxtools/templates/macros/printComparam.xml.jinja2 b/odxtools/templates/macros/printComparam.xml.jinja2 index d0e44207..4015eccd 100644 --- a/odxtools/templates/macros/printComparam.xml.jinja2 +++ b/odxtools/templates/macros/printComparam.xml.jinja2 @@ -3,6 +3,8 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printComplexValue(cv) %} {%- for val in cv %} @@ -41,15 +43,7 @@ CPTYPE="{{cp.cptype.value}}" {{make_xml_attrib("DISPLAY-LEVEL", cp.display_level)}} CPUSAGE="{{cp.cpusage.value}}"> - {{cp.short_name}} - {%- if cp.long_name and cp.long_name.strip() %} - {{cp.long_name|e}} - {%- endif %} - {%- if cp.description and cp.description.strip() %} - - {{cp.description}} - - {%- endif %} + {{ peid.printElementID(cp)|indent(1) }} {{cp.physical_default_value}} @@ -63,15 +57,7 @@ CPUSAGE="{{cp.cpusage.value}}" {{make_bool_xml_attrib("ALLOW-MULTIPLE-VALUES", cp.allow_multiple_values_raw)}} {#- #}> - {{cp.short_name}} - {%- if cp.long_name and cp.long_name.strip() %} - {{cp.long_name|e}} - {%- endif %} - {%- if cp.description and cp.description.strip() %} - - {{cp.description}} - - {%- endif %} + {{ peid.printElementID(cp)|indent(1) }} {%- for sub_cp in cp.comparams %} {{- printGenericComparam(sub_cp) | indent(1, first=True) }} {%- endfor %} diff --git a/odxtools/templates/macros/printDOP.xml.jinja2 b/odxtools/templates/macros/printDOP.xml.jinja2 index 3c3c66f5..770da14c 100644 --- a/odxtools/templates/macros/printDOP.xml.jinja2 +++ b/odxtools/templates/macros/printDOP.xml.jinja2 @@ -3,6 +3,7 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printAdminData.xml.jinja2') as pad %} {%- import('macros/printSpecialData.xml.jinja2') as psd %} @@ -164,13 +165,7 @@ {%- macro printDOP(dop, tag_name) %} <{{tag_name}} ID="{{dop.odx_id.local_id}}"> - {{dop.short_name}} - {%- if dop.long_name %} - {{dop.long_name|e}} - {%- endif %} - {%- if dop.description %} - {{dop.description}} - {%- endif %} + {{ peid.printElementID(dop)|indent(1) }} {%- if dop.admin_data %} {{- pad.printAdminData(dop.admin_data)|indent(2, first=True) }} {%- endif %} @@ -192,8 +187,7 @@ {%- macro printDTCDOP(dop) %} - {{dop.short_name}} - {{dop.long_name|e}} + {{ peid.printElementID(dop)|indent(1) }} {{- psd.printSpecialDataGroups(dop.sdgs)|indent(1, first=True) }} {{- printDiagCodedType(dop.diag_coded_type)|indent(1, first=True) }} {{- printPhysicalType(dop.physical_type)|indent(1, first=True) }} diff --git a/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 b/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 index 3a9a3202..2758a97a 100644 --- a/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +++ b/odxtools/templates/macros/printDynamicLengthField.xml.jinja2 @@ -3,10 +3,11 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printDynamicLengthField(dlf) -%} - {{dlf.short_name}} - {{dlf.long_name|e}} + {{ peid.printElementID(dlf)|indent(1) }} {{dlf.offset}} diff --git a/odxtools/templates/macros/printElementID.xml.jinja2 b/odxtools/templates/macros/printElementID.xml.jinja2 index 4275ca25..e1f5d64a 100644 --- a/odxtools/templates/macros/printElementID.xml.jinja2 +++ b/odxtools/templates/macros/printElementID.xml.jinja2 @@ -3,12 +3,12 @@ # SPDX-License-Identifier: MIT -#} -{%- macro printElementID(element) -%} -{{ element.short_name }} -{%- if element.long_name is string and element.long_name.strip() %} -{{ element.long_name|e }} +{%- macro printElementID(obj) -%} +{{ obj.short_name }} +{%- if obj.long_name %} +{{ obj.long_name|e }} {%- endif %} -{%- if element.description is string and element.description.strip() %} -{{ element.description }} +{%- if obj.description %} +{{ obj.description }} {%- endif %} {%- endmacro -%} diff --git a/odxtools/templates/macros/printEndOfPdu.xml.jinja2 b/odxtools/templates/macros/printEndOfPdu.xml.jinja2 index dd18fd2f..5004223e 100644 --- a/odxtools/templates/macros/printEndOfPdu.xml.jinja2 +++ b/odxtools/templates/macros/printEndOfPdu.xml.jinja2 @@ -3,10 +3,11 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printEndOfPdu(eopdu) -%} - {{eopdu.short_name}} - {{eopdu.long_name|e}} + {{ peid.printElementID(eopdu)|indent(1) }} {%- endmacro -%} diff --git a/odxtools/templates/macros/printEnvData.xml.jinja2 b/odxtools/templates/macros/printEnvData.xml.jinja2 index 8ea9822a..6d43cb60 100644 --- a/odxtools/templates/macros/printEnvData.xml.jinja2 +++ b/odxtools/templates/macros/printEnvData.xml.jinja2 @@ -3,12 +3,12 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printParam.xml.jinja2') as pparam %} {%- macro printEnvData(env_data) %} - {{env_data.short_name}} - {{env_data.long_name}} + {{ peid.printElementID(env_data)|indent(1) }} {%- for param in env_data.parameters %} {{pparam.printParam(param) | indent(6, first=True) }} diff --git a/odxtools/templates/macros/printEnvDataDesc.xml.jinja2 b/odxtools/templates/macros/printEnvDataDesc.xml.jinja2 index f2f96c7a..72728e4a 100644 --- a/odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +++ b/odxtools/templates/macros/printEnvDataDesc.xml.jinja2 @@ -3,10 +3,11 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printEnvDataDesc(env_data_desc) %} - {{env_data_desc.short_name}} - {{env_data_desc.long_name}} + {{ peid.printElementID(env_data_desc)|indent(1) }} {%- for env_data_ref in env_data_desc.env_data_refs %} diff --git a/odxtools/templates/macros/printFunctionalClass.xml.jinja2 b/odxtools/templates/macros/printFunctionalClass.xml.jinja2 index 6c8c3ee2..a628bc11 100644 --- a/odxtools/templates/macros/printFunctionalClass.xml.jinja2 +++ b/odxtools/templates/macros/printFunctionalClass.xml.jinja2 @@ -4,16 +4,10 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printFunctionalClass(fc) -%} - {{fc.short_name}} -{%- if fc.long_name is string and fc.long_name.strip() %} - {{fc.long_name}} -{%- endif %} -{%- if fc.description is string and fc.description.strip() %} - -{{fc.description}} - -{%- endif %} + {{ peid.printElementID(fc)|indent(1) }} {%- endmacro -%} diff --git a/odxtools/templates/macros/printMux.xml.jinja2 b/odxtools/templates/macros/printMux.xml.jinja2 index 0b8525c2..30980b53 100644 --- a/odxtools/templates/macros/printMux.xml.jinja2 +++ b/odxtools/templates/macros/printMux.xml.jinja2 @@ -3,10 +3,11 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printMux(mux) %} - {{mux.short_name}} - {{mux.long_name|e}} + {{ peid.printElementID(mux)|indent(1) }} {{mux.byte_position}} {{mux.switch_key.byte_position}} @@ -17,8 +18,7 @@ {%- if mux.default_case is not none %} - {{mux.default_case.short_name}} - {{mux.default_case.long_name}} + {{ peid.printElementID(mux.default_case)|indent(4) }} {%- if mux.default_case.structure_ref is not none %} {%- endif %} @@ -31,8 +31,7 @@ {%- for case in mux.cases %} - {{case.short_name}} - {{case.long_name}} + {{ peid.printElementID(case)|indent(6) }} {%- if case.structure_ref is not none %} {%- endif %} diff --git a/odxtools/templates/macros/printParam.xml.jinja2 b/odxtools/templates/macros/printParam.xml.jinja2 index 08a29991..22791345 100644 --- a/odxtools/templates/macros/printParam.xml.jinja2 +++ b/odxtools/templates/macros/printParam.xml.jinja2 @@ -3,6 +3,7 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printDOP.xml.jinja2') as pdop %} {%- import('macros/printSpecialData.xml.jinja2') as psd %} @@ -19,13 +20,7 @@ {%- else %} {%- endif%} - {{param.short_name}} -{%- if param.long_name %} - {{param.long_name|e}} -{%- endif %} -{%- if param.description %} - {{param.description}} -{%- endif %} + {{ peid.printElementID(param)|indent(1) }} {{- psd.printSpecialDataGroups(param.sdgs)|indent(1, first=True) }} {%- if param.byte_position is not none %} {{param.byte_position}} diff --git a/odxtools/templates/macros/printRequest.xml.jinja2 b/odxtools/templates/macros/printRequest.xml.jinja2 index 04364eb1..639300c4 100644 --- a/odxtools/templates/macros/printRequest.xml.jinja2 +++ b/odxtools/templates/macros/printRequest.xml.jinja2 @@ -3,21 +3,14 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printDOP.xml.jinja2') as pdop %} {%- import('macros/printParam.xml.jinja2') as pp %} {%- import('macros/printSpecialData.xml.jinja2') as psd %} {%- macro printRequest(request) -%} - {{request.short_name}} -{%- if request.long_name %} - {{request.long_name|e}} -{%- endif %} -{%- if request.description and request.description.strip() %} - - {{request.description}} - -{%- endif %} + {{ peid.printElementID(request)|indent(1) }} {%- if request.parameters %} {%- for param in request.parameters -%} diff --git a/odxtools/templates/macros/printResponse.xml.jinja2 b/odxtools/templates/macros/printResponse.xml.jinja2 index afc3e9ee..b31659e4 100644 --- a/odxtools/templates/macros/printResponse.xml.jinja2 +++ b/odxtools/templates/macros/printResponse.xml.jinja2 @@ -3,20 +3,13 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printParam.xml.jinja2') as pp %} {%- import('macros/printSpecialData.xml.jinja2') as psd %} {%- macro printResponse(resp, tag_name="POS-RESPONSE") -%} <{{tag_name}} ID="{{resp.odx_id.local_id}}"> - {{resp.short_name}} -{%- if resp.long_name %} - {{resp.long_name|e}} -{%- endif %} -{%- if resp.description and resp.description.strip() %} - - {{resp.description}} - -{%- endif %} + {{ peid.printElementID(resp)|indent(1) }} {%- if resp.parameters %} {%- for param in resp.parameters -%} diff --git a/odxtools/templates/macros/printService.xml.jinja2 b/odxtools/templates/macros/printService.xml.jinja2 index 582731b0..4bd84958 100644 --- a/odxtools/templates/macros/printService.xml.jinja2 +++ b/odxtools/templates/macros/printService.xml.jinja2 @@ -3,6 +3,7 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printAdminData.xml.jinja2') as pad %} {%- import('macros/printAudience.xml.jinja2') as paud %} {%- import('macros/printSpecialData.xml.jinja2') as psd %} @@ -14,15 +15,7 @@ {%- set semattrib = " SEMANTIC=\"UNKNOWN\"" -%} {%- endif -%} - {{service.short_name}} -{%- if service.long_name and service.long_name.strip() %} - {{service.long_name|e}} -{%- endif %} -{%- if service.description and service.description.strip() %} - - {{service.description}} - -{%- endif %} + {{ peid.printElementID(service)|indent(1) }} {%- if service.admin_data %} {{- pad.printAdminData(service.admin_data)|indent(1, first=True) }} {%- endif %} diff --git a/odxtools/templates/macros/printSpecialData.xml.jinja2 b/odxtools/templates/macros/printSpecialData.xml.jinja2 index 5a657437..32c0d84a 100644 --- a/odxtools/templates/macros/printSpecialData.xml.jinja2 +++ b/odxtools/templates/macros/printSpecialData.xml.jinja2 @@ -18,7 +18,7 @@ {%- macro printSdgCaption(sdg_caption) %} - {{ peid.printElementID(sdg_caption) | indent(1) }} + {{ peid.printElementID(sdg_caption)|indent(1) }} {%- endmacro %} diff --git a/odxtools/templates/macros/printState.xml.jinja2 b/odxtools/templates/macros/printState.xml.jinja2 index f63bec83..272eb050 100644 --- a/odxtools/templates/macros/printState.xml.jinja2 +++ b/odxtools/templates/macros/printState.xml.jinja2 @@ -3,16 +3,10 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printState(state) -%} - {{state.short_name}} - {%- if state.long_name %} - {{state.long_name}} - {%- endif %} - {%- if state.description is string and state.description.strip() %} - -{{state.description}} - - {%- endif %} + {{ peid.printElementID(state)|indent(1) }} {%- endmacro -%} diff --git a/odxtools/templates/macros/printStateChart.xml.jinja2 b/odxtools/templates/macros/printStateChart.xml.jinja2 index 9b4aca7d..191ae38c 100644 --- a/odxtools/templates/macros/printStateChart.xml.jinja2 +++ b/odxtools/templates/macros/printStateChart.xml.jinja2 @@ -3,19 +3,13 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printState.xml.jinja2') as ps %} {%- import('macros/printStateTransition.xml.jinja2') as pst %} {%- macro printStateChart(state_chart) -%} - {{state_chart.short_name}} -{%- if state_chart.long_name %} - {{state_chart.long_name}} -{%- endif %} -{%- if state_chart.description is string and state_chart.description.strip() %} - -{{state_chart.description}} - + {{ peid.printElementID(state_chart)|indent(1) }} {{state_chart.semantic}} {%- if state_chart.state_transitions %} @@ -32,6 +26,5 @@ {%- endfor %} {%- endif %} -{%- endif %} {%- endmacro -%} diff --git a/odxtools/templates/macros/printStateTransition.xml.jinja2 b/odxtools/templates/macros/printStateTransition.xml.jinja2 index c1358d13..71104c74 100644 --- a/odxtools/templates/macros/printStateTransition.xml.jinja2 +++ b/odxtools/templates/macros/printStateTransition.xml.jinja2 @@ -3,17 +3,11 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} + {%- macro printStateTransition(state_transition) -%} - {{state_transition.short_name}} - {%- if state_transition.long_name %} - {{state_transition.long_name}} - {%- endif %} - {%- if state_transition.description is string and state_transition.description.strip() %} - -{{state_transition.description}} - - {%- endif %} + {{ peid.printElementID(state_transition)|indent(1) }} diff --git a/odxtools/templates/macros/printStructure.xml.jinja2 b/odxtools/templates/macros/printStructure.xml.jinja2 index 3aa0cb17..cae08c60 100644 --- a/odxtools/templates/macros/printStructure.xml.jinja2 +++ b/odxtools/templates/macros/printStructure.xml.jinja2 @@ -3,14 +3,12 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printParam.xml.jinja2') as pp %} {%- macro printStructure(st) -%} - {{st.short_name}} -{%- if st.long_name %} - {{st.long_name|e}} -{%- endif %} + {{ peid.printElementID(st)|indent(1) }} {%- if st.byte_size is not none %} {{st.byte_size}} {%- endif %} diff --git a/odxtools/templates/macros/printTable.xml.jinja2 b/odxtools/templates/macros/printTable.xml.jinja2 index 6d3ca61e..bedc0a07 100644 --- a/odxtools/templates/macros/printTable.xml.jinja2 +++ b/odxtools/templates/macros/printTable.xml.jinja2 @@ -3,18 +3,13 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printSpecialData.xml.jinja2') as psd %} {%- macro printTable(table) %} - {{table.short_name}} -{%- if table.long_name %} - {{table.long_name|e}} -{%- endif %} -{%- if table.description %} - {{table.description}} -{%- endif %} + {{ peid.printElementID(table)|indent(1) }} {%- if table.key_dop_ref %} {%- endif %} diff --git a/odxtools/templates/macros/printUnitSpec.xml.jinja2 b/odxtools/templates/macros/printUnitSpec.xml.jinja2 index e04be64d..40b5fe64 100644 --- a/odxtools/templates/macros/printUnitSpec.xml.jinja2 +++ b/odxtools/templates/macros/printUnitSpec.xml.jinja2 @@ -37,7 +37,7 @@ {%- macro printUnit(unit) -%} - {{ peid.printElementID(unit) }} + {{ peid.printElementID(unit)|indent(1) }} {{ unit.display_name }} {%- if unit.factor_si_to_unit is not none %} {{ unit.factor_si_to_unit }} @@ -53,7 +53,7 @@ {%- macro printUnitGroup(group) -%} - {{ peid.printElementID(group) }} + {{ peid.printElementID(group)|indent(1) }} {{ group.category.value }} {%- if group.unit_refs %} @@ -68,7 +68,7 @@ {%- macro printPhysicalDimesion(dim) -%} - {{ peid.printElementID(dim) }} + {{ peid.printElementID(dim)|indent(1) }} {%- if dim.length_exp %} {{ dim.length_exp }} {%- endif %} diff --git a/odxtools/templates/macros/printVariant.xml.jinja2 b/odxtools/templates/macros/printVariant.xml.jinja2 index ed74014d..d9e183bb 100644 --- a/odxtools/templates/macros/printVariant.xml.jinja2 +++ b/odxtools/templates/macros/printVariant.xml.jinja2 @@ -3,6 +3,7 @@ # SPDX-License-Identifier: MIT -#} +{%- import('macros/printElementID.xml.jinja2') as peid %} {%- import('macros/printDOP.xml.jinja2') as pdop %} {%- import('macros/printTable.xml.jinja2') as pt %} {%- import('macros/printFunctionalClass.xml.jinja2') as pfc %} @@ -26,15 +27,7 @@ {%- macro printVariant(dl) -%} {%- set dlr = dl.diag_layer_raw %} <{{dlr.variant_type.value}} ID="{{dlr.odx_id.local_id}}"> - {{dlr.short_name}} -{%- if dlr.long_name %} - {{dlr.long_name|e}} -{%- endif %} -{%- if dlr.description is string and dlr.description.strip() %} - -{{dlr.description}} - -{%- endif %} + {{ peid.printElementID(dlr)|indent(1) }} {%- if dlr.functional_classes %} {%- for fc in dlr.functional_classes %}