Strangepete/Sandbox – User
(MP example - simple and clear enough? next destination is /Stringtable.xml (capital S in form of Description.ext- all in favor?)) |
(geSHi and syntaxhighlight play - i'd like to work on a lightweight SQF highlighter for use on the wiki) |
||
Line 1: | Line 1: | ||
just learned about <syntaxhighlight> and geSHi Extension: http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi | |||
i'd like to start working on a SQF highlight for use in the wiki, something lightweight and simple, personally i think the notepad++ syntax highlight for a3 is very clean, with minimal color use - comments, command names, strings...i'm not familiar with geshi, but it doesnt seem too hard to get a basic style formed.... | |||
=== | one issue i'd read about, and noticed so far, is that [[ bracketed ]] wiki links don't work, so this would remove any links to commands within code...not something im thrilled about - perhaps theres a way to preprocess the url before the highligher handles it, or maybe geshi allows for inserting or ignoring the appropriate code tags | ||
geshi xml lang | |||
<syntaxhighlight lang="xml" enclose="div" line="GESHI_NORMAL_LINE_NUMBERS"><?xml version="1.0" encoding="utf-8" ?> | |||
<Project name="Any Name"> | <Project name="Any Name"> | ||
<Package name="Mission One"> | <Package name="Mission One"> | ||
Line 15: | Line 12: | ||
<Key ID="str_myTag_Yes"> | <Key ID="str_myTag_Yes"> | ||
<Original>yes</Original> | <Original>yes</Original> | ||
</Key> | </Key> | ||
</Container> | </Container> | ||
<Container name="Another Container"> | <Container name="Another Container"> | ||
<Key ID="str_myTag_structured"> | <Key ID="str_myTag_structured"> | ||
<Original>Some text &lt;t color='%1'&gt;%2&lt;/t&gt;</Original> | <Original>Some text &lt;t color='%1'&gt;%2&lt;/t&gt;</Original> | ||
Line 43: | Line 21: | ||
</Package> | </Package> | ||
</Project> | </Project> | ||
</ | </syntaxhighlight> | ||
<!-- | |||
<style> | |||
{ | div.code-good { | ||
background: #efffef url(/mediawiki-1.19/skins/common/tmhp/silk-icons/tick.png) no-repeat top right !important; | |||
border-color: #6c6 !important; | |||
} | |||
div.code-bad { | |||
background: #ffefef url(/mediawiki-1.19/skins/common/tmhp/silk-icons/cancel.png) no-repeat top right !important; | |||
border: 1px dashed #c66 !important; | |||
}</style> | |||
--> | |||
<!-- | |||
== | <div dir="ltr" class="mw-geshi mw-code mw-content-ltr" style="border: 1px dashed #6c6; background: #ddf8cb;">[[image:Ico_ok.png|left|22px|Best Practice]] Good Practice: | ||
<syntaxhighlight lang="c">blah</syntaxhighlight> | |||
</div> | |||
--> | |||
based off submission on mediaWiki: http://www.mediawiki.org/wiki/Extension_talk:SyntaxHighlight_GeSHi | |||
some Template ideas (using language 'c'): | |||
<code>[[ | <div dir="ltr" class="mw-geshi mw-code mw-content-ltr" style="border: 1px dashed #6c6; background: #ddf8cb;">[[image:Ico_ok.png|left|22px|Best Practice]] Good Practice: | ||
<syntaxhighlight lang="c" highlight="5" enclose="div">//str_myTag_teamKillers: <English>&lt;t color='#dd1111'&gt;Team Killing is NOT Tolerated&lt;/t&gt;&lt;/ br&gt; and will result in a Permanent Ban!</English> | |||
// | |||
// Server | |||
if ( [[isServer]] ) then { | |||
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | |||
};</syntaxhighlight> | |||
</div> | |||
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr" style="border: 1px dashed #c66; background: #ffdada;">[[image:Ico_none.png|left|22px|Bad Practice]] Bad Practice: | |||
<syntaxhighlight lang="c" enclose="div" line="GESHI_NORMAL_LINE_NUMBERS">//str_myTag_teamKillers: <English>&lt;t color='#dd1111'&gt;Team Killing is NOT Tolerated&lt;/t&gt;&lt;/ br&gt; and will result in a Permanent Ban!</English> | |||
// Server | |||
if ( [[isServer]] ) then { | |||
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | |||
}; | |||
</syntaxhighlight></div> | |||
I think i prefer this: | |||
<div dir="ltr" class="" style="border: none; background: #ddf8cb;">[[image:Ico_ok.png|left|22px|Best Practice]] Good Practice: | |||
<syntaxhighlight lang="c">//str_myTag_teamKillers: <English>&lt;t color='#dd1111'&gt;Team Killing is NOT Tolerated&lt;/t&gt;&lt;/ br&gt; and will result in a Permanent Ban!</English> | |||
// Server | |||
if ( [[isServer]] ) then { | |||
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | |||
};</syntaxhighlight> | |||
</div> | |||
<div dir="ltr" class="" style="border: none; background: #ffdada;">[[image:Ico_none.png|left|22px|Bad Practice]] Bad Practice: | |||
<syntaxhighlight lang="c" enclose="div" highlight="5" line="GESHI_NORMAL_LINE_NUMBERS">//str_myTag_teamKillers: <English>&lt;t color='#dd1111'&gt;Team Killing is NOT Tolerated&lt;/t&gt;&lt;/ br&gt; and will result in a Permanent Ban!</English> | |||
// Server | |||
if ( [[isServer]] ) then { | |||
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | |||
{ | |||
}; | }; | ||
</syntaxhighlight></div> | |||
</ | |||
<div dir="ltr" class="" style="border: none; background: #ddf8cb;">[[image:Ico_ok.png|left|22px|Best Practice]] Best Practice: | |||
<div | <syntaxhighlight lang="c">// some code | ||
doThings;</syntaxhighlight> | |||
| | |||
| | |||
Maybe an explanation why, or a reference | |||
<code | <syntaxhighlight lang="c">// or more code</syntaxhighlight> | ||
</div> | |||
<div dir="ltr" class="" style="border: none; background: #ffdada;">[[image:Stop_hand.png|left|25px|Bad Practice]] '''Catastrophically Stupid:''' | |||
<syntaxhighlight lang="php">stupidCode;</syntaxhighlight> | |||
</div> | |||
</ | |||
Line 139: | Line 105: | ||
<!-- Do not include CSS styling in genuine example --> | <!-- Do not include CSS styling in genuine example --> | ||
<code style="white-space:pre-wrap;">{{Lorem|}}</code> | <code style="white-space:pre-wrap;">{{Lorem|}}</code> | ||
Revision as of 23:00, 5 April 2014
just learned about <syntaxhighlight> and geSHi Extension: http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
i'd like to start working on a SQF highlight for use in the wiki, something lightweight and simple, personally i think the notepad++ syntax highlight for a3 is very clean, with minimal color use - comments, command names, strings...i'm not familiar with geshi, but it doesnt seem too hard to get a basic style formed....
one issue i'd read about, and noticed so far, is that bracketed wiki links don't work, so this would remove any links to commands within code...not something im thrilled about - perhaps theres a way to preprocess the url before the highligher handles it, or maybe geshi allows for inserting or ignoring the appropriate code tags
geshi xml lang
<?xml version="1.0" encoding="utf-8" ?>
<Project name="Any Name">
<Package name="Mission One">
<Container name="Some Words">
<Key ID="str_myTag_Yes">
<Original>yes</Original>
</Key>
</Container>
<Container name="Another Container">
<Key ID="str_myTag_structured">
<Original>Some text &lt;t color='%1'&gt;%2&lt;/t&gt;</Original>
</Key>
</Container>
</Package>
</Project>
based off submission on mediaWiki: http://www.mediawiki.org/wiki/Extension_talk:SyntaxHighlight_GeSHi
some Template ideas (using language 'c'):
//str_myTag_teamKillers: <English>&lt;t color='#dd1111'&gt;Team Killing is NOT Tolerated&lt;/t&gt;&lt;/ br&gt; and will result in a Permanent Ban!</English>
// Server
if ( [[isServer]] ) then {
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]];
};
//str_myTag_teamKillers: <English>&lt;t color='#dd1111'&gt;Team Killing is NOT Tolerated&lt;/t&gt;&lt;/ br&gt; and will result in a Permanent Ban!</English>
// Server
if ( [[isServer]] ) then {
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]];
};
I think i prefer this:
//str_myTag_teamKillers: <English>&lt;t color='#dd1111'&gt;Team Killing is NOT Tolerated&lt;/t&gt;&lt;/ br&gt; and will result in a Permanent Ban!</English>
// Server
if ( [[isServer]] ) then {
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]];
};
//str_myTag_teamKillers: <English>&lt;t color='#dd1111'&gt;Team Killing is NOT Tolerated&lt;/t&gt;&lt;/ br&gt; and will result in a Permanent Ban!</English>
// Server
if ( [[isServer]] ) then {
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]];
};
Example 2:
Template:Lorem