Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Using Equals and Vertical Bar in a Template Parameter

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Known Issues There are issues with using = and | in a template parameter due to templates being processed by the wiki parser. Equals is treated as defining a new keyword-value pair and the vertical bar as a parameter separator. Equal Signs If a single equals-sign () is used the wiki parser will interpret it as a parameter name-value assignment. The rendered template may contain unexpected failed replacement signs, as "{{{1}}}", or other unexpected results. For example {{Math|1 + 2 = 3}} will produce nothing. >> 3 << like this There are three workarounds: Workaround Example Output Explanation Start the formula 1 Math 1=1 + 2 = 3 1 + 2 = 3 Using the positional parameter 1 as an explicit named parameter prevents the parser interpreting its text. Use the wiki entity {{=}} Math 1 + 2 {{=}} 3 1 + 2 3 The special {{=}} template renders as the = sign. Use the HTML entity code &#61; Math 1 + 2 &#61; 3 1 + 2 = 3 HTML entities are passed straight through to the browser as. Vertical Bar Character This character, | has a few uses, but in mathematics the interesting on is indicating an absolute value, as y=|x|. The wiki parser interprets as a separator between parameters or as starting a cell in a table. For example, {{Math||1 + 2| {{=}} 3}} is saying the first positional parameter is an empty place holder, the second is |1 + 2|, and the third is ignored as the template does not use it, so it renders as 1 + 2 3. To resolve this, there are two known workarounds: Workaround Math Example Output Explanation Use the wiki entity {{!}} {{Math|1={{!}}1 + 2{{!}} {{=}} 3}} {{Math|1={{!}}1 + 2{{!}}{{=}}3}} 1 + 2 3 1 + 23 ** The parser interprets {{!}} as an absolute sign in the template. Use an HTML entity &#124; &vert; or &VerticalLine; Math &#124;1 + 2&#124; {{=}} 3 |1 + 2| 3 The entity is passed to the browser untouched. ** When an escaped vertical bar at the beginning of a template parameter it is interpreted, even as a wiki or HTML entity, and is not rendered. Prefixing the parameter text with any sort of wiki formatting code, like the numbered list "#" Other Characters Unmatched curly braces ( {{, }} ) and square brackets ( [[, ]] ) need to be inside nowiki tags, or be replaced by HTML entities, to prevent the wiki parser interpreting them. + HTML Entities to Use Special Characters To Show Numeric Named Template {{ &#123; &lbrace; {{((}} }} &#125; &rbrace; {{))}} | &#91; || &lbrack; || [ |- | &#93; &lbrack; &lbrack;