User:Lakrits/sandbox3: Difference between revisions

Jump to navigation Jump to search
-
(-)
(-)
Line 24: Line 24:
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''".
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;"
{| class="wikitable" style="background-color: white;"
! Template code !! {{para|latin|plain=yes}} invoked !! Output
! Template code !! "{{samp|latin}}" invoked !! Output
|-
|-
| rowspan="2" | {{code|He speaks Greek<nowiki>{{#if:{{{latin|}}}|and Latin}}</nowiki>.}} || {{no}} || {{samp|He speaks Greek.}}
| rowspan="2" | {{code|He speaks Greek<nowiki>{{#if:{{{latin|}}}|and Latin}}</nowiki>.}} || {{no}} || {{samp|He speaks Greek.}}
Line 34: Line 34:
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.
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;"
{| class="wikitable" style="background-color: white;"
! Template code !! {{para|latin|plain=yes}} invoked !! Output
! Template code !! "{{samp|latin}}" 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.}}
| 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.}}
Line 42: Line 42:


;<big>3. Space outside function</big>
;<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
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;"
{| class="wikitable" style="background-color: white;"
! Template code !! {{para|latin|plain=yes}} invoked !! Output
! Template code !! "{{samp|latin}}" 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>
| 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>
Line 55: Line 55:
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.
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;"
{| class="wikitable" style="background-color: white;"
! Template code !! {{para|latin|plain=yes}} invoked !! Output
! Template code !! "{{samp|latin}}" 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.}}
| 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