Strangepete/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
(geSHi and syntaxhighlight play - i'd like to work on a lightweight SQF highlighter for use on the wiki)
m (Bot: Adding category Sandbox)
Line 105: 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>
[[Category:Sandbox]]

Revision as of 03:00, 3 December 2018

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 &amp;lt;t color='%1'&amp;gt;%2&amp;lt;/t&amp;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'):

Best Practice
Good Practice:
//str_myTag_teamKillers:	<English>&amp;lt;t color='#dd1111'&amp;gt;Team Killing is NOT Tolerated&amp;lt;/t&amp;gt;&amp;lt;/ br&amp;gt; and will result in a Permanent Ban!</English>

// Server
if ( [[isServer]] ) then {
	["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]];
};
Bad Practice
Bad Practice:
//str_myTag_teamKillers:	<English>&amp;lt;t color='#dd1111'&amp;gt;Team Killing is NOT Tolerated&amp;lt;/t&amp;gt;&amp;lt;/ br&amp;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:


Best Practice
Good Practice:
//str_myTag_teamKillers:	<English>&amp;lt;t color='#dd1111'&amp;gt;Team Killing is NOT Tolerated&amp;lt;/t&amp;gt;&amp;lt;/ br&amp;gt; and will result in a Permanent Ban!</English>

// Server
if ( [[isServer]] ) then {
	["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]];
};


Bad Practice
Bad Practice:
//str_myTag_teamKillers:	<English>&amp;lt;t color='#dd1111'&amp;gt;Team Killing is NOT Tolerated&amp;lt;/t&amp;gt;&amp;lt;/ br&amp;gt; and will result in a Permanent Ban!</English>

// Server
if ( [[isServer]] ) then {
	["str_myTag_teamKillers","TAG_fnc_localHint"] [[call]] [[BIS_fnc_MP]];
};


Best Practice
Best Practice:
// some code
doThings;

Maybe an explanation why, or a reference

// or more code


Bad Practice
Catastrophically Stupid:
stupidCode;


Example 2: Template:Lorem