Template:Code: Difference between revisions
(return to original code "{{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|enclose="div"}}") |
m (modified in "{{#tag:pre style="color:black" | {{{ code |{{{1}}} }}} }}" for testing the erroneous spaces) |
||
Line 1: | Line 1: | ||
{{#tag: |
{{#tag:pre style="color:black" | {{{ code |{{{1}}} }}} }}<noinclude> |
||
---- |
---- |
||
Line 26: | Line 26: | ||
See [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi <nowiki><syntaxhighlight></nowiki>] for a complete list of supported languages |
See [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi <nowiki><syntaxhighlight></nowiki>] for a complete list of supported languages |
||
'''Warning:''' |
|||
<nowiki>SyntaxHighlight disabled because not working anymore on our host. Original template: {{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|lang="{{{lang|{{{2|python}}}}}}"|enclose="div"}}</nowiki> |
|||
Modified cause the colour give one tab inappropriate if it not convenient republished this line i have forced the colour 26/09/2016 Mario52 |
|||
<nowiki>{{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|enclose="div"}} </nowiki> |
|||
[[Category:Administration]] |
[[Category:Administration]] |
Revision as of 17:49, 26 September 2016
{{{1}}}
Use this template when you want to display code, for example :
{{Code|code= import FreeCAD, Draft Draft.makeLine(FreeCAD.Vector(0,0,0),FreeCAD.Vector(2,0,0)) }}
REMARK:
- Since a content that includes an equals sign (=) is interpreted as a variable, you must specify the code parameter explicitly to avoid issues (as in the above example)
- If the macro code content the characters : "|" (Vertical bar) or "{ }" (Closing brace or Opening brace) not use this template (the macro code is dislocated an erroneous), use the HTML code <pre> ... </pre>
This template gives a different coloration depending on the used programming language. The default language is Python.
Options:
- lang=python
- lang=cpp
- lang=java
- lang=pascal
Other options are be supported: the template is a simple wrapper around the <syntaxhighlight>...</syntaxhighlight> tag to show syntax-highlighted text. Unlike <syntaxhighlight>, text that does not fit on the screen will be wrapped. See <syntaxhighlight> for a complete list of supported languages
Warning: SyntaxHighlight disabled because not working anymore on our host. Original template: {{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|lang="{{{lang|{{{2|python}}}}}}"|enclose="div"}}
Modified cause the colour give one tab inappropriate if it not convenient republished this line i have forced the colour 26/09/2016 Mario52 {{#tag:syntaxhighlight|{{{code|{{{1}}}}}}|enclose="div"}}