Enforce Script Highlighter – Extension

From Bohemia Interactive Community
Revision as of 17:10, 16 June 2023 by Lou Montana (talk | contribs) (Fix description)
Jump to navigation Jump to search
Enforce Script Highlighter
Description Highlights Enforce Script code.
Author Lou Montana
Project Start 2022-07-30: Project start
Release Date
  • 2022-07-30: "v0" (0.00a), first upload, Syntaxhighlight's C# syntax wrapper
  • 2023-06-15: v0.95, first custom lexer with Script Editor's theme
Version 0.95

This extension highlights Enforce Script Syntax using Script Editor's theme.


Features

  • Enforce Script Syntax support
  • "Copy code to clipboard" button on hover
  • Enforce Script tag button in the wiki edit toolbar (next to B and I)
  • Options:
    • inline for inline code
    • notrim to remove the auto trim (lines themselves will always be rtrimmed)
    • game="armaR" (Optional, default per wiki namespace) used to force which game links should be used
    • classes="SCR_ClassA SCR_ClassB" (case-sensitive) additional classes to be declared (if outside the example)
    • noGuess to disable guessing unknown token as classes as false positives can happen - use classes in that case
      guess regex: ^([A-Z][A-Z0-9]{1,7}_)?E?[A-Z][a-z][A-Za-z0-9_]*$ as per script tag guidelines


Installation

  • Unzip the directory to wiki/extensions/EnforceScriptHighlighter
  • Add wfLoadExtension( 'EnforceScriptHighlighter' ); to LocalSettings.php
  • There are no settings


Usage

Using <enforce> tags will auto-generate syntax highlighting.

Examples
Code Result
<enforce/>
-no code provided-
<enforce></enforce>
-no code provided-
<enforce> </enforce>
-no code provided-
<enforce>int i = 3;</enforce>
int i = 3;
<enforce>
#ifdef WORKBENCH
class ABC
{
}

class DEF : ABC
{
	// unreachable
	protected static void Print(string text)
	{
		Print(text + 42, LogLevel.NORMAL);
	}
}
#endif
</enforce>
#ifdef WORKBENCH class ABC { } class DEF : ABC { // unreachable protected static void Print(string text) { Print(text + 42, LogLevel.NORMAL); } } #endif
This is <enforce inline>int i = 0; i++;</enforce> absolutely inline.<br>
And here comes another one <enforce inline>float value = 0.001;</enforce> inline text.<br>
And another one <enforce inline>array<string> = {};</enforce>

This is int i = 0; i++; absolutely inline.
And here comes another one float value = 0.001; inline text.
And another one array<string> = {};


Known Issues

Version Issue Report Date Fix Date
0.00a N/A
0.95 N/A
Report issues on Discord, in the #community_wiki channel!