Help:Script Samples: Difference between revisions

Content deleted Content added
Tag: 2017 source edit
 
(13 intermediate revisions by 2 users not shown)
Line 173:
 
== 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>&lt;syntaxhighlight lang="text" highlight="8-11" class="scroll"&gt;</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
 
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><code>&lt;/syntaxhighlight&gt;</code><br>
 
<br><br>
----
<br><br>
 
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>
<code>&lt;syntaxhighlight lang="text" highlight="8-11" class="scroll"&gt;</code>
<syntaxhighlight lang="text" highlight="8-11" class="scroll">
Line 211 ⟶ 192:
</syntaxhighlight>
<code>&lt;/syntaxhighlight&gt;</code><br>
 
<br><br>
----
Demo of color coding using HTML markup and displaying line numbers:
<code>&lt;syntaxhighlight lang="texthtml4strict" highlight="8-11"line class="scrollinline"&gt;</code><syntaxhighlight lang="texthtml4strict" highlight="8-11"line class="scrollinline">
<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>&lt;/syntaxhighlight&gt;</code><br>
 
<br><br>
Line 354 ⟶ 349:
 
== 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}}
 
 
;Using double colons on each pre line:
<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 thisthe 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]]
}}
 
 
{| class="wikitable"
| {{rh}} | Code
| <pre>
# one
#:&lt;pre&gt;
Line 365 ⟶ 373:
# two
</pre>
|-
 
| {{rh}} | Result
;Results in
|
# one
#:<pre class=scroll>
#::some stuff
#::some more stuff</pre>
</pre>
# two
|}
 
 
{{Tip|Because syntaxhighlight wraps everything in a <code>&lt;div&gt;</code> it works to indent with <code>;</code> and <code>:</code> as below}}
Line 411 ⟶ 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 ==