Wiki:Style Guide
From Ren'Py
To ensure that documentation remains consistent throughout the reference manual (and to a lesser extent, the rest of the site), we've created a bunch of templates. This page exists to document those templates and their proper use.
Contents |
Syntax Highlighting
The wiki syntax highlights Ren'Py source code when enclosed between <source lang="rpy"> and </source> tags.
Example:
<source lang="rpy">
# Comments are colored.
if keywords.colored == True:
"Strings are also colored."
</source>
# Comments are colored. if keywords.colored == True: "Strings are also colored."
Page Naming
We make quite a bit of use of [[Help:Subpages|subpages]. All Ren'Py documentation should be on subpages of renpy.
Remember, pages can be referred to using:
- [[../sibling]]
- [[/child]]
- [[../]]
- [[absolute/path]]
Also remember the slash trick... if you end a link with a slash (like [[/child/]] or [[../sibling]]), mediawiki cleans them up to get rid of the preceding and trailing slashes.
Link Templates
These are used to link to (or otherwise reference) something.
confvarref
Links to a configuration variable defined in renpy/doc/reference/Configuration Variables.
Example:
- The screen width is controlled by {{confvarref|config.screen_width}}.
- The screen width is controlled by config.screen_width.
funcref
The funcref template is used to access the function given as it's first parameter. It's assumed the function corresponds to a page under renpy/doc/reference/functions.
Example:
- The function is {{funcref|ui.vbox}}.
- The function is ui.vbox.
funcinc
The funcinc template is used to include the documentation for the function given as the first parameter into the web page. It's assumed the function corresponds to a page under renpy/doc/reference/functions.
Example:
{{funcinc|ui.vbox}}
| Function: | ui.vbox | (spacing=None, style='vbox', **properties): |
This creates a layout that places widgets next to each other, from top to bottom. New widgets are added to this vbox until ui.close is called.
spacing - The number of pixels to leave between widgets. If None, take the amount of spacing from the style.
statementref
Links its single parameter to a statement defined in renpy/doc/reference/The Ren'Py Language.
Example:
- The {{statementref|hide}} is rarely used.
- The hide statement is rarely used.
storevarref
Links to a configuration variable defined in renpy/doc/reference/Store Variables.
Example:
- To hide the mouse, set {{storevarref|mouse_visible}} to false.
- To hide the mouse, set mouse_visible to false.
Documentation Templates
These are used to provide the documentation for something.
func
The func template is used to document a function, giving a link back to a page that has more information about that function, such as an example. It takes two parameters:
- n - the name of the function.
- p - the list of parameters. Note the lack of parenthesis, and realize that p is not a parameter itself.
The documentation for the function should follow the {{func}} template. It's concluded by an {{end}} template. This should be used on a page under renpy/doc/reference/functions.
Example:
{{func|n=renpy.can_drink|p=age, state='NY', **properties)}}
Return true if a person of ''age'' can drink in ''state''.
{{end}}
| Function: | renpy.can_drink | (age, state='NY', **properties)): |
Return true if a person of age can drink in state.
func2
Like func, except it doesn't link to any page. (So it can be used anywhere.)
Example:
{{func2|n=renpy.can_drink|p=age, state='NY', **properties)}}
Return true if a person of ''age'' can drink in ''state''.
{{end}}
| Function: | renpy.can_drink | (age, state='NY', **properties)): |
Return true if a person of age can drink in state.
var
This is used to document a variable. It takes two parameters:
- n is the name of the variable.
- v is its default value.
Documentation is placed between {{var}} and {{end}}. Generally, variables should be documented on either renpy/doc/reference/Store Variables or renpy/doc/reference/Configuration Variables.
Example:
{{var|n=turbo_speed|v=False}}
Setting this to true boosts the speed of the game, at the cost of blue-shifting everything.
{{end}}
| Variable: | turbo_speed | = False |
Setting this to true boosts the speed of the game, at the cost of blue-shifting everything.
