Template:CodeSample: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle mNo edit summary |
imported>StDoodle mNo edit summary |
||
Line 1: | Line 1: | ||
<includeonly>{{#if: {{{title|}}}|<h2>{{{title}}}</h2>}}{{#if: {{{description|}}}|<p>{{{description}}}</p>}}<div style="margin-bottom: 1em; border: dashed 1px green; padding: 1em;">{{{code}}}</div>{{#if: {{{moreinfo|}}}|{{{moreinfo}}}}}</includeonly> | <includeonly>{{#if: {{{title|}}}|<h2>{{{title}}}</h2>}}{{#if: {{{description|}}}|<p>{{{description}}}</p>}}<div style="margin-bottom: 1em; border: dashed 1px green; padding: 1em;" title="Note: All functions (shown in blue) have their own page on the wiki you can look up for more information.">{{{code}}}</div>{{#if: {{{moreinfo|}}}|{{{moreinfo}}}}}</includeonly> | ||
<noinclude> | <noinclude> | ||
<p>Uses the named parameters ''title'', ''description'' and ''code'' to display a code block & its information.</p> | <p>Uses the named parameters ''title'', ''description'' and ''code'' to display a code block & its information.</p> |
Revision as of 02:00, 13 March 2010
Uses the named parameters title, description and code to display a code block & its information.
Note that only code is required; the title and description are optional.
A sample call to this template:
{{CodeSample| title=Sample Code| description=Some basic sample code.| code= <syntaxhighlight> int i = 1; //this line is useless! if (to_int(my_id()) > 1) { print("Aw, I guess you aren't Jick."); } </syntaxhighlight> }}
Which produces the following:
Sample Code
Some basic sample code.
int i = 1; //this line is useless!
if (to_int(my_id()) > 1) {
print("Aw, I guess you aren't Jick.");
}