Template:XML definition header/doc

From MegaGlest
Jump to: navigation, search

Adds a color key for background highlighting on XML definitions.

Usage[edit]

To create an XML definition, surround the XML code with <syntaxhighlight lang="xml"> </syntaxhighlight>. This creates a syntax highlighted "code box". To specify highlighted areas, you must use comments:

Comment Description Color
<!-- Start GAE Only -->

<!-- End GAE Only -->
Starts a GAE Only color block for code that only GAE supports
GAE Only
<!-- Start MG Only -->

<!-- End MG Only -->
Starts a MG Only color block for code that only MG supports
<!-- Start GAE+MG Only -->

<!-- End GAE+MG Only -->
Starts a color block for code that both GAE and MG support, but Glest does not.
GAE and MegaGlest Only

Surround the code by starting with the Start comment and ending with the End comment. DO NOT FORGET TO CLOSE THE START WITH AN END. These get replaced by special div tags to give the color, and the spacing and syntax must be exact. To ensure it formats correctly, the lines should be on a new line, and tabs should be used instead of spaces. If in doubt, take a look at the source for existing pages. Case is insensitive, but recommended you follow the same case anyway.

Replacements are done with javascript. If the user doesn't have javascript, this falls back nicely by showing the comments so the user can still see what code is for what engine (even if not as well as with the colors).

Before the first instance of syntax highlighting, place this template with {{XML definition header}} to serve as a key. Use of engine-specific highlighting is not needed on engine specific pages. However, on shared pages such as XMLs, it should be used, even if the text explains a feature is engine specific, as the colors are more visible than text.