Difference between revisions of "Template:Dfn/testcases"
imported>SMcCandlish (live vs. sandbox code) |
imported>SMcCandlish (more test from the dox) |
||
| Line 103: | Line 103: | ||
:{{tlx|dfn|"Teenage Wasteland"<nowiki>{{sic}}</nowiki>|title{{=}}&quot;Baba O'Riley&quot;}} which results in: {{dfn/sandbox|"Teenage Wasteland"{{sic}}|title="Baba O'Riley"}} | :{{tlx|dfn|"Teenage Wasteland"<nowiki>{{sic}}</nowiki>|title{{=}}&quot;Baba O'Riley&quot;}} which results in: {{dfn/sandbox|"Teenage Wasteland"{{sic}}|title="Baba O'Riley"}} | ||
:{{tnull|dfn|Mac OS X Lion|title{{=}}Mac OS X 10.7 &quot;Lion&quot;}} results in: {{dfn/sandbox|Mac OS X Lion|title=Mac OS X 10.7 "Lion"}} | :{{tnull|dfn|Mac OS X Lion|title{{=}}Mac OS X 10.7 &quot;Lion&quot;}} results in: {{dfn/sandbox|Mac OS X Lion|title=Mac OS X 10.7 "Lion"}} | ||
| + | |||
| + | ... | ||
| + | |||
| + | Linked version: | ||
| + | |||
| + | Live: | ||
| + | :<code>[<nowiki />[Mass–energy equivalence|{{tnull|dfn|1{{=}}E{{=}}MC<sup>2</sup>|2{{=}}Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title{{=}}E{{=}}MC&sup2;}}]<nowiki />]</code> | ||
| + | gives: | ||
| + | :[[Mass–energy equivalence|{{dfn|1=E=MC<sup>2</sup>|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}]] | ||
| + | |||
| + | Sandbox: | ||
| + | :<code>[<nowiki />[Mass–energy equivalence|{{tnull|dfn/sandbox|1{{=}}E{{=}}MC<sup>2</sup>|2{{=}}Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title{{=}}E{{=}}MC&sup2;}}]<nowiki />]</code> | ||
| + | gives: | ||
| + | :[[Mass–energy equivalence|{{dfn/sandbox|1=E=MC<sup>2</sup>|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}]] | ||
| + | It still has a dotted underline indicating a tooltip, but is also a bluelink. Mouse hovering shows both the tooltip and, in the status bar, the target URL, in browsers that support these features. | ||
| + | |||
| + | It still has a dotted underline indicating a tooltip, but is also a bluelink. Mouse hovering shows both the tooltip and, in the status bar, the target URL, in browsers that support these features. | ||
| + | |||
| + | |||
| + | Link inside the {{tnull|dfn}}: | ||
| + | |||
| + | Live: | ||
| + | :{{tnull|dfn|1{{=}}[<nowiki />[Mass–energy equivalence{{!}}E{{=}}MC<sup>2</sup>]<nowiki />]|2{{=}}Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title{{=}}E{{=}}MC&sup2;}} | ||
| + | results in: | ||
| + | :{{dfn|1=[[Mass–energy equivalence|E=MC<sup>2</sup>]]|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}} | ||
| + | |||
| + | Sandbox: | ||
| + | :{{tnull|dfn/sandbox|1{{=}}[<nowiki />[Mass–energy equivalence{{!}}E{{=}}MC<sup>2</sup>]<nowiki />]|2{{=}}Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title{{=}}E{{=}}MC&sup2;}} | ||
| + | results in: | ||
| + | :{{dfn/sandbox|1=[[Mass–energy equivalence|E=MC<sup>2</sup>]]|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}} | ||
| + | |||
| + | This doesn't mess up the page, but the <var>description</var> fails and there's no tooltip cursor, meanwhile the markup is hard for other editors to understand anyway so it is {{strongbad|deprecated}}. | ||
Revision as of 00:16, 13 February 2012
Normalized basic testcases
|
|
Some wording from the docs with test cases
If there would be a "=" (equals sign) in the term, either a) both unnamed parameters if present must explicitly be numbered:
- Live:
{{dfn|1=E=MC2|2=Mass–energy equivalence}}which results in: E=MC2 - Sandbox:
{{dfn|1=E=MC2|2=Mass–energy equivalence}}which results in: E=MC2
or b) the character itself can be escaped as the HTML character entity reference code = or the {{=}} template:
Live:
{{dfn|E=MC2|Mass–energy equivalence}}which results in: E=MC2{{dfn|E{{=}}MC2|Mass–energy equivalence|title=E=MC²}}which results in: E=MC2
Sandbox:
{{dfn|E=MC2|Mass–energy equivalence}}which results in: E=MC2{{dfn|E{{=}}MC2|Mass–energy equivalence|title=E=MC²}}which results in: E=MC2
For technical reasons, the second parameter (|2=, the definition) is more "brittle". The equals sign (=) must be escaped by one of the techniques just mentioned, and the standard keyboard (straight, not curly) double-quotation mark (") must also be escaped, no matter what, as " or ". This double-quote must also be escaped the same way in the |title= parameter:
Live:
{{dfn|1=ACT UP's slogan|2="Silence = Death"}}which results in: ACT UP's slogan{{dfn|ACT UP's slogan|"Silence {{=}} Death"}}which results in: ACT UP's slogan{{dfn|ACT UP's slogan|"Silence = Death"}}which results in: ACT UP's slogan{{dfn|"Teenage Wasteland"{{sic}}|title="Baba O'Riley"}}which results in: "Teenage Wasteland"Template:Sic{{dfn|Mac OS X Lion|title=Mac OS X 10.7 "Lion"}}results in: Mac OS X Lion
Sandbox:
{{dfn|1=ACT UP's slogan|2="Silence = Death"}}which results in: ACT UP's slogan{{dfn|ACT UP's slogan|"Silence {{=}} Death"}}which results in: ACT UP's slogan{{dfn|ACT UP's slogan|"Silence = Death"}}which results in: ACT UP's slogan{{dfn|"Teenage Wasteland"{{sic}}|title="Baba O'Riley"}}which results in: "Teenage Wasteland"Template:Sic{{dfn|Mac OS X Lion|title=Mac OS X 10.7 "Lion"}}results in: Mac OS X Lion
...
Linked version:
Live:
[[Mass–energy equivalence|{{dfn|1=E=MC2|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}]]
gives:
Sandbox:
[[Mass–energy equivalence|{{dfn/sandbox|1=E=MC2|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}]]
gives:
It still has a dotted underline indicating a tooltip, but is also a bluelink. Mouse hovering shows both the tooltip and, in the status bar, the target URL, in browsers that support these features.
It still has a dotted underline indicating a tooltip, but is also a bluelink. Mouse hovering shows both the tooltip and, in the status bar, the target URL, in browsers that support these features.
Link inside the {{dfn}}:
Live:
{{dfn|1=[[Mass–energy equivalence|E=MC2]]|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}
results in:
Sandbox:
{{dfn/sandbox|1=[[Mass–energy equivalence|E=MC2]]|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}
results in:
This doesn't mess up the page, but the description fails and there's no tooltip cursor, meanwhile the markup is hard for other editors to understand anyway so it is deprecated.