restored reference docs from assaultcube.github.io/htdocs/docs/xml to this repo so that code changes can be correlated with documentation changes
This commit is contained in:
@@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
XML schema for types in the ../reference.xml document.
|
||||
|
||||
Written by: Adrian 'driAn' Henke (of Rabid Viper Productions).
|
||||
|
||||
You may be able to redistribute this content under specific
|
||||
conditions. Please read the licensing information, available
|
||||
at https://assault.cubers.net/docs/license.html for the
|
||||
conditions that would apply to what you may be redistributing.
|
||||
-->
|
||||
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://assault.cubers.net/docs/xml" xmlns="https://assault.cubers.net/docs/xml">
|
||||
|
||||
<!-- simple types -->
|
||||
|
||||
<xs:simpleType name="nameType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="32" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="descriptionType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="128" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="remarkType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="1024" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="codeType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="256" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="urlType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="256">
|
||||
</xs:maxLength>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="tokenType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="8" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="valueNotesType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="128" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="keyAliasType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="16" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<!-- complex types -->
|
||||
|
||||
<!-- value descriptions -->
|
||||
|
||||
<xs:complexType name="valueDescriptionType">
|
||||
<xs:attribute name="token" use="required" type="tokenType"/>
|
||||
<xs:attribute name="description" use="required" type="descriptionType"/>
|
||||
<xs:attribute name="valueNotes" use="optional" type="valueNotesType"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="intVariableValueDescriptionType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="valueDescriptionType">
|
||||
<xs:attribute name="minValue" use="required" type="xs:int"/>
|
||||
<xs:attribute name="maxValue" use="required" type="xs:int"/>
|
||||
<xs:attribute name="defaultValue" use="required" type="xs:int"/>
|
||||
<xs:attribute name="readOnly" use="optional" type="xs:boolean" default="false"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="returnValueDescriptionType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="valueDescriptionType">
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="argumentValueDescriptionType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="valueDescriptionType">
|
||||
<xs:attribute name="optional" use="optional" type="xs:boolean" default="false"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="variableArgumentValueDescriptionType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="argumentValueDescriptionType">
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="argumentValueDescriptionCollectionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="argument" type="argumentValueDescriptionType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="variableArgument" type="variableArgumentValueDescriptionType" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- keys -->
|
||||
|
||||
<xs:complexType name="keyType">
|
||||
<xs:attribute name="alias" type="keyAliasType" use="required"/>
|
||||
<xs:attribute name="name" type="nameType" use="optional"/>
|
||||
<xs:attribute name="description" type="descriptionType" use="optional"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="keyCollectionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="key" type="keyType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- references -->
|
||||
|
||||
<xs:complexType name="referenceType">
|
||||
<xs:attribute name="name" use="optional" type="nameType"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="identifierReferenceType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="referenceType">
|
||||
<xs:attribute name="identifier" use="required" type="nameType" />
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="webReferenceType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="referenceType">
|
||||
<xs:attribute name="url" use="required" type="urlType"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="wikiReferenceType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="referenceType">
|
||||
<xs:attribute name="article" use="required" type="urlType"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="referenceCollectionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="identifierReference" type="identifierReferenceType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="webReference" type="webReferenceType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- remarks -->
|
||||
|
||||
<xs:complexType name="remarkCollectionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="remark" type="remarkType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- examples -->
|
||||
|
||||
<xs:complexType name="exampleType">
|
||||
<xs:sequence>
|
||||
<xs:element name="code" type="codeType" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="explanation" type="descriptionType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="exampleCollectionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="example" type="exampleType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- identifiers -->
|
||||
|
||||
<xs:complexType name="identifierType" abstract="true">
|
||||
<xs:choice maxOccurs="unbounded">
|
||||
<xs:element name="description" type="descriptionType" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="remarks" type="remarkCollectionType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="examples" type="exampleCollectionType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="references" type="referenceCollectionType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="defaultKeys" type="keyCollectionType" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" use="required" type="nameType"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="identifierCollectionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="command" type="commandType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="variable" type="variableType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="scriptalias" type="scriptaliasType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="sort" type="xs:boolean" default="true"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="commandType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="identifierType">
|
||||
<xs:choice maxOccurs="unbounded">
|
||||
<xs:element name="arguments" type="argumentValueDescriptionCollectionType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="return" type="returnValueDescriptionType" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:choice>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="variableType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="identifierType">
|
||||
<xs:sequence>
|
||||
<xs:element name="value" type="intVariableValueDescriptionType" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="scriptaliasType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="identifierType">
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- sections -->
|
||||
|
||||
<xs:complexType name="sectionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="description" type="descriptionType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="identifiers" type="identifierCollectionType" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" use="required" type="nameType"/>
|
||||
<xs:attribute name="sortindex" use="optional" type="xs:int"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="sectionCollectionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="section" type="sectionType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="sort" type="xs:boolean" default="true"/>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- document root -->
|
||||
|
||||
<xs:complexType name="cuberefType">
|
||||
<xs:sequence>
|
||||
<xs:element name="description" type="descriptionType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="sections" type="sectionCollectionType" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" type="nameType" use="required"/>
|
||||
<xs:attribute name="version" type="nameType" use="optional"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="cuberef" type="cuberefType"/>
|
||||
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Transforms the ../reference.xml document into a CubeScript document.
|
||||
|
||||
Written by: Adrian 'driAn' Henke (of Rabid Viper Productions).
|
||||
|
||||
You may be able to redistribute this content under specific
|
||||
conditions. Please read the licensing information, available
|
||||
at https://assault.cubers.net/docs/license.html for the
|
||||
conditions that would apply to what you may be redistributing.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="https://assault.cubers.net/docs/xml">
|
||||
|
||||
<xsl:output method="text" encoding="ASCII"/>
|
||||
|
||||
<!-- horizontal tab -->
|
||||
<xsl:variable name="indent">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- line feed, CRLF (dos/win) -->
|
||||
<xsl:variable name="newline">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:template match="/t:cuberef">
|
||||
<xsl:text>// This CubeScript file has been automatically generated from AssaultCube's ./docs/reference.xml</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:text>// DO NOT MODIFY THIS FILE - Instead, modify ./docs/reference.xml and generate this file automatically.</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:text>// To generate this file automatically, please carefully read the comment at the top of reference.xml</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:value-of select="$newline"/>
|
||||
|
||||
<!-- sections -->
|
||||
<xsl:for-each select="t:sections/t:section">
|
||||
<xsl:text>docsection </xsl:text>
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>]</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
|
||||
<!-- identifiers -->
|
||||
<xsl:for-each select="t:identifiers/*">
|
||||
<xsl:sort select="@name"/> <!-- always sort to avoid excessive sorting inside the Cube games -->
|
||||
<xsl:text>docident </xsl:text>
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:value-of select="normalize-space(t:description)"/>
|
||||
<xsl:text>];</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
|
||||
<!-- argument descriptions -->
|
||||
<xsl:for-each select="t:arguments/*">
|
||||
<xsl:text>docargument </xsl:text>
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="@token"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:value-of select="@description"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:value-of select="@valueNotes"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="local-name() = 'variableArgument'">
|
||||
<xsl:text>1</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>0</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>];</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- var descriptions (fake arg) -->
|
||||
<xsl:if test="t:value">
|
||||
<xsl:text>docargument </xsl:text>
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="t:value/@token"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:value-of select="t:value/@description"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:value-of select="t:value/@valueNotes"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="t:value/@readOnly">
|
||||
<xsl:text> read-only</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:if test="t:value/@valueNotes">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>min </xsl:text>
|
||||
<xsl:value-of select="t:value/@minValue"/>
|
||||
<xsl:text>/max </xsl:text>
|
||||
<xsl:value-of select="t:value/@maxValue"/>
|
||||
<xsl:text>/default </xsl:text>
|
||||
<xsl:value-of select="t:value/@defaultValue"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>];</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
</xsl:if>
|
||||
|
||||
<!-- remarks -->
|
||||
<xsl:for-each select="t:remarks/t:remark">
|
||||
<xsl:text>docremark </xsl:text>
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="normalize-space(.)"/>
|
||||
<xsl:text>];</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- examples -->
|
||||
<xsl:for-each select="t:examples/*">
|
||||
<xsl:text>docexample </xsl:text>
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="normalize-space(t:code)"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:value-of select="normalize-space(t:explanation)"/><!-- FIXME: will only use the 1st explanation (2010oct06:flowtron) -->
|
||||
<xsl:text>];</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- default keys -->
|
||||
<xsl:for-each select="t:defaultKeys/*">
|
||||
<xsl:text>dockey </xsl:text>
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="@alias"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>] [</xsl:text>
|
||||
<xsl:value-of select="@description"/>
|
||||
<xsl:text>];</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- references -->
|
||||
<xsl:for-each select="t:references/t:identifierReference">
|
||||
<xsl:text>docref </xsl:text>
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="@identifier"/>
|
||||
<xsl:text>];</xsl:text>
|
||||
<xsl:value-of select="$newline"/>
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,443 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:transform version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="https://assault.cubers.net/docs/xml">
|
||||
<!--
|
||||
This file transforms the ../reference.xml document into an XHTML webpage.
|
||||
|
||||
Written by: Rabid Viper Productions.
|
||||
Special thanks to Adrian 'driAn' Henke for the original document
|
||||
that all these XML-related files are based upon.
|
||||
|
||||
You may be able to redistribute this content under specific
|
||||
conditions. Please read the licensing information, available
|
||||
at https://assault.cubers.net/docs/license.html for the
|
||||
conditions that would apply to what you may be redistributing.
|
||||
-->
|
||||
|
||||
<xsl:output method="html" omit-xml-declaration="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
|
||||
|
||||
<xsl:template match="t:key">
|
||||
<i>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@name">
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@alias"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</i>
|
||||
<xsl:if test="@description">
|
||||
<xsl:text> - </xsl:text>
|
||||
<xsl:value-of select="@description"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="identifierLink">
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#identifier_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/t:cuberef">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=UTF-8" />
|
||||
<meta name="robots" content="NOODP" />
|
||||
<meta name="author" content="Rabid Viper Productions" />
|
||||
<meta name="copyright" content="You may be able to redistribute this content under specific conditions.
|
||||
Please read the licensing information, available @ https://assault.cubers.net/docs/license.html for the
|
||||
conditions that would apply to what you may be redistributing." />
|
||||
<title>AssaultCube Documentation :: CubeScript</title>
|
||||
<link rel="stylesheet" href="css/main.css" />
|
||||
<link rel="stylesheet" href="css/docs.css" />
|
||||
<link rel="stylesheet" href="css/referencexml.css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="docsheader">
|
||||
AssaultCube Documentation
|
||||
</div>
|
||||
<div id="logo">
|
||||
<a href="index.html"><img src="images/aclogo.png"
|
||||
alt="AssaultCube" width="193px" height="81px" /></a>
|
||||
</div>
|
||||
<div id="menubar">
|
||||
 
