Jump to content

Module talk:DemoTemplate

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SiBr4 (talk | contribs) at 15:29, 24 June 2015 (Doesn't preserve outer spacing). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Doesn't preserve outer spacing

See how it doesn't preserve outer spaces around " two inner spaces ". Is that the way we want it to behave? Or is it just the MediaWiki software?

{{#invoke:DemoTemplate|Val/find|pattern= two inner spaces }}{{Val/find|pattern=two inner spaces}}Template:Val/find Thanks. — CpiralCpiral 08:43, 24 June 2015 (UTC)[reply]

All templates do that. Whitespace at the start and end is stripped in all named and explicitly numbered parameters, but not in unnamed ones:
  • "{{echo| abc }}" → "@Abc:"
  • "{{echo|1= abc }}" → "@Abc:"
  • "{{#invoke:DemoTemplate|echo| abc }}" → "{{echo| abc }}@Abc:"
  • "{{#invoke:DemoTemplate|echo|1= abc }}" → "{{echo|abc}}@Abc:"
Since whitespace is stripped before a parameter is passed into a module/template, nothing can be done within this module, but whitespace can be kept by adding <nowiki/> when using it:
  • "{{echo|1=<nowiki/> abc <nowiki/>}}" → "Error in Template:Reply to: Input contains forbidden characters."
  • "{{#invoke:DemoTemplate|echo|1=<nowiki/> abc <nowiki/>}}" → "{{echo|'"`UNIQ--nowiki-0000000A-QINU`"' abc '"`UNIQ--nowiki-0000000B-QINU`"'}}Error in Template:Reply to: Input contains forbidden characters."
SiBr4 (talk) 15:28, 24 June 2015 (UTC)[reply]