Help:Script Samples: Difference between revisions

Content deleted Content added
Tag: 2017 source edit
 
(8 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="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;">
<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>
----
<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 207 ⟶ 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="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;">
<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 350 ⟶ 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}}
 
 
<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]]
}}
 
 
Line 366 ⟶ 377:
|
# one
#:<pre class=scroll>
#::some stuff
#::some more stuff</pre>
</pre>
# two
|}
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 ==