Help:Script Samples: Difference between revisions
Content deleted Content added
Caleb Cooper (talk | contribs) Undo revision 11075 by Caleb Cooper (talk) Tag: Undo |
Caleb Cooper (talk | contribs) Tag: 2017 source edit |
||
| (12 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><syntaxhighlight lang="text" highlight="8-11" class="scroll"></code><syntaxhighlight lang="text" highlight="8-11" class="scroll">▼
</syntaxhighlight><code></syntaxhighlight></code><br>▼
▲<br><br>
----▼
<br><br>▼
<code><syntaxhighlight lang="text" highlight="8-11" class="scroll"></code>
<syntaxhighlight lang="text" highlight="8-11" class="scroll">
Line 211 ⟶ 192:
</syntaxhighlight>
<code></syntaxhighlight></code><br>
▲<br><br>
▲----
Demo of color coding using HTML markup and displaying line numbers:
▲<code><syntaxhighlight lang="
<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 354 ⟶ 349:
== 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}}
{{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
[[File:Pre in a numbered list.png]]
}}
Line 370 ⟶ 377:
|
# one
#
#::some stuff
#::some more stuff
</pre>
# two
|}
Line 415 ⟶ 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}}}}
:<code>Indented code snippet</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><pre></code> contents with Pointers / Boxes ==
| |||