Strangepete/Sandbox – User
(geSHi and syntaxhighlight play - i'd like to work on a lightweight SQF highlighter for use on the wiki) |
Lou Montana (talk | contribs) m (Fix Pages using deprecated enclose attributes syntaxhighlight auto-category) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Feature|informative|Some years later… we have our very own [[Extension:SQFHighlighter|SQFHighlighter]] :-) - [[User:Lou Montana|Lou Montana]] ([[User talk:Lou Montana|talk]]) 22:24, 9 July 2023 (CEST)}} | |||
just learned about <syntaxhighlight> and geSHi Extension: http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi | just learned about <syntaxhighlight> and geSHi Extension: http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi | ||
Line 6: | Line 7: | ||
geshi xml lang | geshi xml lang | ||
<syntaxhighlight lang="xml | <syntaxhighlight lang="xml" 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 36: | Line 38: | ||
<!-- | <!-- | ||
<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: | <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> | <syntaxhighlight lang="c">blah</syntaxhighlight> | ||
</div> | </div> | ||
Line 45: | Line 48: | ||
some Template ideas (using language 'c'): | some Template ideas (using language 'c'): | ||
<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: | <div dir="ltr" class="mw-geshi mw-code mw-content-ltr" style="border: 1px dashed #6c6; background: #ddf8cb;"> | ||
<syntaxhighlight lang="c" highlight="5 | [[image:Ico_ok.png|left|22px|Best Practice]] Good Practice: | ||
<syntaxhighlight lang="c" highlight="5"> | |||
//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 | // Server | ||
if ( [[isServer]] ) then { | if ( [[isServer]] ) then { | ||
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | ["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | ||
};</syntaxhighlight> | }; | ||
</syntaxhighlight> | |||
</div> | </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: | <div dir="ltr" class="mw-geshi mw-code mw-content-ltr" style="border: 1px dashed #c66; background: #ffdada;"> | ||
<syntaxhighlight lang="c | [[image:Ico_none.png|left|22px|Bad Practice]] Bad Practice: | ||
<syntaxhighlight lang="c" 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 | // Server | ||
Line 61: | Line 69: | ||
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | ["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | ||
}; | }; | ||
</syntaxhighlight></div> | </syntaxhighlight> | ||
</div> | |||
Line 73: | Line 82: | ||
if ( [[isServer]] ) then { | if ( [[isServer]] ) then { | ||
["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | ["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]]; | ||
};</syntaxhighlight> | }; | ||
</syntaxhighlight> | |||
</div> | </div> | ||
<div dir="ltr" class="" style="border: none; background: #ffdada;">[[image:Ico_none.png|left|22px|Bad Practice]] Bad Practice: | <div dir="ltr" class="" style="border: none; background: #ffdada;"> | ||
<syntaxhighlight lang="c | [[image:Ico_none.png|left|22px|Bad Practice]] Bad Practice: | ||
<syntaxhighlight lang="c" 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 | // Server | ||
Line 87: | Line 99: | ||
<div dir="ltr" class="" style="border: none; background: #ddf8cb;">[[image:Ico_ok.png|left|22px|Best Practice]] Best Practice: | <div dir="ltr" class="" style="border: none; background: #ddf8cb;"> | ||
[[image:Ico_ok.png|left|22px|Best Practice]] Best Practice: | |||
<syntaxhighlight lang="c">// some code | <syntaxhighlight lang="c">// some code | ||
doThings;</syntaxhighlight> | doThings;</syntaxhighlight> | ||
Line 96: | Line 109: | ||
<div dir="ltr" class="" style="border: none; background: #ffdada;">[[image:Stop_hand.png|left|25px|Bad Practice]] '''Catastrophically Stupid:''' | <div dir="ltr" class="" style="border: none; background: #ffdada;"> | ||
[[image:Stop_hand.png|left|25px|Bad Practice]] '''Catastrophically Stupid:''' | |||
<syntaxhighlight lang="php">stupidCode;</syntaxhighlight> | <syntaxhighlight lang="php">stupidCode;</syntaxhighlight> | ||
</div> | </div> | ||
Line 104: | Line 118: | ||
Example 2: | Example 2: | ||
<!-- Do not include CSS styling in genuine example --> | <!-- Do not include CSS styling in genuine example --> | ||
<code style="white-space:pre-wrap;">{{ | <code style="white-space:pre-wrap;">{{Wiki|lorem|}}</code> | ||
[[Category:Sandbox]] |
Latest revision as of 21:24, 9 July 2023
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:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.