Difference between revisions of "wiki documentation"

From Lazarus wiki
Jump to navigationJump to search
(note)
(→‎Syntax Highlighting: Prefer syntaxhighlight; add relevant examples for often used languages (aparat from FPC))
Line 13: Line 13:
 
=== 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 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:
+
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 "<syntaxhighlight> tag for FPC code (the Delphi language is the default highlighter language)
 +
 
 +
Note: "<source>" could also work but is not recommended (see [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Alternative_.3Csource.3E_tag highlighter docs])
 +
 
 +
More languages are supported; for a list, see the [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages highlighter docs].  
 +
* for XML code, use <syntaxhighlight lang="xml">.  
 +
* for SQL code, use <syntaxhighlight lang="sql">.
 +
* for DOS/CMD window code, use <syntaxhighlight lang="dos">.
 +
* for bash/shell script code, use <syntaxhighlight lang="bash">.
 +
 
 +
The following example shows the use of the syntax highlighter in this Wiki:
 
<pre>
 
<pre>
<source>
+
<syntaxhighlight>
 
Program Test;
 
Program Test;
 
Uses Crt;
 
Uses Crt;
Line 25: Line 37:
 
     WriteLn('Test ',I:2);
 
     WriteLn('Test ',I:2);
 
End.
 
End.
</source>
+
</syntaxhighlight>
 
</pre>
 
</pre>
 
results in this output
 
results in this output
<source>
+
<syntaxhighlight>
 
Program Test;
 
Program Test;
 
Uses Crt;
 
Uses Crt;
Line 38: Line 50:
 
     WriteLn('Test ',I:2);
 
     WriteLn('Test ',I:2);
 
End.
 
End.
</source>
+
</syntaxhighlight>
 
Below is an example for XML sources.
 
Below is an example for XML sources.
 
<pre>
 
<pre>

Revision as of 12:48, 1 April 2013

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 "<syntaxhighlight> tag for FPC code (the Delphi language is the default highlighter language)

Note: "<source>" could also work but is not recommended (see highlighter docs)

More languages are supported; for a list, see the highlighter docs.

  • for XML code, use <syntaxhighlight lang="xml">.
  • for SQL code, use <syntaxhighlight lang="sql">.
  • for DOS/CMD window code, use <syntaxhighlight lang="dos">.
  • for bash/shell script code, use <syntaxhighlight lang="bash">.

The following example shows the use of the syntax highlighter in this Wiki:

<syntaxhighlight>
Program Test;
Uses Crt;

Var I : Integer;

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

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.

Keyboard shortcuts

To display keyboard shortcuts use template Template:keypress:

{{keypress|Ctrl}}+{{keypress|F12}}

This will show as: Ctrl+F12

Note

To make text visible as note use template Note:

{{Note|This is note for reader}}

This will be displayed as

Light bulb  Note: This is note for reader