-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jinja line statements and comments #42930
Changes from 10 commits
c770ba3
0373f90
87a1154
eb713c6
9215969
69d241c
23e1b23
0bbb23d
2dc593b
e2155c2
78fd3f9
7c78a02
7091f8e
19dcfcf
470265e
111df31
c67db52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -537,18 +537,24 @@ syndic_user: salt | |
# The renderer to use on the minions to render the state data | ||
#renderer: yaml_jinja | ||
|
||
# The Jinja renderer can strip extra carriage returns and whitespace | ||
# See http://jinja.pocoo.org/docs/api/#high-level-api | ||
# | ||
# If this is set to True the first newline after a Jinja block is removed | ||
# (block, not variable tag!). Defaults to False, corresponds to the Jinja | ||
# environment init variable "trim_blocks". | ||
#jinja_trim_blocks: False | ||
# | ||
# If this is set to True leading spaces and tabs are stripped from the start | ||
# of a line to a block. Defaults to False, corresponds to the Jinja | ||
# environment init variable "lstrip_blocks". | ||
#jinja_lstrip_blocks: False | ||
# TODO documentation | ||
# Ignoring documentation for now | ||
# (until agreement on implementation has been reached) | ||
|
||
# Default jinja environment options for everything but | ||
# salt sls files | ||
#jinja_env: | ||
# line_statement_prefix: '#' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make this synced with the documentation below. |
||
# line_comment_prefix: '##' | ||
# trim_blocks: True | ||
# lstrip_blocks: True | ||
|
||
# Jinja environment options for salt sls files | ||
#jinja_sls_env: | ||
# line_statement_prefix: '#' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @terminalmage for SLS files I would like to see the line_statemet_prefix enabled by default. I know you wrote few months ago - now way. But I still think it would be nice new "standard" that improves SLS readability. I quite belive it should not affect old setups. But probably we should still check, test how frequent is (ie: %) in SLS of current formulas and that for example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, this would be nice to have enabled just for salt's sls files by default if possible. As far as my reading and testing has found there are extremely limited situations in yaml where |
||
# line_comment_prefix: '##' | ||
# trim_blocks: True | ||
# lstrip_blocks: True | ||
|
||
# The failhard option tells the minions to stop immediately after the first | ||
# failure detected in the state execution, defaults to False | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1941,6 +1941,42 @@ the cloud profile or master config file, no templating will be performed. | |
|
||
userdata_template: jinja | ||
|
||
.. conf_master:: jinja_line_statement_prefix | ||
|
||
``jinja_line_statement_prefix`` | ||
--------------------- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please extend the dashed line to match the length of the line above. Using different lengths won't make docs builds fail, but it will muddy the output with a warning. |
||
|
||
.. versionadded:: Oxygen | ||
|
||
Default: ``''`` | ||
|
||
If this is set to a string that is not empty, any line starting with this prefix | ||
will be interpreted as a line statement by the jinja renderer. | ||
Defaults to ``''`` and corresponds | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of the documentation (including this file) is outdated with the code and I will likely have to rewrite most of it. The |
||
to the Jinja environment init variable ``line_statement_prefix``. | ||
|
||
.. code-block:: yaml | ||
|
||
jinja_line_statement_prefix: '' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to see here example from my PR. |
||
|
||
.. conf_master:: jinja_line_comment_prefix | ||
|
||
``jinja_line_comment_prefix`` | ||
--------------------- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here with the dashed line. |
||
|
||
.. versionadded:: Oxygen | ||
|
||
Default: ``''`` | ||
|
||
If this is set to a string that is not empty, any line starting with this prefix | ||
will be interpreted as a line comment by the jinja renderer. | ||
Defaults to ``''`` and corresponds | ||
to the Jinja environment init variable ``line_comment_prefix``. | ||
|
||
.. code-block:: yaml | ||
|
||
jinja_line_comment_prefix: '' | ||
|
||
.. conf_master:: jinja_trim_blocks | ||
|
||
``jinja_trim_blocks`` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see the comments I added to conf/suse/master