Wiki Documentation
WikiDocumentationUsage of the Wiki is very straight forward.
1. Formatting
You can use Markdown Syntax to format and structure your input text.
2. Additional Features
Beyond the basic markdown syntax SCT features the following functionality:
2.1. Wiki Links
To link to other wiki pages you can use one of two linking techniques:
- CamelCase - simply write two ore more uppercase letters in a word and it will transform into a link. - If you don't want that to happen you can escape it with .. like: \CamelCase (the will of course not appear in the output: CamelCase)
- enclose any word in [ ] brackets. e.g.: [Wiki] and it will transform into a link - like this: Wiki
2.2. Macros
Macros are a SCT extension to the Markdown language. Their basic syntax is:
{macroname parameter=value}
There is currently no public interface to add 3rd party macros.. but i'm planning on implementing one.
The currently available macros are documented here:
2.2.1. News Macro
The news macro allows you to display threads of a given board category. A simple usage looks like this:
{news category=7 baseURL=/board limit=5}
This would display the latest 5 threads in the board category of the id '7'.
2.2.1.1. Parameters
The news macro supports the following parameters:
- Category (required): The Id of the Board category (as displayed in the URL to this board category)
- baseURL (required): The URL at which the board is located. (This parameter might get obsolete pretty soon since there is now a way to automatically resolve a configured URL)
- limit: The number of threads to list (default: 5)
- templateName: The name of a django template to be used for rendering. (default: sphene/sphboard/wikimacros/news.html
2.2.1.2. Template
The News Macro requires a simple template (given by the parameter 'templateName' which is by default wiki/news.html)
An example template might look like this:
{% load sph_extras %}
<ul class="news">
{% for thread in threads %}
<li>
<div class="subject">{{ thread.postdate|sph_date }}: {{ thread.subject }}</div>
<div class="body">{{ thread.body_escaped }}</div>
{% if baseURL %}
<div class="comments"><a href="{{ baseURL }}/thread/{{ thread.id }}/">{{ thread.replyCount }} Comments</a></div>
{% endif %}
</li>
{% endfor %}
</ul>
2.2.2. News RSS Macro
This template renders an RSS link (including RSS icon) to the board rss feed displaying the latest threads in the given category.
{newsrss category=1}
2.2.2.1. Parameters
- category - The category for which the link should be rendered. (required)
2.2.3. Include Macro
Allows the inclusion of an external URL into a wiki snip. The file included is also rendered using Markdown !
Example Usage:
{include url=http://yourhell.com/svn/root/django/communitytools/trunk/README start=Directories end=Examples}
The example would include content from the file from the given url starting with a line containing 'Directories' until a line containing the content 'Examples'.
2.2.3.1. Parameters
- url (required): The URL to the file to include
- start (optional): Some value which is used to determine at which position in the file to start the inclusion. (The line containing the given word will not be included)
- end (optional): Some value which is used to determine at which position to stop the inclusion.
2.2.4. Include Template Macro
Allows a user to include arbitrary HTML by including a template from djang's templating system. (Ie. only an admin can create HTML content. - or anyone who has access to the template directories, or whereever the templates are stored.)
Example Usage:
{includetemplate templateName=mydir/sometemplate.html}
2.2.4.1. Parameters
- templateName (required): The name of the template to include.
All additional parameters will be put into the context of the template as 'params'.
2.2.5. Image Macro
Administrators can add attachments to wiki snips. The Image macro allows to add such attachments as images into the wiki snip.
Example Usage:
{img id=123}
The example would include the image with the attachment Id 123. (The attachment Id is displayed in the list of attachments)
2.2.5.1. Parameters
- id (required): Id of the attachment
- img tag parameters: class, width, height, alt, align which are taken 1:1 as HTML parameters.
2.2.6. Attachment List Macro
Creates a list of all attachments of the current wiki snip.
Example Usage:
{attachmentlist}
2.2.6.1. Parameters
- template: The template to use for rendering - Default: sphene/sphwiki/macros/_attachment_list.html
2.2.6.2. Template Variables
attachmentlist uses the generic view function object_list but without pagination.
- attachment_list: Contains a list of all attachments.
2.2.7. Attachment Macro
Displays a single attachment which is referenced by it's id.
Example Usage:
{attachment id=5}
2.2.7.1. Parameters
- id (required): The id of the attachment to link to.
- label: The label of the link - Default: the filename of the attachment
- template: The template to use for rendering - Default: sphene/sphwiki/macros/_attachment.html
2.2.8. Redirect Macro
Redirects from one snip to another. This is useful to create aliases for wiki snips.
Example Usage:
{redirect snip=AnotherSnip}
This does not create an HTTP redirect, but simply loads the other snip. You can also create a chain of redirects (Like RedirectSnip1 redirects to RedirectSnip2 which redirects to RedirectSnip3 .. No idea why this would be of any use.. but it is allowed anyway) - If a loop is detected it breaks the loop at displays the snip the user has requested.
2.2.8.1. Parameters
- snip (required): The target snip to which the user should be redirected.
2.2.8.2. Template Variables
- attachment: The attachment object
- params: all parameters passed to the macro. If you create your own template you can for example use {{ params.label }} to retrieve the value of the 'label' parameter in: {attachment id=5 label="Testing"}
Last Modified: 2008-02-07 19:44:30 by Herbert Poul - [ Snip Changes ] [ Wiki History ]
0 Comments
No comments yet.
Please login to create a new thread.