|
||||
</div>
|
||||
<div class="docsmain">
|
||||
<div id="gohome">
|
||||
<a href="index.html">Go to documentation index ↵</a>
|
||||
</div>
|
||||
<div id="topbutton">
|
||||
<a href="#">↑ Top of the page?</a>
|
||||
</div>
|
||||
<h2>
|
||||
CubeScript
|
||||
</h2>
|
||||
<p>
|
||||
CubeScript is the scripting language of AssaultCube and it is similar to scripting languages of other games, except
|
||||
that its a bit more powerful because it is almost a full programming language.
|
||||
</p>
|
||||
<p>
|
||||
CubeScript consists of the command itself, followed by any number of arguments separated by whitespace. You can:
|
||||
</p>
|
||||
<!-- Try to keep these examples very, very simple... -->
|
||||
<ul style="list-style-type : square;">
|
||||
<li>
|
||||
Use <span class="code">""</span> to quote strings that have whitespace within them.
|
||||
<ul><li>Input example: <span class="code">alias grass "is greener"</span></li></ul>
|
||||
</li>
|
||||
<li>
|
||||
Use <span class="code">$</span> to capture the value of a variable/alias/bracketed-string as an argument for a command.
|
||||
<ul>
|
||||
<li>Input example: <span class="code">echo "The grass" $grass</span></li>
|
||||
<li>Output: <span class="code">The grass is greener</span></li>
|
||||
<li>Input example: <span class="code">echo "Your FOV is" $fov</span></li>
|
||||
<li>Output: <span class="code">Your FOV is 90.0</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Use <span class="code">;</span> to sequence multiple commands into one.
|
||||
<ul>
|
||||
<li>Input example: <span class="code">alias grass "is yellow"; echo "The grass" $grass</span></li>
|
||||
<li>Output: <span class="code">The grass is yellow</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
You can also use <span class="code">()</span> or <span class="code">[]</span> to quote strings (i.e. instead of "").
|
||||
These can be nested infinitely and may contain linefeeds.
|
||||
The normal brackets <span class="code">()</span> are special, as they evaluate commands contained within them,
|
||||
before evaluating the surrounding command.
|
||||
<ul>
|
||||
<li>Input example: <span class="code">alias 4x2 (* 2 (+ 1 3))</span></li>
|
||||
<li>Input command: <span class="code">echo $4x2</span></li>
|
||||
<li>Output: <span class="code">8</span></li>
|
||||
<li>Input example: <span class="code">alias grass [ is greener ]</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Lastly, you can use the automatically-set aliases of <span class="code">$arg1</span>
|
||||
(.. and <span class="code">$arg2</span>, <span class="code">$arg3</span>, etc) in your scripts.
|
||||
<ul>
|
||||
<li>Input example: <span class="code">alias grass [ if (= $arg1 1) [ echo "The grass is green" ] [ if (= $arg1 2) [ echo "The grass is yellow" ] ] ]</span></li>
|
||||
<li>Input command: <span class="code">grass 1</span></li>
|
||||
<li>Output: <span class="code">The grass is green</span></li>
|
||||
<li>Input command: <span class="code">grass 2</span></li>
|
||||
<li>Output: <span class="code">The grass is brown</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
It is recommended to read examples of this in your ./config/ folder to understand them better. The documentation below
|
||||
contains a reference of ALL of the CubeScript commands at your disposal. Have fun!
|
||||
</p>
|
||||
<div id="content">
|
||||
<!-- contents -->
|
||||
<div id="contents">
|
||||
<p>
|
||||
<xsl:value-of select="t:description"/>
|
||||
</p>
|
||||
<div class="dottedline"></div>
|
||||
<h3>CATEGORIES:</h3>
|
||||
<ul id="categorylist">
|
||||
<xsl:for-each select="t:sections/t:section">
|
||||
<xsl:sort select="@sortindex[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']" />
|
||||
<li>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#section_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- sections -->
|
||||
<xsl:for-each select="t:sections/t:section">
|
||||
<xsl:sort select="@sortindex[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
|
||||
<div class="dottedline"></div>
|
||||
<div class="section">
|
||||
<h3>
|
||||
<!-- section anchor -->
|
||||
<xsl:attribute name="id">
|
||||
<xsl:text>section_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</h3>
|
||||
|
||||
<!-- description -->
|
||||
<p>
|
||||
<xsl:value-of select="t:description"/>
|
||||
</p>
|
||||
|
||||
<!-- identifiers -->
|
||||
<xsl:for-each select="t:identifiers/*">
|
||||
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
|
||||
<xsl:variable name="readOnly" select="t:value/@readOnly and (t:value/@readOnly = 'true' or t:value/@readOnly = '1')"/>
|
||||
|
||||
<div class="identifier">
|
||||
<!-- identifier anchor -->
|
||||
<xsl:attribute name="id">
|
||||
<xsl:text>identifier_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
|
||||
<!-- display name -->
|
||||
<div class="displayname">
|
||||
<xsl:call-template name="identifierLink"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="t:arguments"><!-- command args -->
|
||||
<xsl:for-each select="t:arguments/*">
|
||||
<xsl:value-of select="@token"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<xsl:when test="t:value and not($readOnly)"><!-- variable value -->
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="t:value/@token"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
|
||||
<!-- description -->
|
||||
<div class="description">
|
||||
<xsl:value-of select="t:description"/>
|
||||
</div>
|
||||
|
||||
<!-- arguments or value description -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="t:arguments/*"><!-- command args -->
|
||||
<div class="argumentDescriptions">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Argument</th>
|
||||
<th>Description</th>
|
||||
<th>Values</th>
|
||||
</tr>
|
||||
<xsl:for-each select="t:arguments/*">
|
||||
<tr>
|
||||
<td class="token">
|
||||
<xsl:value-of select="@token"/>
|
||||
</td>
|
||||
<td class="description">
|
||||
<xsl:value-of select="@description"/>
|
||||
<xsl:if test="@optional">
|
||||
<xsl:text> (optional)</xsl:text>
|
||||
</xsl:if>
|
||||
</td>
|
||||
<td class="values">
|
||||
<xsl:value-of select="@valueNotes"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:when test="t:value"> <!-- var value -->
|
||||
<div class="valueDescription">
|
||||
<table>
|
||||
<tr>
|
||||
<xsl:if test="not($readOnly)">
|
||||
<th>
|
||||
Token
|
||||
</th>
|
||||
</xsl:if>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<th>Values</th>
|
||||
<th>Range</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<xsl:if test="not($readOnly)">
|
||||
<td class="token">
|
||||
<xsl:value-of select="t:value/@token"/>
|
||||
</td>
|
||||
</xsl:if>
|
||||
<td class="description">
|
||||
<xsl:value-of select="t:value/@description"/>
|
||||
</td>
|
||||
<td class="values">
|
||||
<xsl:value-of select="t:value/@valueNotes"/>
|
||||
</td>
|
||||
<td class="range">
|
||||
<xsl:value-of select="t:value/@minValue"/>
|
||||
<xsl:text>..</xsl:text>
|
||||
<xsl:value-of select="t:value/@maxValue"/>
|
||||
</td>
|
||||
<td class="defaultValue">
|
||||
<xsl:value-of select="t:value/@defaultValue"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
<!-- remarks -->
|
||||
<xsl:if test="t:remarks">
|
||||
<div class="remarks">
|
||||
<xsl:for-each select="t:remarks/t:remark">
|
||||
<div class="remark">
|
||||
<xsl:value-of select="."/>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<!-- examples -->
|
||||
<xsl:if test="t:examples">
|
||||
<div class="examples">
|
||||
<xsl:for-each select="t:examples/t:example">
|
||||
<p>
|
||||
Example:
|
||||
<span class="code">
|
||||
<xsl:value-of select="t:code"/>
|
||||
</span>
|
||||
<xsl:if test="t:explanation">
|
||||
<xsl:for-each select="t:explanation">
|
||||
<span class="exampleExplanation">
|
||||
<xsl:value-of select="."/>
|
||||
</span>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</p>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<!-- return value -->
|
||||
|
||||
<xsl:if test="t:return">
|
||||
<p>
|
||||
Return value: <xsl:value-of select="t:return/@description"/> <xsl:if test="t:return/@valueNotes">, <xsl:value-of select="t:return/@valueNotes"/></xsl:if>
|
||||
</p>
|
||||
</xsl:if>
|
||||
|
||||
<!-- default keys -->
|
||||
<xsl:if test="t:defaultKeys/*">
|
||||
<div class="defaultKeys">
|
||||
<br/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(t:defaultKeys/*) = 1">
|
||||
<xsl:text>default key: </xsl:text>
|
||||
<xsl:apply-templates select="t:defaultKeys/*"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>default keys:</xsl:text>
|
||||
<br/>
|
||||
<xsl:for-each select="t:defaultKeys/*">
|
||||
<xsl:apply-templates select="."/>
|
||||
<br/>
|
||||
</xsl:for-each>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<!-- references -->
|
||||
<xsl:if test="t:references">
|
||||
<div class="references">
|
||||
See also:
|
||||
<!-- refer to identifiers (identifier anchor) -->
|
||||
<xsl:for-each select="t:references/t:identifierReference">
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#identifier_</xsl:text>
|
||||
<xsl:value-of select="translate(@identifier, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="class">internal</xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@name">
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@identifier"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</a>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<!-- refer to web resources -->
|
||||
<xsl:for-each select="t:references/t:webReference">
|
||||
<xsl:text>, </xsl:text><!-- we assume it's never the only entry! -->
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="@url"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="class">external</xsl:attribute>
|
||||
<xsl:attribute name="target">_blank</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</xsl:for-each>
|
||||
<!-- refer to wiki resources -->
|
||||
<xsl:for-each select="t:references/t:wikiReference">
|
||||
<xsl:text>, </xsl:text><!-- we assume it's never the only entry! -->
|
||||
<a>
|
||||
<xsl:attribute name="href">https://wiki.cubers.net/action/view/<xsl:value-of select="@article"/></xsl:attribute>
|
||||
<xsl:attribute name="class">external</xsl:attribute>
|
||||
<xsl:attribute name="target">_blank</xsl:attribute>
|
||||
<xsl:value-of select="@article"/>
|
||||
</a>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</div>
|
||||
<!-- XML: CONTENTS PANEL -->
|
||||
<div class="commandlist">
|
||||
CubeScript command & variable list
|
||||
</div>
|
||||
<div id="contentspanel">
|
||||
<xsl:if test="t:sections">
|
||||
<xsl:for-each select="t:sections/t:section">
|
||||
<xsl:sort select="@sortindex[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
|
||||
<div class="sectiontitle">
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#section_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="identifiers">
|
||||
<xsl:if test="t:identifiers">
|
||||
<ul>
|
||||
<xsl:for-each select="t:identifiers/*">
|
||||
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
|
||||
<li>
|
||||
<xsl:call-template name="identifierLink"/>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:transform>
|
||||
@@ -0,0 +1,443 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:transform version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="https://assault.cubers.net/docs/xml">
|
||||
<!--
|
||||
This file transforms the ../reference.xml document into an XHTML webpage.
|
||||
|
||||
Written by: Rabid Viper Productions.
|
||||
Special thanks to Adrian 'driAn' Henke for the original document
|
||||
that all these XML-related files are based upon.
|
||||
|
||||
You may be able to redistribute this content under specific
|
||||
conditions. Please read the licensing information, available
|
||||
at https://assault.cubers.net/docs/license.html for the
|
||||
conditions that would apply to what you may be redistributing.
|
||||
-->
|
||||
|
||||
<xsl:output method="html" omit-xml-declaration="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
|
||||
|
||||
<xsl:template match="t:key">
|
||||
<i>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@name">
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@alias"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</i>
|
||||
<xsl:if test="@description">
|
||||
<xsl:text> - </xsl:text>
|
||||
<xsl:value-of select="@description"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="identifierLink">
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#identifier_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/t:cuberef">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=UTF-8" />
|
||||
<meta name="robots" content="NOODP" />
|
||||
<meta name="author" content="Rabid Viper Productions" />
|
||||
<meta name="copyright" content="You may be able to redistribute this content under specific conditions.
|
||||
Please read the licensing information, available @ https://assault.cubers.net/docs/license.html for the
|
||||
conditions that would apply to what you may be redistributing." />
|
||||
<title>AssaultCube Documentation :: CubeScript</title>
|
||||
<link rel="stylesheet" href="css/main.css" />
|
||||
<link rel="stylesheet" href="css/docs.css" />
|
||||
<link rel="stylesheet" href="css/referencexml.css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="docsheader">
|
||||
AssaultCube Documentation
|
||||
</div>
|
||||
<div id="logo">
|
||||
<a href="index.html"><img src="images/aclogo.png"
|
||||
alt="AssaultCube" width="193px" height="81px" /></a>
|
||||
</div>
|
||||
<div id="menubar">
|
||||
 
|
||||
</div>
|
||||
<div class="docsmain">
|
||||
<div id="gohome">
|
||||
<a href="index.html">Go to documentation index ↵</a>
|
||||
</div>
|
||||
<div id="topbutton">
|
||||
<a href="#">↑ Top of the page?</a>
|
||||
</div>
|
||||
<h2>
|
||||
CubeScript
|
||||
</h2>
|
||||
<p>
|
||||
CubeScript is the scripting language of AssaultCube and it is similar to scripting languages of other games, except
|
||||
that its a bit more powerful because it is almost a full programming language.
|
||||
</p>
|
||||
<p>
|
||||
CubeScript consists of the command itself, followed by any number of arguments separated by whitespace. You can:
|
||||
</p>
|
||||
<!-- Try to keep these examples very, very simple... -->
|
||||
<ul style="list-style-type : square;">
|
||||
<li>
|
||||
Use <span class="code">""</span> to quote strings that have whitespace within them.
|
||||
<ul><li>Input example: <span class="code">alias grass "is greener"</span></li></ul>
|
||||
</li>
|
||||
<li>
|
||||
Use <span class="code">$</span> to capture the value of a variable/alias/bracketed-string as an argument for a command.
|
||||
<ul>
|
||||
<li>Input example: <span class="code">echo "The grass" $grass</span></li>
|
||||
<li>Output: <span class="code">The grass is greener</span></li>
|
||||
<li>Input example: <span class="code">echo "Your FOV is" $fov</span></li>
|
||||
<li>Output: <span class="code">Your FOV is 90.0</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Use <span class="code">;</span> to sequence multiple commands into one.
|
||||
<ul>
|
||||
<li>Input example: <span class="code">alias grass "is yellow"; echo "The grass" $grass</span></li>
|
||||
<li>Output: <span class="code">The grass is yellow</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
You can also use <span class="code">()</span> or <span class="code">[]</span> to quote strings (i.e. instead of "").
|
||||
These can be nested infinitely and may contain linefeeds.
|
||||
The normal brackets <span class="code">()</span> are special, as they evaluate commands contained within them,
|
||||
before evaluating the surrounding command.
|
||||
<ul>
|
||||
<li>Input example: <span class="code">alias 4x2 (* 2 (+ 1 3))</span></li>
|
||||
<li>Input command: <span class="code">echo $4x2</span></li>
|
||||
<li>Output: <span class="code">8</span></li>
|
||||
<li>Input example: <span class="code">alias grass [ is greener ]</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Lastly, you can use the automatically-set aliases of <span class="code">$arg1</span>
|
||||
(.. and <span class="code">$arg2</span>, <span class="code">$arg3</span>, etc) in your scripts.
|
||||
<ul>
|
||||
<li>Input example: <span class="code">alias grass [ if (= $arg1 1) [ echo "The grass is green" ] [ if (= $arg1 2) [ echo "The grass is yellow" ] ] ]</span></li>
|
||||
<li>Input command: <span class="code">grass 1</span></li>
|
||||
<li>Output: <span class="code">The grass is green</span></li>
|
||||
<li>Input command: <span class="code">grass 2</span></li>
|
||||
<li>Output: <span class="code">The grass is brown</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
It is recommended to read examples of this in your ./config/ folder to understand them better. The documentation below
|
||||
contains a reference of ALL of the CubeScript commands at your disposal. Have fun!
|
||||
</p>
|
||||
<div id="content">
|
||||
<!-- contents -->
|
||||
<div id="contents">
|
||||
<p>
|
||||
<xsl:value-of select="t:description"/>
|
||||
</p>
|
||||
<div class="dottedline"></div>
|
||||
<h3>CATEGORIES:</h3>
|
||||
<ul id="categorylist">
|
||||
<xsl:for-each select="t:sections/t:section">
|
||||
<xsl:sort select="@sortindex[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']" />
|
||||
<li>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#section_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- sections -->
|
||||
<xsl:for-each select="t:sections/t:section">
|
||||
<xsl:sort select="@sortindex[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
|
||||
<div class="dottedline"></div>
|
||||
<div class="section">
|
||||
<h3>
|
||||
<!-- section anchor -->
|
||||
<xsl:attribute name="id">
|
||||
<xsl:text>section_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</h3>
|
||||
|
||||
<!-- description -->
|
||||
<p>
|
||||
<xsl:value-of select="t:description"/>
|
||||
</p>
|
||||
|
||||
<!-- identifiers -->
|
||||
<xsl:for-each select="t:identifiers/*">
|
||||
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
|
||||
<xsl:variable name="readOnly" select="t:value/@readOnly and (t:value/@readOnly = 'true' or t:value/@readOnly = '1')"/>
|
||||
|
||||
<div class="identifier">
|
||||
<!-- identifier anchor -->
|
||||
<xsl:attribute name="id">
|
||||
<xsl:text>identifier_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
|
||||
<!-- display name -->
|
||||
<div class="displayname">
|
||||
<xsl:call-template name="identifierLink"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="t:arguments"><!-- command args -->
|
||||
<xsl:for-each select="t:arguments/*">
|
||||
<xsl:value-of select="@token"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<xsl:when test="t:value and not($readOnly)"><!-- variable value -->
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="t:value/@token"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
|
||||
<!-- description -->
|
||||
<div class="description">
|
||||
<xsl:value-of select="t:description"/>
|
||||
</div>
|
||||
|
||||
<!-- arguments or value description -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="t:arguments/*"><!-- command args -->
|
||||
<div class="argumentDescriptions">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Argument</th>
|
||||
<th>Description</th>
|
||||
<th>Values</th>
|
||||
</tr>
|
||||
<xsl:for-each select="t:arguments/*">
|
||||
<tr>
|
||||
<td class="token">
|
||||
<xsl:value-of select="@token"/>
|
||||
</td>
|
||||
<td class="description">
|
||||
<xsl:value-of select="@description"/>
|
||||
<xsl:if test="@optional">
|
||||
<xsl:text> (optional)</xsl:text>
|
||||
</xsl:if>
|
||||
</td>
|
||||
<td class="values">
|
||||
<xsl:value-of select="@valueNotes"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:when test="t:value"> <!-- var value -->
|
||||
<div class="valueDescription">
|
||||
<table>
|
||||
<tr>
|
||||
<xsl:if test="not($readOnly)">
|
||||
<th>
|
||||
Token
|
||||
</th>
|
||||
</xsl:if>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<th>Values</th>
|
||||
<th>Range</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<xsl:if test="not($readOnly)">
|
||||
<td class="token">
|
||||
<xsl:value-of select="t:value/@token"/>
|
||||
</td>
|
||||
</xsl:if>
|
||||
<td class="description">
|
||||
<xsl:value-of select="t:value/@description"/>
|
||||
</td>
|
||||
<td class="values">
|
||||
<xsl:value-of select="t:value/@valueNotes"/>
|
||||
</td>
|
||||
<td class="range">
|
||||
<xsl:value-of select="t:value/@minValue"/>
|
||||
<xsl:text>..</xsl:text>
|
||||
<xsl:value-of select="t:value/@maxValue"/>
|
||||
</td>
|
||||
<td class="defaultValue">
|
||||
<xsl:value-of select="t:value/@defaultValue"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
<!-- remarks -->
|
||||
<xsl:if test="t:remarks">
|
||||
<div class="remarks">
|
||||
<xsl:for-each select="t:remarks/t:remark">
|
||||
<div class="remark">
|
||||
<xsl:value-of select="."/>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<!-- examples -->
|
||||
<xsl:if test="t:examples">
|
||||
<div class="examples">
|
||||
<xsl:for-each select="t:examples/t:example">
|
||||
<p>
|
||||
Example:
|
||||
<span class="code">
|
||||
<xsl:value-of select="t:code"/>
|
||||
</span>
|
||||
<xsl:if test="t:explanation">
|
||||
<xsl:for-each select="t:explanation">
|
||||
<span class="exampleExplanation">
|
||||
<xsl:value-of select="."/>
|
||||
</span>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</p>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<!-- return value -->
|
||||
|
||||
<xsl:if test="t:return">
|
||||
<p>
|
||||
Return value: <xsl:value-of select="t:return/@description"/> <xsl:if test="t:return/@valueNotes">, <xsl:value-of select="t:return/@valueNotes"/></xsl:if>
|
||||
</p>
|
||||
</xsl:if>
|
||||
|
||||
<!-- default keys -->
|
||||
<xsl:if test="t:defaultKeys/*">
|
||||
<div class="defaultKeys">
|
||||
<br/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(t:defaultKeys/*) = 1">
|
||||
<xsl:text>default key: </xsl:text>
|
||||
<xsl:apply-templates select="t:defaultKeys/*"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>default keys:</xsl:text>
|
||||
<br/>
|
||||
<xsl:for-each select="t:defaultKeys/*">
|
||||
<xsl:apply-templates select="."/>
|
||||
<br/>
|
||||
</xsl:for-each>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<!-- references -->
|
||||
<xsl:if test="t:references">
|
||||
<div class="references">
|
||||
See also:
|
||||
<!-- refer to identifiers (identifier anchor) -->
|
||||
<xsl:for-each select="t:references/t:identifierReference">
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#identifier_</xsl:text>
|
||||
<xsl:value-of select="translate(@identifier, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="class">internal</xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@name">
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@identifier"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</a>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<!-- refer to web resources -->
|
||||
<xsl:for-each select="t:references/t:webReference">
|
||||
<xsl:text>, </xsl:text><!-- we assume it's never the only entry! -->
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="@url"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="class">external</xsl:attribute>
|
||||
<xsl:attribute name="target">_blank</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</xsl:for-each>
|
||||
<!-- refer to wiki resources -->
|
||||
<xsl:for-each select="t:references/t:wikiReference">
|
||||
<xsl:text>, </xsl:text><!-- we assume it's never the only entry! -->
|
||||
<a>
|
||||
<xsl:attribute name="href">https://wiki.cubers.net/action/view/<xsl:value-of select="@article"/></xsl:attribute>
|
||||
<xsl:attribute name="class">external</xsl:attribute>
|
||||
<xsl:attribute name="target">_blank</xsl:attribute>
|
||||
<xsl:value-of select="@article"/>
|
||||
</a>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</div>
|
||||
<!-- XML: CONTENTS PANEL -->
|
||||
<div class="commandlist">
|
||||
CubeScript command & variable list
|
||||
</div>
|
||||
<div id="contentspanel">
|
||||
<xsl:if test="t:sections">
|
||||
<xsl:for-each select="t:sections/t:section">
|
||||
<xsl:sort select="@sortindex[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
|
||||
<div class="sectiontitle">
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#section_</xsl:text>
|
||||
<xsl:value-of select="translate(@name, ' ', '_')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="identifiers">
|
||||
<xsl:if test="t:identifiers">
|
||||
<ul>
|
||||
<xsl:for-each select="t:identifiers/*">
|
||||
<xsl:sort select="@name[not(../../@sort) or ../../@sort = 'true' or ../../@sort = '1']"/>
|
||||
<li>
|
||||
<xsl:call-template name="identifierLink"/>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:transform>
|
||||
@@ -0,0 +1,10 @@
|
||||
# Automatically allows *nix based platforms to transform ../reference.xml into ../../config/docs.cfg
|
||||
# This requires "xsltproc" - which may already be installed on most Linux based operating systems.
|
||||
|
||||
xsltproc -o ../../config/docs.cfg cuberef2cubescript.xslt ../reference.xml
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo "This shell script has finished!"
|
||||
sleep 10
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@echo off
|
||||
rem Automatically allows MS Windows to transform ../reference.xml into ../../config/docs.cfg
|
||||
rem This requires MSXSL, available at: http://www.microsoft.com/en-us/download/details.aspx?id=21714
|
||||
@echo on
|
||||
|
||||
msxsl.exe -o ..\..\config\docs.cfg -v ..\reference.xml cuberef2cubescript.xslt
|
||||
|
||||
echo THIS BATCH
|
||||
echo IS FINISHED!
|
||||
pause
|
||||
Reference in New Issue
Block a user