Difference between revisions of "Template talk:Code"

From Amahi Wiki
Jump to: navigation, search
Line 29: Line 29:
 
|
 
|
 
<pre>
 
<pre>
{{Code|Lang = Bash |
+
{{Code|lang = Bash |
 
Code = bash$ ls -l
 
Code = bash$ ls -l
 
total 696
 
total 696
Line 38: Line 38:
 
|
 
|
 
{|
 
{|
{{Code|Lang = Bash |
+
{{Code|lang = Bash |
 
Code = bash$ ls -l
 
Code = bash$ ls -l
 
total 696
 
total 696
Line 47: Line 47:
 
|}
 
|}
  
Lang parameter is optional default = text.  
+
lang parameter is optional default = text.  
  
 
<pre>
 
<pre>
Line 99: Line 99:
  
 
BUT
 
BUT
{{Code|Lang=JavaScript|
+
<pre>
 +
{{Code|lang=JavaScript|
 +
  Code= jQuery(document).ready(function(){
 +
  jQuery("#slider").easySlider({
 +
  auto: true,
 +
  continuous: true,
 +
  controlsShow: false,
 +
  prevText: '',
 +
  nextText: '',
 +
  pause: 3000
 +
  });
 +
});​}}
 +
</pre>
 +
 
 +
{{Code|lang=JavaScript|
 
   Code= jQuery(document).ready(function(){  
 
   Code= jQuery(document).ready(function(){  
 
   jQuery("#slider").easySlider({
 
   jQuery("#slider").easySlider({
Line 110: Line 124:
 
   });
 
   });
 
  });​}}
 
  });​}}
 +
 
[[Category:Help]]
 
[[Category:Help]]

Revision as of 01:44, 6 February 2011


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 }); });​​