Difference between revisions of "wiki documentation"

From Lazarus wiki
Jump to navigationJump to search
(Syntax Highlighting)
(→‎Syntax Highlighting: documented new syntax highlighter.)
Line 10: Line 10:
  
 
=== Syntax Highlighting ===
 
=== Syntax Highlighting ===
A Wiki for a programming language site needs a powerful way of showing source code in readable fashion. Therefore we use an automatic syntax highlighter to add sources. Use the "<delphi>" tags for FPC code and the "<xml>" tag for XML code. The following example shows the use of the syntax highlighter in this Wiki:
+
A Wiki for a programming language site needs a powerful way of showing source code in readable fashion. Therefore we use an automatic syntax highlighter to for sources. Use the "<source>" or "<syntaxhighlight> tag for FPC code. Delphi language is the default highlighter language. For a list of supported languages see the [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages highlighter docs]. For XML code, use <syntaxhighlight lang="xml">. The following example shows the use of the syntax highlighter in this Wiki:
 
<pre>
 
<pre>
<delphi>
+
<source>
 
Program Test;
 
Program Test;
 
Uses Crt;
 
Uses Crt;
Line 22: Line 22:
 
     WriteLn('Test ',I:2);
 
     WriteLn('Test ',I:2);
 
End.
 
End.
</delphi>
+
</source>
 
</pre>
 
</pre>
 
results in this output
 
results in this output
<delphi>
+
<source>
 
Program Test;
 
Program Test;
 
Uses Crt;
 
Uses Crt;
Line 35: Line 35:
 
     WriteLn('Test ',I:2);
 
     WriteLn('Test ',I:2);
 
End.
 
End.
</delphi>
+
</source>
 
+
Below is an example for XML sources.
For XML sources use the "&lt;xml&gt;" and "&lt;/xml&gt;" tags.
 
 
<pre>
 
<pre>
<xml>
+
<syntaxhighlight lang="xml">
  <xs:complexType name="DecimalWithUnits">
+
<xs:complexType name="DecimalWithUnits">
    <xs:simpleContent>
+
  <xs:simpleContent>
      <xs:extension base="xs:decimal">
+
    <xs:extension base="xs:decimal">
        <xs:attribute name="Units" type="xs:string"
+
      <xs:attribute name="Units" type="xs:string"
                      use="required"/>
+
                    use="required"/>
      </xs:extension>
+
    </xs:extension>
    </xs:simpleContent>
+
  </xs:simpleContent>
  </xs:complexType>  
+
</xs:complexType>  
</xml>
+
</syntaxhighlight>
 
</pre>
 
</pre>
 
results in
 
results in
<xml>
+
<syntaxhighlight lang="xml">
  <xs:complexType name="DecimalWithUnits">
+
<xs:complexType name="DecimalWithUnits">
    <xs:simpleContent>
+
  <xs:simpleContent>
      <xs:extension base="xs:decimal">
+
    <xs:extension base="xs:decimal">
        <xs:attribute name="Units" type="xs:string"
+
      <xs:attribute name="Units" type="xs:string"
                      use="required"/>
+
                    use="required"/>
      </xs:extension>
+
    </xs:extension>
    </xs:simpleContent>
+
  </xs:simpleContent>
  </xs:complexType>  
+
</xs:complexType>  
</xml>
+
</syntaxhighlight>
  
 
For program output or other verbatim quotes please use the "&lt;pre&gt;" and "&lt;/pre&gt;" tags.
 
For program output or other verbatim quotes please use the "&lt;pre&gt;" and "&lt;/pre&gt;" tags.
  
 
Note that the syntax highlighter will be changed in the future. Currently MediaWiki 1.9 is installed and uses an unofficial syntax highlighter. Within a year MediaWiki 1.10 will be installed, which has an official syntax highlighter. This will require a different syntax: &lt;source lang="delphi"&gt;.
 
Note that the syntax highlighter will be changed in the future. Currently MediaWiki 1.9 is installed and uses an unofficial syntax highlighter. Within a year MediaWiki 1.10 will be installed, which has an official syntax highlighter. This will require a different syntax: &lt;source lang="delphi"&gt;.

Revision as of 14:41, 23 March 2012

Guide to Wiki Editing

Overview

Tutorials

A Sand Box is available for practice.

If you have any problems, please notify the site administrator or post a bug report on the Lazarus-CCR SF site. You can also leave a note or suggestion on our Site Feedback page.

Syntax Highlighting

A Wiki for a programming language site needs a powerful way of showing source code in readable fashion. Therefore we use an automatic syntax highlighter to for sources. Use the "<source>" or "<syntaxhighlight> tag for FPC code. Delphi language is the default highlighter language. For a list of supported languages see the highlighter docs. For XML code, use <syntaxhighlight lang="xml">. The following example shows the use of the syntax highlighter in this Wiki:

<source>
Program Test;
Uses Crt;

Var I : Integer;

Begin
  For I := 0 to 12 do
    WriteLn('Test ',I:2);
End.
</source>

results in this output

Program Test;
Uses Crt;

Var I : Integer;

Begin
  For I := 0 to 12 do
    WriteLn('Test ',I:2);
End.

Below is an example for XML sources.

<syntaxhighlight lang="xml">
<xs:complexType name="DecimalWithUnits">
  <xs:simpleContent>
    <xs:extension base="xs:decimal">
      <xs:attribute name="Units" type="xs:string"
                    use="required"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType> 
</syntaxhighlight>

results in

<xs:complexType name="DecimalWithUnits">
  <xs:simpleContent>
    <xs:extension base="xs:decimal">
      <xs:attribute name="Units" type="xs:string"
                    use="required"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

For program output or other verbatim quotes please use the "<pre>" and "</pre>" tags.

Note that the syntax highlighter will be changed in the future. Currently MediaWiki 1.9 is installed and uses an unofficial syntax highlighter. Within a year MediaWiki 1.10 will be installed, which has an official syntax highlighter. This will require a different syntax: <source lang="delphi">.