Help:Editing: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
Line 60: Line 60:


===Notes===
===Notes===
* This template only adds the function to the [[:Category:Macro Function|Macro Function]] category, you should manually add any other categories it belongs in. Categories can be added by using {{code|[[Category:Example]]}} somewhere within the artible, preferably at the end to make it easier for other editors to find.
* This template only adds the function to the [[:Category:Macro Function|Macro Function]] category, you should manually add any other categories it belongs in. Categories can be added by including <source lang="text" enclose=none>[[Category:Example]]</source>, where Example is the name of the category you with to add. You can include this code anywhere within the article, but preferably at the end to make it easier for other editors to find.


* The broken bar | is a special character inside templates; this presents problems when trying to build wiki tables inside a template. There is a special template that allows you to work around this problem: using <source lang="php" enclose=none>{{!}}</source> in place of all broken bars will allow your table to work properly inside a template.
* The broken bar | is a special character inside templates; this presents problems when trying to build wiki tables inside a template. There is a special template that allows you to work around this problem: using <source lang="text" enclose=none>{{!}}</source> in place of all broken bars will allow your table to work properly inside a template.


===Parameters===
===Parameters===

Revision as of 23:08, 7 March 2009

This article contains documentation on specific features of our wiki, see MediaWiki's help on editing article for details of basic formatting and markup.

Miscellaneous Formatting

Macro Code Highlighting

To perform syntax highlighting on your macro code enclose it in the following tags:

Syntax:

  <source lang="mtmacro" line>
  </source>

Example:

  <source lang="mtmacro" line>
    [h: name = getName()]
    [r: name]
  </source>

Produces:

[h: name = getName()]
[r: name]


You can also change the number that the line number starts at:

Example:

  <source lang="mtmacro" line start=10>
    [h: name = getName()]
    [r: name]
  </source>

Produces:

[h: name = getName()]
[r: name]

This is useful for breaking up long chunks of example code, yet still maintaining proper line numbering.


Inline Code

There are a number of ways to include inline code, but we've created a small template that makes it easier than ever. The syntax below produces: example

{{code|example}}

You can replace example with anything you want to be shown as inline code. This is useful if you're referencing a variable, function, or anything else that would be more appropriate in a monospaced typeface. This template works inside wiki-links as well, the follow syntax produces: abort()

[[abort|{{code|abort()}}]]


Function Formatting

A template has been created to assist with writing articles for macro functions. To use the template, begin with {{MacroFunction, followed by any parameters you might use, and then end with }}. See Mediawiki's template help for more documentation on using templates.

Notes

  • This template only adds the function to the Macro Function category, you should manually add any other categories it belongs in. Categories can be added by including [[Category:Example]], where Example is the name of the category you with to add. You can include this code anywhere within the article, but preferably at the end to make it easier for other editors to find.
  • The broken bar | is a special character inside templates; this presents problems when trying to build wiki tables inside a template. There is a special template that allows you to work around this problem: using {{!}} in place of all broken bars will allow your table to work properly inside a template.

Parameters

All parameters are optional, except |name= and |usage=. Although the parameters can be used in any order, using them in the order presented will make it easier for other editors that might work on the function article.

  • |name= • Case-sensitive name of the function.
  • |trusted=true • Adds a note that the function can only be used in a trusted macro. If this parameter is missing, or contains a value that is not true, it will be treated as false and not displayed.
  • |version= • Adds a note for which version of MapTool included the addition of this function. The value should be the exact version number, e.g. 1.3b50
  • |compatibility= • Adds a note stating the version of MapTool that this function's article is about. This is primarily used if a function has received changes since its first inclusion that could cause the usage and/or examples to not work with the version in which it was first introduced. The value should be the exact version number, e.g. 1.3b50
  • |description= • This should contain a brief description on the purpose of the function.
  • |usage= • The usage block should contain the various syntax that the function accepts.
  • |examples= • Examples should be the majority of a function's page content. The more examples there are, the more of a complete understanding the reader will have.
  • |also= • If you use other functions in any examples, or if there are other articles that are related to this one, you should include links to them in this block.
  • |changes= • A place to record changes that function has received in various versions of MapTool.

Example

{{MacroFunction
|name=exampleFunction
|trusted=true
|version=1.3b50
|compatibility=1.3b52
|description=
This is an example function.  It doesn't actually exist as a function in MapTool.

|usage=
<source lang="mtmacro" line>
exampleFunction(param1, param2)
</source>

|example=
This example doesn't really do anything.
<source lang="mtmacro" line>
[h: exampleVariable = "a,b,c"]
[r: exampleFunction(exampleVariable, reverse)]
</source>
Returns:
<source lang="mtmacro" line>
c,b,a
</source>

|also=
[[linkToRelatedArticle|Display Name of Related Article]]

|changes=
* '''1.3b52''' - Added reverse parameter.
}}