-
Notifications
You must be signed in to change notification settings - Fork 93
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
int parameters can now be formatted by %d #2431
Changes from 3 commits
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 |
---|---|---|
|
@@ -4604,13 +4604,19 @@ \subsubsection{Parameter Expansion} | |
|
||
\paragraph{Zero-Padded Integer Values} | ||
|
||
Integer parameter values are zero-padded according to the size of their | ||
largest value, so \lstinline@foo<p>@ for \lstinline@p = 9..10@ expands to | ||
Integer parameter values are, by default, zero-padded according to the size of | ||
their largest value, so \lstinline@foo<p>@ for \lstinline@p = 9..10@ expands to | ||
\lstinline@foo_p09, foo_p10@. | ||
|
||
To get thicker padding, prepend extra zeroes to the upper range value: | ||
\lstinline@foo<p>@ for \lstinline@p = 9..010@ expands to | ||
\lstinline@foo_p009, foo_p010@. | ||
To get thicker padding and/or alternate suffixes, use a template. E.g.: | ||
|
||
\begin{lstlisting} | ||
[cylc] | ||
[[parameters]] | ||
p = 3..14 | ||
[[parameter templates]] | ||
p = %%p%(p)03d # suffixes = %p003, %p004, ..., %p013, %p014 | ||
\end{lstlisting} | ||
|
||
|
||
\subsubsection{Passing Parameter Values To Tasks} | ||
|
@@ -4658,11 +4664,11 @@ \subsubsection{Selecting Partial Parameter Ranges} | |
\begin{lstlisting} | ||
[cylc] | ||
[[parameters]] | ||
run = 1..10 # 01, 02, ..., 10 | ||
runx = 1..03 # 01, 02, 03 (note `03' to get correct padding) | ||
run = 1..10 # 1, 2, ..., 10 | ||
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. This still results in 01, 02, ... 10? 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. The numbers are now stored internally as |
||
runx = 1..3 # 1, 2, 3 | ||
[[parameter templates]] | ||
run = _R%(run)s | ||
runx = _R%(runx)s | ||
run = _R%(run)02d | ||
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. Perhaps move the comments here i.e: run = _R%(run)02d # _R01, _R02, ..., _R10
runx = _R%(runx)02d # _R01, _R02, _R03 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. Hear. |
||
runx = _R%(runx)02d | ||
[scheduling] | ||
[[dependencies]] | ||
graph = """model<run> => post<run> | ||
|
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.
I think this may be clearer without the escaped
%
: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.
In which case, I'll add another example. (I think it will still be useful to have an example on how to have a
%
in your template.)