Help:Script Samples: Difference between revisions
Content deleted Content added
Caleb Cooper (talk | contribs) No edit summary |
Caleb Cooper (talk | contribs) Tag: 2017 source edit |
||
| (31 intermediate revisions by 2 users not shown) | |||
Line 126:
</pre>
|
Default Behavior text is wrapped
|-
|
;scroll
<code>class="scroll"</code>
|
<pre>
Line 144 ⟶ 145:
|
;inline
<code>class="inline"</code>
|
<pre>
<syntaxhighlight lang="
(define-behavior (bounce
:start-when (or (bump?)
Line 157 ⟶ 159:
</pre>
|
<syntaxhighlight lang="
(define-behavior (bounce
:start-when (or (bump?)
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>
<code><syntaxhighlight lang="text" highlight="8-11" class="scroll"></code>
<syntaxhighlight lang="text" highlight="8-11" class="scroll">
map profile show where ManagementApp FLUIDFS
<60756 (?)>
[60756] Mapping:MappingProfile 02/15/2013 12:53:34 AM
Line 183 ⟶ 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>
----
<br><br>
It is also possible to number the lines of code as demonstrated below:<br><br>
<code><syntaxhighlight lang="html4strict" line start="100" highlight="5" enclose="div"></code>
<syntaxhighlight lang="html4strict" line start="100" highlight="5" enclose="div">
<!--This is a comment. Comments are not displayed in the browser-->
<table align=center style="background: ivory;color:maroon;font-style:italic;font-family:arial;font-weight:bold;font-size:10pt;">
<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/>
== Changing Colours ==
! 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 (?)>
Line 263 ⟶ 341:
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><
| 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
[[File:Pre in a numbered list.png]]
}}
Line 324 ⟶ 377:
|
# one
#
#::some stuff
#::some more stuff
</pre>
# two
|}
Line 369 ⟶ 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 ==
Line 461 ⟶ 518:
<br>
=== Highlighting ===
{| class="wikitable"
! class !! Code !! Result !! style="width:200px;" | Colour
|-
|
NA
|
<pre>
<syntaxhighlight lang=text highlight="2" inline">
line one
line two
line three
line four
</syntaxhighlight>
</pre>
|
<syntaxhighlight lang=text highlight="2" inline">
line one
line two
line three
line four
</syntaxhighlight>
|
Mediawiki Default Yellow Highlight
|-
|
;orange-highlight
<code>class="orange-highlight"</code>
|
<pre>
<syntaxhighlight lang=text highlight="3" class="orange-highlight inline">
line one
line two
line three
line four
</syntaxhighlight>
</pre>
|
<syntaxhighlight lang=text highlight="3" class="orange-highlight inline">
line one
line two
line three
line four
</syntaxhighlight>
|
Fluorescent Orange
|-
|
;green-highlight
<code>class="green-highlight"</code>
|
<pre>
<syntaxhighlight lang=text highlight="1" class="green-highlight inline">
line one
line two
line three
line four
</syntaxhighlight>
</pre>
|
<syntaxhighlight lang=text highlight="1" class="green-highlight inline">
line one
line two
line three
line four
</syntaxhighlight>
| Fluorescent Green
|-
|
;pink-highlight
<code>class="pink-highlight"</code>
|
<pre>
<syntaxhighlight lang=text highlight="4" class="pink-highlight inline">
line one
line two
line three
line four
</syntaxhighlight>
</pre>
|
<syntaxhighlight lang=text highlight="4" class="pink-highlight inline">
line one
line two
line three
line four
</syntaxhighlight>
| Fluorescent Pink
|-
|
;blue-highlight
<code>class="blue-highlight"</code>
|
<pre>
<syntaxhighlight lang=text highlight="3" class="blue-highlight inline">
line one
line two
line three
line four
</syntaxhighlight>
</pre>
|
<syntaxhighlight lang=text highlight="3" class="blue-highlight inline">
line one
line two
line three
line four
</syntaxhighlight>
| Fluorescent Blue
|-
|}
| |||