Template talk:Code

From Amahi Wiki
Revision as of 01:44, 6 February 2011 by Smystaki (talk | contribs)
Jump to: navigation, search

Code Formatting

To add formatting to code, we have a little code template that can be used like this:

Description You type You get
boxed code
{{Code|lang = Bash |
Code = bash$ ls -l
total 696
...
bash$ 
}}
Bash code
​bash$ ls -l total 696 ... bash$​

lang parameter is optional default = text.

{{Code|
Code = bash$ ls -l
total 696
...
bash$ 
}}

Code Parameter name is optional. You have to use in case there are wiki symbols involeved If you type

{{Code|​irc://<YouHdaIp>:26244/<channel>/?pass=<ZncUser>:<ZncUserPass>​}}

you get

bash code
{{{1}}}

But

{{Code|Code= ​irc://<YouHdaIp>:26244/<channel>/?pass=<ZncUser>:<ZncUserPass>​}}
bash code
​​irc://<YouHdaIp>:26244/<channel>/?pass=<ZncUser>:<ZncUserPass>​​


If you type

{{Code|
  Code= jQuery(document).ready(function(){ 
  jQuery("#slider").easySlider({
   auto: true,
   continuous: true,
   controlsShow: false,	
   prevText: '',
   nextText: '',
   pause: 3000
  });
 });​}}

you get

bash code
​jQuery(document).ready(function(){ jQuery("#slider").easySlider({ auto: true, continuous: true, controlsShow: false, prevText: '', nextText: '', pause: 3000 }); });​​


BUT

{{Code|lang=JavaScript|
  Code= jQuery(document).ready(function(){ 
  jQuery("#slider").easySlider({
   auto: true,
   continuous: true,
   controlsShow: false,	
   prevText: '',
   nextText: '',
   pause: 3000
  });
 });​}}
JavaScript code
jQuery(document).ready(function(){ jQuery("#slider").easySlider({ auto: true, continuous: true, controlsShow: false, prevText: '', nextText: '', pause: 3000 }); });​​