fix: if and for in 3 lines
This commit is contained in:
parent
4e9e8b082e
commit
c09800521c
53 changed files with 83 additions and 73 deletions
|
|
@ -78,6 +78,8 @@ class RougailOutputFormatter:
|
|||
|
||||
self.config = Config()
|
||||
self.config.profile = 'jinja'
|
||||
self.config.line_break_after_multiline_tag = True
|
||||
self.config.indent = " "
|
||||
|
||||
self.original_yaml = RougailUpgrade(rougailconfig).run(filename)
|
||||
datas = RougailUpgrade(rougailconfig).run(filename)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ var2:
|
|||
default:
|
||||
jinja: |-
|
||||
{% for val in _.var1 %}
|
||||
{{ val }}
|
||||
{{ val }}
|
||||
{% endfor %}
|
||||
description: the value of _.var1
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ var:
|
|||
choices:
|
||||
jinja: |-
|
||||
{% for n in trange(0, 10) %}
|
||||
{{ n }}
|
||||
{{ n }}
|
||||
{% endfor %}
|
||||
return_type: number
|
||||
description: choices is 0 to 9
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ variable:
|
|||
description: a variable
|
||||
default:
|
||||
jinja: >-
|
||||
{{test_information }}
|
||||
{{ test_information }}
|
||||
description: get information test_information
|
||||
params:
|
||||
test_information:
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ var1:
|
|||
default:
|
||||
jinja: >-
|
||||
{% if var2 is defined %}
|
||||
{{ var2 }}
|
||||
{{ var2 }}
|
||||
{% elif var3 is defined %}
|
||||
{{ var3 }}
|
||||
{{ var3 }}
|
||||
{% elif var4 is defined %}
|
||||
{{ var4 }}
|
||||
{{ var4 }}
|
||||
{% else %}
|
||||
{{ _.var2 }}
|
||||
{{ _.var2 }}
|
||||
{% endif %}
|
||||
description: returns a value
|
||||
params:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ var:
|
|||
choices:
|
||||
jinja: |-
|
||||
{% for item in trange(0, 10) %}
|
||||
{{ item }}
|
||||
{{ item }}
|
||||
{%- endfor %}
|
||||
return_type: number
|
||||
description: choice for 0 to 9
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ variable:
|
|||
default:
|
||||
jinja: |-
|
||||
{% for info in test_information %}
|
||||
{{ info }}
|
||||
{{ info }}
|
||||
{% endfor %}
|
||||
description: get information test_information
|
||||
params:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ var2:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if _.var1 == "yes" %}
|
||||
_.var1 is yes
|
||||
_.var1 is yes
|
||||
{% endif %}
|
||||
description: only if the variable var1 has value "yes"
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ var3:
|
|||
default:
|
||||
jinja: >-
|
||||
{% if _.var1 == 'value' or _.var2 == 'blah' %}
|
||||
value
|
||||
value
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ var3:
|
|||
default:
|
||||
jinja: >-
|
||||
{% if _.var2 is propertyerror %}
|
||||
value
|
||||
value
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ variable1:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is egal to "yes"
|
||||
|
||||
|
|
@ -17,6 +17,6 @@ variable2:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is egal to "yes"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ var1:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
||||
|
|
@ -25,6 +25,6 @@ var2:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if rougail.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ variable1:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is egal to "yes"
|
||||
|
||||
|
|
@ -19,6 +19,6 @@ variable2:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is egal to "yes"
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ var1:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if unknown is not defined %}
|
||||
unknown is undefined
|
||||
unknown is undefined
|
||||
{% elif unknown == "no" %}
|
||||
unknown is no
|
||||
unknown is no
|
||||
{% endif %}
|
||||
description: calculation from an unknown variable
|
||||
params:
|
||||
|
|
@ -25,9 +25,9 @@ var2:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if condition is not defined %}
|
||||
condition is undefined
|
||||
condition is undefined
|
||||
{% elif condition == "no" %}
|
||||
condition is no
|
||||
condition is no
|
||||
{% endif %}
|
||||
description: calculation from an condition variable
|
||||
params:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ var1:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
||||
|
|
@ -19,6 +19,6 @@ var2:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if rougail.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ var1:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if _.condition != "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
||||
|
|
@ -25,6 +25,6 @@ var2:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if rougail.condition != "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ var1:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
||||
|
|
@ -25,6 +25,6 @@ var2:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if rougail.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@ int:
|
|||
validators:
|
||||
- jinja: |-
|
||||
{% if _.int > 100 %}
|
||||
value is too high
|
||||
value is too high
|
||||
{% endif %}
|
||||
description: the max value is 100
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ var1:
|
|||
validators:
|
||||
- jinja: |-
|
||||
{% if _.var1 == _.var2 %}
|
||||
var1 must be different than var2
|
||||
var1 must be different than var2
|
||||
{% endif %}
|
||||
description: var1 must be different than var2
|
||||
default: oui
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ var1:
|
|||
validators:
|
||||
- jinja: |-
|
||||
{% if _.var1 | length > 9 %}
|
||||
length must be less than 10
|
||||
length must be less than 10
|
||||
{% endif %}
|
||||
description: check length is less than 10
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ var1:
|
|||
validators:
|
||||
- jinja: |-
|
||||
{% if values | length > 2 %}
|
||||
length must be less than 3
|
||||
length must be less than 3
|
||||
{% endif %}
|
||||
description: check length is less than 3
|
||||
params:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ variable:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
true
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
false
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ var3:
|
|||
validators:
|
||||
- jinja: |-
|
||||
{% if _.var3 == _.var1 %}
|
||||
var3 must be different than var1
|
||||
var3 must be different than var1
|
||||
{% endif %}
|
||||
description: var3 must be different than var1
|
||||
default: yes
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ var3:
|
|||
validators:
|
||||
- jinja: |-
|
||||
{% if _.var3 == _.var2 %}
|
||||
var3 must be different than var2
|
||||
var3 must be different than var2
|
||||
{% endif %}
|
||||
description: var3 must be different than var2
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ family:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if rougail.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ family:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if not rougail.condition %}
|
||||
condition is false
|
||||
condition is false
|
||||
{% endif %}
|
||||
description: if not condition
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ family:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ family:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if not rougail.condition1 %}
|
||||
condition1 is false
|
||||
condition1 is false
|
||||
{% endif %}
|
||||
description: if condition1 is false
|
||||
|
||||
|
|
@ -20,6 +20,6 @@ family:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if rougail.condition2 %}
|
||||
condition2 is true
|
||||
condition2 is true
|
||||
{% endif %}
|
||||
description: if condition2 is false
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ family:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
params:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ var:
|
|||
mandatory:
|
||||
jinja: |-
|
||||
{% if _.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: only if rougail.condition has the value "yes"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ general: # a family
|
|||
validators:
|
||||
- jinja: |-
|
||||
{% if _.int == int2 %}
|
||||
int and int2 must be different
|
||||
int and int2 must be different
|
||||
{% endif %}
|
||||
description: int and int2 must be different
|
||||
params:
|
||||
|
|
@ -20,7 +20,7 @@ general: # a family
|
|||
optional: true
|
||||
- jinja: |-
|
||||
{% if int3 is defined and _.int == int3 %}
|
||||
int and int3 must be different
|
||||
int and int3 must be different
|
||||
{% endif %}
|
||||
description: int and int3 must be different
|
||||
params:
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ multi1:
|
|||
default:
|
||||
jinja: |-
|
||||
{% if _.bool %}
|
||||
True
|
||||
False
|
||||
True
|
||||
False
|
||||
{% else %}
|
||||
False
|
||||
False
|
||||
{% endif %}
|
||||
description: a calculation
|
||||
|
||||
|
|
@ -24,9 +24,9 @@ multi2:
|
|||
default:
|
||||
jinja: |-
|
||||
{% if not _.bool %}
|
||||
True
|
||||
False
|
||||
True
|
||||
False
|
||||
{% else %}
|
||||
False
|
||||
False
|
||||
{% endif %}
|
||||
description: a calculation
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ var2:
|
|||
default:
|
||||
jinja: >-
|
||||
{% if rougail.var1 == 'no' %}
|
||||
false
|
||||
false
|
||||
{% endif %}
|
||||
description: return false if the value of var1 is "no"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@ int1:
|
|||
type: number
|
||||
default:
|
||||
jinja: >-
|
||||
{% if rougail.bool %}1{% else %}2{% endif %}
|
||||
{% if rougail.bool %}
|
||||
1
|
||||
{% else %}
|
||||
2
|
||||
{% endif %}
|
||||
description: if bool returns 1 otherwise return 2
|
||||
|
||||
int2:
|
||||
|
|
@ -16,5 +20,9 @@ int2:
|
|||
type: number
|
||||
default:
|
||||
jinja: >-
|
||||
{% if not rougail.bool %}3{% else %}4{% endif %}
|
||||
{% if not rougail.bool %}
|
||||
3
|
||||
{% else %}
|
||||
4
|
||||
{% endif %}
|
||||
description: if bool returns 3 otherwise return 4
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ leader:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if rougail.condition == "yes" %}
|
||||
condition is yes
|
||||
condition is yes
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ leader:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if __.condition == "no" %}
|
||||
condition is no
|
||||
condition is no
|
||||
{% endif %}
|
||||
description: if condition is no
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@ leader:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if __.condition == "yes" %}
|
||||
disabled
|
||||
disabled
|
||||
{% endif %}
|
||||
description: if condition is yes
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ leader:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if _.leader == "a" %}
|
||||
the value of "leader" is "a"
|
||||
the value of "leader" is "a"
|
||||
{% endif %}
|
||||
description: if the value of "leader" is "a"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@ var2:
|
|||
default:
|
||||
jinja: >-
|
||||
{% if rougail.dyn1 is defined %}
|
||||
{{ rougail.dyn1.var }}
|
||||
{{ rougail.dyn1.var }}
|
||||
{% endif %}
|
||||
description: get the value of rougail.dyn1.var
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ dyn{{ identifier }}:
|
|||
dynamic:
|
||||
jinja: |-
|
||||
{% for val in _.var %}
|
||||
{{ loop.index }}
|
||||
{{ loop.index }}
|
||||
{% endfor %}
|
||||
description: index of suffix value
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ var2:
|
|||
default:
|
||||
jinja: >-
|
||||
{% if _.dynval1 is defined %}
|
||||
{{ _.dynval1.family.var }}
|
||||
{{ _.dynval1.family.var }}
|
||||
{% endif %}
|
||||
description: the value of var
|
||||
mandatory: false
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ var2:
|
|||
default:
|
||||
jinja: >-
|
||||
{% if _.dynval1 is defined %}
|
||||
{{ _.dynval1.family.var }}
|
||||
{{ _.dynval1.family.var }}
|
||||
{% endif %}
|
||||
description: the value of var
|
||||
mandatory: false
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ newvar:
|
|||
default:
|
||||
jinja: >-
|
||||
{% if _.dynval1 is defined %}
|
||||
{{ _.dynval1.var }}
|
||||
{{ _.dynval1.var }}
|
||||
{% endif %}
|
||||
description: the value of var
|
||||
mandatory: false
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ dyn{{ identifier }}:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if _.var2 == "no" %}
|
||||
var2 is no
|
||||
var2 is no
|
||||
{% endif %}
|
||||
description: if var2 is no
|
||||
dynamic:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ dyn{{ identifier }}:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if _.var2 == "no" %}
|
||||
var2 is no
|
||||
var2 is no
|
||||
{% endif %}
|
||||
description: if var2 is no
|
||||
dynamic:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ dyn{{ identifier }}:
|
|||
hidden:
|
||||
jinja: |-
|
||||
{% if suffix == 'val2' %}
|
||||
disabled
|
||||
disabled
|
||||
{% endif %}
|
||||
description: if suffix == 'val2'
|
||||
params:
|
||||
|
|
|
|||
|
|
@ -39,5 +39,5 @@ var:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if 'val4' not in __.var %}
|
||||
val4 is not a valid value
|
||||
val4 is not a valid value
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,5 @@ var:
|
|||
disabled:
|
||||
jinja: |-
|
||||
{% if 'val4' not in __.var %}
|
||||
val4 is not a valid value
|
||||
val4 is not a valid value
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ var2:
|
|||
default:
|
||||
jinja: |-
|
||||
{%- for v in var %}
|
||||
{{ v }}
|
||||
{{ v }}
|
||||
{%- endfor -%}
|
||||
params:
|
||||
var:
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ var2:
|
|||
default:
|
||||
jinja: |-
|
||||
{%- for v in var %}
|
||||
{{ v }}
|
||||
{{ v }}
|
||||
{%- endfor -%}
|
||||
params:
|
||||
var:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ dyn{{ identifier }}:
|
|||
default:
|
||||
jinja: |-
|
||||
{% for val in __.var %}
|
||||
t{{ val }}
|
||||
t{{ val }}
|
||||
{% endfor %}
|
||||
description: add 't' to each var value
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ dyn{{ identifier }}:
|
|||
default:
|
||||
jinja: |-
|
||||
{% for val in rougail.var %}
|
||||
t{{ val }}
|
||||
t{{ val }}
|
||||
{% endfor %}
|
||||
description: add 't' to each var value
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ dyn{{ identifier }}:
|
|||
default:
|
||||
jinja: |-
|
||||
{% for val in __.var %}
|
||||
t{{ val }}
|
||||
t{{ val }}
|
||||
{% endfor %}
|
||||
description: add 't' to each var value
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue