mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-23 23:43:54 +00:00
Update FormatString spec to match Parsoid's implementation
This should have been done following T128319 / I24aa1b7eda6103f54371aca7249d46c3e8bf7349 Note that if the format string specifies indentation before each paramater (ex. `{{_\n |_ = _\n}}`) that's going to be added in addition to the whitespace/comments preserved. That doesn't seem great. Maybe everything up to the pipe should be removed? Change-Id: I2186a09cd8ed4c6b1698a5707de0f22c8207d516
This commit is contained in:
parent
f34c2906e7
commit
920dd0c438
|
@ -305,9 +305,9 @@ To format a template invocation according to the format string, first split it i
|
|||
|
||||
Begin with `StartFormat`, and replace the `Hole` with the name of the template to create the "output string". If `StartFormat` begins with a newline and template is already at the start of a line (the character preceding this template invocation is a newline or the template is at the start of the output), delete the initial newline from the output string.
|
||||
|
||||
For each parameter, if `ParameterFormat` begins with a newline and the last character in the output string is a newline, then delete the last character in the output string. Then append `ParameterFormat` to the output string after replacing the first `Hole` with the name of the parameter and the second `Hole` with the value of the parameter.
|
||||
For each parameter, if `ParameterFormat` begins with a newline and the last line in the output string is nothing but whitespace and comments, then delete the newline from the beginning of the `ParameterFormat`. Then append `ParameterFormat` to the output string after replacing the first `Hole` with the name of the parameter and the second `Hole` with the value of the parameter.
|
||||
|
||||
Finally, if `EndFormat` begins with a newline and the last character in the output string is a newline, then delete the last character in the output string. Append the `EndFormat` to the output string.
|
||||
Finally, if `EndFormat` begins with a newline and the last line in the output string is nothing but whitespace and comments, then delete the newline from the beginning of the `EndFormat`. Append the `EndFormat` to the output string.
|
||||
|
||||
Some example format strings:
|
||||
|
||||
|
|
Loading…
Reference in a new issue