KeenWiki:CKPatch extension

From KeenWiki
Jump to: navigation, 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: Testing
# Whole-line comment
%ext ck1
# End of line comment
# Indented line
%ext ck1
# An integer argument followed by a string argument
%patchfile 0x0010300 file.dat
# An integer argument followed by a string argument, then another
# integer argument. Note the line break between arguments.
%patch 0x0010300 "Hello world!\n" 0x00
# An integer argument followed by a text stream, followed by another
# 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
# First integer argument is in decimal
# Second integer argument is in Pascal-style hexadecimal
# Third integer argument is in C-style hexadecimal
%patch 10 $0A 0x0A %level.entry 12 Keen patches his way into CKPatch Headquarters
# 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
# 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
#
# Invalid code
#
# I presume %commands are ignored within comments
#%ext ck1 blah
# Error: %end must appear at the start of a new line.
%level.dir mykeen1 %end %unknown command with parameters
# Wrong number of parameters
%ext ck1 blah
# Special "characters", ''wikicode'' test and <b>html</b> too
# C:\GAMES\KEEN
%comment Special "characters", ''wikicode'' test and <b>html</b> too %comment C:\GAMES\KEEN %end blah blah trailing text

Testing commands at the end of the patch block:

Patch:
%ext ck1
%end

Patch:
%ext ck1
%audio test

Patch:
%end