Template:Example: Difference between revisions

Revert to revision 131597 by Coderjoe (talk) I forgot what things look like with declare
(try putting the section markup in the page using the template)
(Revert to revision 131597 by Coderjoe (talk) I forgot what things look like with declare)
 
(6 intermediate revisions by the same user not shown)
Line 1:
{{#if: {{{langpage|}}} | <span id="{{{language}}}">[[:Category:{{{language}}}|{{{langpage}}}]]</span> | [[:Category:{{{language}}}|{{{language}}}]] }}{{#declare:example of=task|implemented in language=language}}<noinclude><br/>
__NOTOC__
{{#set:example of={{{task}}}}}
{{#set:implemented in language={{#if: {{{langpage|}}} | {{{langpage}}} |{{{language}}}}}}}
{{#if: {{{langpage|}}} | <span id="{{{language}}}">[[:Category:{{{language}}}|{{{langpage}}}]]</span> | [[:Category:{{{language}}}|{{{language}}}]] }}<noinclude>
Sets up an example page
{|
Line 17 ⟶ 14:
|(optional) The pagename of the language, if different (for example: C_sharp for C#)
|}
 
For example, when adding an example of the [[Hough transform]] implemented in C++, you would put this at the top of your example page:
<nowiki>=={{example|task=Hough transform|language=C++}}==</nowiki>
 
If you are adding an example in a language that needs a special page title, such as C#, you would put this at the top of your example page:
<nowiki>=={{example|task=Hough transform|language=C#|langpage=C_sharp}}==</nowiki>
 
Unfortunately, the header markup needs to be in the page that uses the template, rather than the template itself. Otherwise, you won't see edit links.
 
{{template}}</noinclude>
Anonymous user