Help:Script Samples: Difference between revisions

Content deleted Content added
Tag: 2017 source edit
 
(21 intermediate revisions by 2 users not shown)
Line 130:
|
;scroll
<code>class="scroll"</code>
|
<pre>
Line 144 ⟶ 145:
|
;inline
<code>class="inline"</code>
|
<pre>
Line 170 ⟶ 172:
|}
 
== Syntax Highlighting ==
 
<br><br>
 
If a programming language is not used the language can be specified as '''text''', also the highlight attribute can be set to highlight lines of code:<br><br>
Line 187 ⟶ 190:
17 8 8 Cluster FS8600 18 15 18 0 4 0 60757 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60757
Walk: Display 4 of 4
</syntaxhighlight><br><br>
<code>&lt;/syntaxhighlight&gt;</code><br>
 
<br><br>
----
Demo of color coding using HTML markup and displaying line numbers:
<br><br>
<code>&lt;syntaxhighlight lang="html4strict" line class="inline"&gt;</code><syntaxhighlight lang="html4strict" line class="inline">
 
<table align=center style="background: ivory;color:maroon;font-style:italic;font-family:arial;font-weight:bold;font-size:10pt;">
This is the only example where it looks different in IE and the other browsers if the code is longer than the page and width is not set, IE will add scroll bars automatically no other browser will:<br><br>
<caption>This is the top caption</caption>
<code>&lt;syntaxhighlight lang="text" highlight="8-11" class="scroll"&gt;</code>
<tr><th> Heading 1 </th><th> Heading 2 </th></tr>
<syntaxhighlight lang="text" highlight="8-11" class="scroll">
<tr>
map profile show where ManagementApp FLUIDFS
<td style="padding:10px;"> This is cell 1 text </td>
<60756 (?)>
<td style="padding:10px;"> This is cell 2 text </td>
[60756] Mapping:MappingProfile 02/15/2013 12:53:34 AM
</tr>
 
</table>
Index Server Server Volume MZ MZ MultiPat LUN Persona Personali Boot Write VM Managemen Admin DebugOu Active Bad Path LUN OS OS ManagementApp Active
</syntaxhighlight><code>&lt;/syntaxhighlight&gt;</code><br>
Name Subsyst VolumeI Max Actual Preferr Actual Volume Protect Connect Status PathCo PathCo DownCo OnlyOne Product Version Controller
======= ======== =================================== ======= ======= ======= ======== ====== ======= ========= ======= ======= ========= ========= ======== ======= ====== ====== ====== ========= ============ ============ ============================== ==========
14 8 8 Cluster FS8600 15 15 15 0 1 0 60756 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60756
15 8 8 Cluster FS8600 16 15 16 0 2 0 60757 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60757
16 8 8 Cluster FS8600 17 15 17 0 3 0 60756 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60756
17 8 8 Cluster FS8600 18 15 18 0 4 0 60757 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60757
Walk: Display 4 of 4
</syntaxhighlight>
<code>&lt;/syntaxhighlight&gt;</code><br>
 
<br><br>
Line 230 ⟶ 225:
<code>&lt;/syntaxhighlight&gt;</code>
<br/><br/>
 
== Changing Colours ==
{| class="wikitable"
! class !! Code !! Result !! style="width:200px;" | When to use
|-
|
;blue-white
<code>class=blue-white</code>
|
<pre>
&lt;pre class="blue-white"&gt;
buffer = OPENSSL_malloc(1 + 2 + payload + padding);
bp = buffer;
/* Enter response type, length and copy payload */
*bp++ = TLS1_HB_RESPONSE;
s2n(payload, bp);
memcpy(bp, pl, payload);
bp += payload;
/* Random padding */
RAND_pseudo_bytes(bp, padding);
&lt;/pre&gt;</pre>
</pre>
|
<pre class="blue-white">
buffer = OPENSSL_malloc(1 + 2 + payload + padding);
bp = buffer;
/* Enter response type, length and copy payload */
*bp++ = TLS1_HB_RESPONSE;
s2n(payload, bp);
memcpy(bp, pl, payload);
bp += payload;
/* Random padding */
RAND_pseudo_bytes(bp, padding);
</pre>
|
White on a Blue background
|-
|
;black-white
<code>class=black-white</code>
|
<pre>
&lt;syntaxhighlight lang="javascript" highlight="13" class="black-white"&gt;
JSFX.FireSpark.prototype.changeColour = function()
{
var colour="";
 
r2= Math.random()*255;
g2= r2;
b2= 0;
 
if(!(r2 | g2 | b2))
{
r2=255;
g2=255;
b2=0;
}
 
colour = "#" + dec2hex(r2) + dec2hex(g2) + dec2hex(b2);
this.setBgColor(colour);
}
&lt;/syntaxhighlight&gt;
</pre>
|
<div style="width:400px;">
<syntaxhighlight lang="javascript" highlight="13" class="black-white">
JSFX.FireSpark.prototype.changeColour = function()
{
var colour="";
 
r2= Math.random()*255;
g2= r2;
b2= 0;
 
if(!(r2 | g2 | b2))
{
r2=255;
g2=255;
b2=0;
}
 
colour = "#" + dec2hex(r2) + dec2hex(g2) + dec2hex(b2);
this.setBgColor(colour);
}
</syntaxhighlight></div>
|
White on a black background
|-
|
;black-green
<code>class=black-green</code>
|
<pre>
&lt;syntaxhighlight lang="text" highlight="9" class="black-green scroll"&gt;
 
TEXT BASED TABLE OUTPUT HERE
 
&lt;/syntaxhighlight&gt;
</pre>
|
<div style="width:400px;">
<syntaxhighlight lang="text" highlight="9" class="black-green scroll">
map profile show where ManagementApp FLUIDFS
<60756 (?)>
[60756] Mapping:MappingProfile 02/15/2013 12:53:34 AM
 
Index Server Server Volume MZ MZ MultiPat LUN Persona Personali Boot Write VM Managemen Admin DebugOu Active Bad Path LUN OS OS ManagementApp Active
Name Subsyst VolumeI Max Actual Preferr Actual Volume Protect Connect Status PathCo PathCo DownCo OnlyOne Product Version Controller
======= ======== =================================== ======= ======= ======= ======== ====== ======= ========= ======= ======= ========= ========= ======== ======= ====== ====== ====== ========= ============ ============ ============================== ==========
14 8 8 Cluster FS8600 15 15 15 0 1 0 60756 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60756
15 8 8 Cluster FS8600 16 15 16 0 2 0 60757 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60757
16 8 8 Cluster FS8600 17 15 17 0 3 0 60756 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60756
17 8 8 Cluster FS8600 18 15 18 0 4 0 60757 (0) Fal (0) Fal (3) Both (1) Auto (1) Enab (0) Fal 0 0 0 42949672* Compellent FS8600 1.x FLUIDFS 60757
Walk: Display 4 of 4
</syntaxhighlight></div>
| Green on a Black background
|-
|}
 
 
 
