Changes

Jump to: navigation, search

User:Lakrits/sandbox3

31 bytes removed, 16:02, 7 January 2015
-
However, if the template is called with the code string {{tlc|Linguist|latin{{=}}yes}}, and no space at all is included in the template code, the words "''Greek''" and "''and''" will be merged into "''Greekand''".
{| class="wikitable" style="background-color: white;"
! Template code !! "{{parasamp|latin|plain=yes}} " invoked !! Output
|-
| rowspan="2" | {{code|He speaks Greek<nowiki>{{#if:{{{latin|}}}|and Latin}}</nowiki>.}} || {{no}} || {{samp|He speaks Greek.}}
Including a space inside the function will give the same output as in example 1, since (as mentioned above) all leading and trailing spaces are trimmed.
{| class="wikitable" style="background-color: white;"
! Template code !! "{{parasamp|latin|plain=yes}} " invoked !! Output
|-
| rowspan="2" | <code>He speaks Greek<nowiki>{{#if:{{{latin|}}}|</nowiki><span style="background-color: #0095dd;"> </span><nowiki>and Latin}}</nowiki>.</code> || {{no}} || {{samp|He speaks Greek.}}
;<big>3. Space outside function</big>
If the space instead is placed outside the function, the template will work when including the sub-string. But, if {{para|latin}} is left out, this code will output a space between the last word and the full stop.
{| class="wikitable" style="background-color: white;"
! Template code !! "{{parasamp|latin|plain=yes}} " invoked !! Output
|-
| rowspan="2" | <code>He speaks Greek<span style="background-color: #0095dd;"> </span><nowiki>{{#if:{{{latin|}}}|and Latin}}</nowiki>.</code> || {{no}} || <samp>He speaks Greek<span style="background-color: #0095dd;"> </span>.</samp>
Using this template to add a space before the optional string (i.e. {{samp|<nowiki>{{sp}}</nowiki>and Latin}}), you will get the correct output both when leaving out {{para|latin}}, and when it's invoked.
{| class="wikitable" style="background-color: white;"
! Template code !! "{{parasamp|latin|plain=yes}} " invoked !! Output
|-
| rowspan="2" | <code>He speaks Greek<nowiki>{{#if:{{{latin|}}}|</nowiki><span style="color: #ffffff; background-color: #0095dd;"><nowiki>{{sp}}</nowiki></span><nowiki>and Latin}}</nowiki>.</code> || {{no}} || {{samp|He speaks Greek.}}
3,860
edits

Navigation menu