mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-05-16 21:59:26 +00:00
fix(template_formatter): preserve dash separator around empty conditional
When an empty conditional sits between a dot and a dash (e.g. `.{atmos?}-{tag}`),
the left-side dot was kept and the dash before the tag was dropped, producing
`...DDP5.1.TAG` instead of `...DDP5.1-TAG`. Prefer the dash when it is the
right-side separator.
Closes #107
This commit is contained in:
@@ -73,7 +73,9 @@ class TemplateFormatter:
|
||||
has_left = s[0] in ".- "
|
||||
has_right = s[-1] in ".- "
|
||||
if has_left and has_right:
|
||||
return s[0] # keep left separator
|
||||
if s[-1] == "-":
|
||||
return s[-1]
|
||||
return s[0]
|
||||
return ""
|
||||
|
||||
result = re.sub(
|
||||
|
||||
Reference in New Issue
Block a user