Wiki Customizations

From X-Plane SDK
Jump to: navigation, search

This Wiki contains a few customizations, provided by the XPSDK mediaWiki plugin.

Misc Features

   * Any X-Plane SDK keyword is now a WikiWord. For example, XPLMGetDirectoryContents is automatically found to be a WikiWord.
   * All datarefs and their groups are also wiki words.
   * If an SDK keyword has both a Wiki page and regular SDK documentation, then the SDK documentation appears before the wiki content. Even if the wiki page doesn't exist, this "synthetic" page will exist with an option to edit. Unlike regular wiki links to missing pages, there is no indication that this is a "needs editing" page.
   * Missing wiki words and missing pages now show as red links (instead of blue) instead of the ? mark, so that code samples won't contain syntax errors. 

std_docs Tag

The new HTML tag "std_docs" inserts into the page the standard per-symbol documentation for the X-Plane SDK. Usage:

<nowiki><std_docs>symbol_name</std_docs>

Example:

<nowiki><std_docs>XPLM_NO_PLUGIN_ID</std_docs>

Gives this:

#define XPLM_NO_PLUGIN_ID    (-1)
No plugin.

The php file std_refs.php (auto-generated by the SDK generation tools) provides the vocabulary of standard refs.

Note that this does not auto-create pages. Instead the pages are auto-created in XML format by the SDK tools, then bulk imported. The bulk-made pages usually contain a category link and a std_docs tag.

Example Project Generation

The SDK plugin is capable of generating a zip archive with project files for sample code that is embedded in a wiki page. The plugin must be entirely one source file.

sample_code tag

The sample code tag defines the source code for the plugin. Usage:

<sample_code t="name">source code here</sample_code>

Example:

<sample_code t="name">int main(int argc, const char ** argv)
{
 printf("Hello world.\n");
}</sample_code>

Looks like this:

int main(int argc, const char ** argv)
{
 printf("Hello world.\n");
}

WARNING: be sure there are not spaces in the sample_code tag - the code that parses this in the XPSDK plugin is not very robust right now.

Sample Code Page Actions

The plugin defines a new action, action=get_sample with the additional parameter, example_template=template where template is a zip archive in the sample_templates subdirectory of the extensions directory. Loading the page with this action will dynamically build the zip archive and download it.

Sample Code Download Template

Templates can be used to auto-generate the download links...a typical template might look something like this:

Download {{PAGENAME}} as [{{SERVER}}{{SCRIPTPATH}}/index.php?title={{PAGENAMEE}}&action=get_sample&example_template=sdk_100_xcode.zip X-Code 2.5 or newer]

This example would use the template xpsdk_100_xcode.zip for a link labeled "X-Code 2.5 or newer".

The templates can also contain category links to auto-categorize the examples.

Project Format

Projects templates are stored on the server as zip files, with the following two substitutions (in either the file name or the file text):

  • ###CODE### is replaced with the code, the body of the sample_code tag.
  • ###NAME### is replaced with the name of the plugin, from the t= argument.