Now the text* options of join must include any separator

- Removed the space when used
- Related to #108
This commit is contained in:
Diego Capusotto 2021-12-14 16:49:46 -03:00
parent e2599731f7
commit 9be560e78d
6 changed files with 30 additions and 14 deletions

View File

@ -762,8 +762,11 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `field`: [string=''] Name of the field.
- `text`: [string=''] Text to use instead of a field. This option is incompatible with the `field` option.
Any space to separate it should be added in the text.
- `text_after`: [string=''] Text to add after the field content. Will be added only if the field isn't empty.
Any space to separate it should be added in the text.
- `text_before`: [string=''] Text to add before the field content. Will be added only if the field isn't empty.
Any space to separate it should be added in the text.
- `level`: [number=0] Used to group columns. The XLSX output uses it to collapse columns.
- `name`: [string=''] Name to display in the header. The field is used when empty.
- `component_aliases`: [list(list(string))] A series of values which are considered to be equivalent for the part name.
@ -785,8 +788,11 @@ Next time you need this list just use an alias, like this:
* Valid keys:
- `field`: [string=''] Name of the field.
- `text`: [string=''] Text to use instead of a field. This option is incompatible with the `field` option.
Any space to separate it should be added in the text.
- `text_after`: [string=''] Text to add after the field content. Will be added only if the field isn't empty.
Any space to separate it should be added in the text.
- `text_before`: [string=''] Text to add before the field content. Will be added only if the field isn't empty.
Any space to separate it should be added in the text.
- `level`: [number=0] Used to group columns. The XLSX output uses it to collapse columns.
- `name`: [string=''] Name to display in the header. The field is used when empty.
- `count_smd_tht`: [boolean=false] Show the stats about how many of the components are SMD/THT. You must provide the PCB.

View File

@ -93,11 +93,14 @@ outputs:
join:
# [string=''] Name of the field
- field: 'Voltage'
# [string=''] Text to use instead of a field. This option is incompatible with the `field` option
# [string=''] Text to use instead of a field. This option is incompatible with the `field` option.
# Any space to separate it should be added in the text
text: ''
# [string=''] Text to add after the field content. Will be added only if the field isn't empty
# [string=''] Text to add after the field content. Will be added only if the field isn't empty.
# Any space to separate it should be added in the text
text_after: ''
# [string=''] Text to add before the field content. Will be added only if the field isn't empty
# [string=''] Text to add before the field content. Will be added only if the field isn't empty.
# Any space to separate it should be added in the text
text_before: ''
# [number=0] Used to group columns. The XLSX output uses it to collapse columns
level: 0
@ -125,11 +128,14 @@ outputs:
join:
# [string=''] Name of the field
- field: 'Voltage'
# [string=''] Text to use instead of a field. This option is incompatible with the `field` option
# [string=''] Text to use instead of a field. This option is incompatible with the `field` option.
# Any space to separate it should be added in the text
text: ''
# [string=''] Text to add after the field content. Will be added only if the field isn't empty
# [string=''] Text to add after the field content. Will be added only if the field isn't empty.
# Any space to separate it should be added in the text
text_after: ''
# [string=''] Text to add before the field content. Will be added only if the field isn't empty
# [string=''] Text to add before the field content. Will be added only if the field isn't empty.
# Any space to separate it should be added in the text
text_before: ''
# [number=0] Used to group columns. The XLSX output uses it to collapse columns
level: 0

View File

@ -350,7 +350,7 @@ class ComponentGroup(object):
for source in join_l[1:]:
v = source.get_text(self.get_field)
if v:
val = val + ' ' + v
val += v
row.append(val)
return row

View File

@ -362,7 +362,7 @@ def apply_join_requests(join, adapted, original):
for source in join_l[1:]:
v = source.get_text(original.get)
if v:
append += ' ' + v
append += v
if append:
if val is None:
val = ''

View File

@ -51,11 +51,14 @@ class BoMJoinField(Optionable):
self.field = ''
""" Name of the field """
self.text = ''
""" Text to use instead of a field. This option is incompatible with the `field` option """
""" Text to use instead of a field. This option is incompatible with the `field` option.
Any space to separate it should be added in the text """
self.text_before = ''
""" Text to add before the field content. Will be added only if the field isn't empty """
""" Text to add before the field content. Will be added only if the field isn't empty.
Any space to separate it should be added in the text """
self.text_after = ''
""" Text to add after the field content. Will be added only if the field isn't empty """
""" Text to add after the field content. Will be added only if the field isn't empty.
Any space to separate it should be added in the text """
self._field_example = 'Voltage'
def config(self, parent):
@ -77,7 +80,8 @@ class BoMJoinField(Optionable):
value = field_getter(self.field)
if not value:
return None
return self.text_before + value + self.text_after
separator = '' if self.text_before else ' '
return separator + self.text_before + value + self.text_after
def __repr__(self):
if self.text:

View File

@ -15,9 +15,9 @@ outputs:
- field: Value
join:
- 'Tolerance'
- text: '-'
- text: ' -'
- field: 'Voltage'
text_before: '('
text_before: ' ('
text_after: ')'
- field: manf
join: manf#