User manual

© 2011 Racktivity NV 156/160
Antwerpsesteenweg 19 - 9080 Lochristi - Belgium - www.racktivity.com v 2014.5.14
4. There must be a render function which takes options as a parameter. Options is an
object with some parameters that we can use, such as:
o options.space: get space name.
o options.page: get page name.
o options.body: get the page contents.
o options.tags: get the tags of a page.
o options.params: get the parameters that are passed to the macro tag, for example
[[note:param1=value1]].
o options.query: retrieves the query from a URL, for example the query
?space=myspace&page=mypage results in options.query.space=myspace
and options.query.page=mypage.
o options.pagecontent: get the content of a page in HTML code.
o options.app: get an instance of the 'Sammy' framework, which allows you to trigger
actions.
o options.config: get the configuration of the macro.
o options.saveConfig(): saves the provided configuration of the macro.
o options.addCss(): select a CSS style sheet either through a CSS file or a direct style
code.
o options.addDependency(): add a JavaScript library dependency if needed by the
macro.
o options.swap(): swap the old content of a page with new content.
o options.renderWiki(): return the HTML element of a given Markdown syntax.
5. If you want to apply a special style sheet for your macro, you need the
options.addCss() function. This function has three arguments:
o id: a unique id for your macro (usually just the macro name since it should be
unique).
o tag: either "style" or "link" tag, where:
style: is used if you're giving it CSS dumped syntax.
link: is used if you're giving it a CSS file to load.
o params:
if the tag is style, params is a dumped CSS string (as shown in the example).
if the tag is link, params is a key/value object.
For example: 'params': {'rel': 'stylesheet', 'href':
'http://yandex.st/highlightjs/5.16/styles/default.min.css'}
6. You can load extra JavaScript libraries in your macro with the
options.addDependency function. This functions requires two arguments:
o callback: callback function to be called after loading all dependency scripts, cb in the
given example
o dependencies: list of file links to be loaded.
In this case, you have to put all code that depends on the loaded dependencies in a
callback function which you give as first argument to the addDependency function
call.