Help:Script Samples: Difference between revisions
Content deleted Content added
Caleb Cooper (talk | contribs) |
Caleb Cooper (talk | contribs) Tag: 2017 source edit |
||
| (18 intermediate revisions by 2 users not shown) | |||
Line 130:
|
;scroll
|
<pre>
Line 145:
|
;inline
|
<pre>
Line 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 189 ⟶ 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
<code></syntaxhighlight></code><br>
<br><br>
----
Demo of color coding using HTML markup and displaying line numbers:
<code><syntaxhighlight lang="html4strict" line class="inline"></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;">
<caption>This is the top caption</caption>
<tr><th> Heading 1 </th><th> Heading 2 </th></tr>
<tr>
<td style="padding:10px;"> This is cell 1 text </td>
<td style="padding:10px;"> This is cell 2 text </td>
</tr>
</table>
</syntaxhighlight><code></syntaxhighlight></code><br>
<br><br>
Line 232 ⟶ 225:
<code></syntaxhighlight></code>
<br/><br/>
== Changing Colours ==
{| class="wikitable"
! class !! Code !! Result !! style="width:200px;" | When to use
|-
|
;blue-white
<code>class=blue-white</code>
|
<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></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>
<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>
</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>
<syntaxhighlight lang="text" highlight="9" class="black-green scroll">
TEXT BASED TABLE OUTPUT HERE
</syntaxhighlight>
</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><pre></code> tags ==
{{Caution|The only reliable way to get indents with <code><pre></code> tags is to use: <code>{{indent{{!}}<pre> code here <p/pre>}}</code>; <br /> For <code><code></code> and <code><syntaxhighlight></code> tags a <code>:</code> works fine}}
<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 250 ⟶ 377:
|
# one
#
#::some stuff
#::some more stuff
</pre>
# two
|}
Line 295 ⟶ 423:
<pre>
;Same works for code tags:
:<code>Indented code snippet</code>
</pre>
;Same works for code tags:
:<code>Indented code snippet</code>
== Annotate <code><pre></code> contents with Pointers / Boxes ==
| |||