KeenWiki:CKPatch extension

From KeenWiki
Jump to navigation Jump to search

The KeenWiki has a CKPatch extension which allows CKPatch files to be syntax highlighted using the <patch></patch> tags. This page serves as a testbed, with many different types of syntax to verify that the syntax-highlighting code is working correctly.

<patch title="Testing">

  1. Whole-line comment

%ext ck1 # End of line comment

  1. Indented line

%ext ck1

  1. An integer argument followed by a string argument

%patchfile 0x0010300 file.dat

  1. An integer argument followed by a string argument, then another
  2. integer argument. Note the line break between arguments.

%patch 0x0010300

   "Hello world!\n" 0x00
  1. An integer argument followed by a text stream, followed by another
  2. command.

%level.hint 2 This is a hint message that spans multiple lines.

%level.hint 2 This is a hint message that spans # Comment "inside" string multiple lines.

%level.hint 2 This is a hint message \# that spans # '#' symbol in string, not a comment multiple lines and contains \% too

  1. First integer argument is in decimal
  2. Second integer argument is in Pascal-style hexadecimal
  3. Third integer argument is in C-style hexadecimal

%patch 10 $0A 0x0A

%level.entry 12 Keen patches his way into CKPatch Headquarters

  1. Command list

%ext one two three four %patch one two three four %patchfile one two three four %version one two three four %dump one two three four

%level.dir one two three four %level.file one two three four %level.file one two three four %level.file one two three four

%egahead one two three four %egasprit one two three four %egalatch one two three four %level.hint one two three four

%level.name one two three four %level.entry one two three four %gamemaps one two three four %egagraph one two three four %audio one two three four %audiohed one two three four %egahead one two three four %maphead one two three four %audiodct one two three four %egadict one two three four %ckmhead.obj one two three four %level.hint one two three four

  1. Some code with $ signs that can be processed by PHP if not properly escaped

%patch $4F43 $31 $C0 $A3 $9E $AA $A3 $A0 $AA $A3 $A2 $AA

            $A3 $A4 $AA $A3 $9A $AA $A3 $C8 $AA $90 $90 
            $90 $90 $90 $90 $90
  1. Invalid code
  1. I presume %commands are ignored within comments
  2. %ext ck1 blah
  1. Error: %end must appear at the start of a new line.

%level.dir mykeen1 %end

%unknown command with parameters

  1. Wrong number of parameters

%ext ck1 blah

  1. Special "characters", wikicode test and html too
  2. C:\GAMES\KEEN

%comment Special "characters", wikicode test and html too %comment C:\GAMES\KEEN

%end blah blah trailing text


</patch>

Testing commands at the end of the patch block:

<patch> %ext ck1 %end </patch>

<patch> %ext ck1 %audio test </patch>

<patch> %end </patch>