mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 06:36:45 +00:00
parent
9451781915
commit
9e002cd7a3
@ -146,6 +146,9 @@ def _substitute_item(substitutions, item, path, jinja, ignore_missing):
|
|||||||
if sub is not None:
|
if sub is not None:
|
||||||
item[k] = sub
|
item[k] = sub
|
||||||
for old, new in replace_keys:
|
for old, new in replace_keys:
|
||||||
|
if str(new) == str(old):
|
||||||
|
item[new] = item[old]
|
||||||
|
else:
|
||||||
item[new] = merge_config(item.get(old), item.get(new))
|
item[new] = merge_config(item.get(old), item.get(new))
|
||||||
del item[old]
|
del item[old]
|
||||||
elif isinstance(item, str):
|
elif isinstance(item, str):
|
||||||
|
@ -17,3 +17,5 @@ test_list:
|
|||||||
- ${undefined_var}
|
- ${undefined_var}
|
||||||
- $undefined_var
|
- $undefined_var
|
||||||
- ${ undefined_var }
|
- ${ undefined_var }
|
||||||
|
- key1: 1
|
||||||
|
key2: 2
|
||||||
|
@ -19,3 +19,5 @@ test_list:
|
|||||||
- ${undefined_var}
|
- ${undefined_var}
|
||||||
- $undefined_var
|
- $undefined_var
|
||||||
- ${ undefined_var }
|
- ${ undefined_var }
|
||||||
|
- key${var1}: 1
|
||||||
|
key${var2}: 2
|
||||||
|
@ -6,6 +6,7 @@ package_result:
|
|||||||
root file
|
root file
|
||||||
- Double substitution also works; the value of var7 is 79, where A is a package
|
- Double substitution also works; the value of var7 is 79, where A is a package
|
||||||
var
|
var
|
||||||
|
- key79: Key should substitute to key79
|
||||||
local_results:
|
local_results:
|
||||||
- The value of B is 5
|
- The value of B is 5
|
||||||
- 'You will see, however, that
|
- 'You will see, however, that
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
package_result:
|
package_result:
|
||||||
- The value of A*B is ${A * B}, where A is a package var and B is a substitution in the root file
|
- The value of A*B is ${A * B}, where A is a package var and B is a substitution in the root file
|
||||||
- Double substitution also works; the value of var7 is ${var$A}, where A is a package var
|
- Double substitution also works; the value of var7 is ${var$A}, where A is a package var
|
||||||
|
- key${var7}: Key should substitute to key79
|
||||||
|
Loading…
x
Reference in New Issue
Block a user