== Indenting <code>&lt;pre&gt;</code> tags ==
{{Caution|The only reliable way to get indents with <code>&lt;pre></code> tags is to use: <code>{{indent{{!}}&lt;pre> code here &lt;p/pre>}}</code>; <br /> For <code>&lt;code></code> and <code>&lt;syntaxhighlight></code> tags a <code>:</code> works fine}}
{{Note|There is something intermittent about this working which I haven't figured out yet. It doesn't render correctly below but it does on other pages}}
 
 
<pre>
{{Indent|{{Pre|class=blue-white|# for i in $(diskview -I s {{!}} awk '/Online/{print $2}'); do echo -e "\n::: ${i} :::"; dd if{{eq}}/dev/rpd${i}d bs{{eq}}512 count{{eq}}1 of{{eq}}/pss/cc/o-dsb-${i}.bin; done}}}}
</pre>
{{Indent|{{Pre|class=blue-white|# for i in $(diskview -I s {{!}} awk '/Online/{print $2}'); do echo -e "\n::: ${i} :::"; dd if{{eq}}/dev/rpd${i}d bs{{eq}}512 count{{eq}}1 of{{eq}}/pss/cc/o-dsb-${i}.bin; done}}}}
 
 
{{Note|There is something intermittent about the method below working which I haven't figured out yet. It doesn't render correctly below but it does on other pages
 
[[File:Pre in a numbered list.png]]
}}
 
 
Line 248 ⟶ 377:
|
# one
#:<pre class=scroll>
#::some stuff
#::some more stuff</pre>
</pre>
# two
|}
Line 293 ⟶ 423:
 
<pre>
;Same works for code tags:
{{Indent|{{Pre|class=blue-white|# for i in $(diskview -I s {{!}} awk '/Online/{print $2}'); do echo -e "\n::: ${i} :::"; dd if{{eq}}/dev/rpd${i}d bs{{eq}}512 count{{eq}}1 of{{eq}}/pss/cc/o-dsb-${i}.bin; done}}}}
:&lt;code>Indented code snippet&lt;/code>
</pre>
 
{{Indent|{{Pre|class=blue-white|# for i in $(diskview -I s {{!}} awk '/Online/{print $2}'); do echo -e "\n::: ${i} :::"; dd if{{eq}}/dev/rpd${i}d bs{{eq}}512 count{{eq}}1 of{{eq}}/pss/cc/o-dsb-${i}.bin; done}}}}
;Same works for code tags:
:<code>Indented code snippet</code>
 
== Annotate <code>&lt;pre&gt;</code> contents with Pointers / Boxes ==
Line 383 ⟶ 516:
 
{{Caution|Note that <code>{{eq}}</code> and <code>{{!}}</code> always have to be escaped in templates, the templates <code>&#123;&#123;!&#125;&#125;</code> and <code>&#123;&#123;eq&#125;&#125;</code> have been provided for this purpose, example below requiring this. Also it is not possible to use <code>:</code> for indents, use <code>&#123;&#123;Indent&#125;&#125;</code> template instead}}
 
 
<br>
 
=== Highlighting ===
Line 411 ⟶ 547:
|
;orange-highlight
<code>class="orange-highlight"</code>
|
<pre>
Line 432 ⟶ 569:
|
;green-highlight
<code>class="green-highlight"</code>
|
<pre>
Line 452 ⟶ 590:
|
;pink-highlight
<code>class="pink-highlight"</code>
|
<pre>
Line 472 ⟶ 611:
|
;blue-highlight
<code>class="blue-highlight"</code>
|
<pre>