You are here: Topics › Help: Wiki Macros
Help: Wiki Macros
Using Macros
Macro calls are enclosed in two square brackets.
Examples
[[Timestamp]]
Display: 2012-05-22 13:01:09
[[Resource(100)]]
Display: (Resource(100) failed)
[[Tag(heattransfer)]]
Display: (heattransfer not found)
To add a footnote to text you use the footnote macro. [[FootNote(Footnotes are automatically linked)]] You use the same macro but with no text to display the accumulated list of footnotes. For example: [[FootNote]]
Display: To add a footnote to text you use the footnote macro. [1] You use the same macro but with no text to display the accumulated list of footnotes. For example:
Available Macros
[[Page(args)]]This macro will insert a linked title to a wiki page. It can be passed either an ID or alias.
[[Div(args)]]Allows content to be wrapped in a
<div>tag. This macro must be used twice:[[Div(start)]]to indicate where to create the opening<div>tag and[[Div(end)]]to indicate where to close the resulting<div>tag. Attributes may be applied by separating name/value pairs with a comma. Example:[[Div(start, class=myclass)]][[Macrolist(args)]]Displays a list of all installed Wiki macros, including documentation if available. Optionally, the name of a specific macro can be provided as an argument. In that case, only the documentation for that macro will be rendered.
[[Children(args)]]Inserts an alphabetic list of all sub-pages (children) of the current page into the output. Accepts one parameter:
- depth: how deep to mine for pages. Default is one level.
Example usage:
[[Children(depth=3)]][[Youtube(args)]]Embeds a Youtube Video into the Page. Accepts either full Youtube video URL or just Youtube Video ID (highlighted below).
Youtube URL: http://www.youtube.com/watch?v=FgfGOEpZEOw
Examples:
[[Youtube(FgfGOEpZEOw)]][[Youtube(http://www.youtube.com/watch?v=FgfGOEpZEOw)]][[Youtube(FgfGOEpZEOw, 640, 380)]] - width 640px, height 380px[[Youtube(FgfGOEpZEOw, 100%)]] - width of 100%
Displays:
[[Groupevent(args)]]Displays group events.
[[Column(args)]]Allows content to be split into columns. This macro must first start with a declaration of the number of columns you want to use:
[[Column(3)]]Then you must use the macro twice to indicate where a column starts and ends:[[Column(start)]]
content
[[Column(end)]]Attributes may be applied by separating name/value pairs with a comma. Example:
[[Column(start, class=myclass)]][[Randompage(args)]]Generates a link to a random page.
[[Twitter(args)]]Embeds a Twitter Feed into the page. Can be a user feed(@nanohub) or search by trend(#nanotechnology), followed by a comma(,) and then the number of tweets to display.
Examples:
[[Twitter(@nanohub,2)]][[Twitter(#nanotechnology,5)]]
Displays:
Loading Twitter Feed...[[Timestamp(args)]]Displays a time-stamp in the following format: YYYY-MM-DD HH:MM:SS
[[Helloworld(args)]]Outputs "Hello world"
[[Pagename(args)]]Accepts either 'alias' or 'title' as arg. Returns either the alias (default if no args given) or title of the current page.
[[Footnote(args)]]Add a footnote, or explicitly display collected footnotes when no args (footnote text) are given.
[[Tag(args)]]This macro will generate a link to a Tag.
[[Span(args)]]Wraps text or other elements inside a
<span>tag.[[Resource(args)]]This macro will insert a linked title to a resource. It can be passed wither an ID or alias.
[[Contributor(args)]]This macro will generate a link to a contributor's page with the contributor's name as the link text. It accepts either the contributor's ID, username, or name. NOTE: to use a name, it must be identical to their contributor page.
[[Tableofcontents(args)]]Outputs a Table of Contents based off the page headers
[[Anchor(args)]]Inserts an anchor into a page.
[[File(args)]]This macro alternately generates a link to a file or embeds the file for display (only valid for CDF files and images). The first argument is the filename.
- digits and unit are interpreted as the
widthattribute (ex. 120, 25%) for the file/image right,left,toporbottomare interpreted as the alignment for the file (currently, only applies to images)link=some Link...replaces the link to the file source by the one specified usinglink. If no value is specified, the link is simply removed.nolinkmeans without link to image source (deprecated, uselink=)key=valuestyle are interpreted as HTML attributes or CSS style indications for the file. Valid keys are:- align, border, width, height, alt, desc, title, longdesc, class, id and usemap
bordercan only be a numberaltimageis only valid for CDF files. It is ignored for other file types.
Examples:
[[File(mydoc.pdf)]]# simplest[[File(mydoc.pdf, alt="My document")]]# ALT text. For images, this is the "alt" attribute. For files, the "title" attribute.[[File(mydoc.pdf, desc="My document")]]# Link text. If none is provided, the filename will be used.
Examples (CDF):
[[File(prog.cdf, width=300, height=500)]]# with embed width and height sizes[[File(prog.cdf, width=300, height=500, altimage=prog.png)]]# CDF file with sizes and alternate image to show if CDF plugin isn't available.[[File(prog.cdf, width=300, height=500, alt="A nifty program")]]# CDF file with sizes and alternate content to show if CDF plugin isn't available.
- digits and unit are interpreted as the
[[Titleindex(args)]]Inserts an alphabetic list of all wiki pages into the output. Accepts a prefix string as parameter: if provided, only pages with names that start with the prefix are included in the resulting list. If this parameter is omitted, all pages are listed.
The list may have a sorting applied by adding the sort=[title,created(oldest to newest),modified(newest to oldest)] argument. For example,
[[TitleIndex(sort=modified)]]will list all pages by their last modified date (most recent to oldest). If you have a page prefix, simply add a comma and the sort parameter after. For example:[[TitleIndex(Help, sort=modified)]][[Parents(args)]]Inserts a nested list of ancestor pages (parents) of the current page into the output. Accepts one parameter:
- depth: how deep to mine for pages. Default is one level.
Example usage:
[[Parents(depth=3)]][[Fileindex(args)]]Inserts an alphabetic list of all files and images attached to this page into the output. Accepts a prefix string as parameter: if provided, only files with names that start with the prefix are included in the resulting list. If this parameter is omitted, all files are listed.
[[Recentpage(args)]]Generates a link and optional bit of text to a recently created or updated page page.
Args:
- limit - Number of articles to return. Defaults to 1
- container class - A CSS class to be applied to the wrapper
DIV
[[Image(args)]]Embed an image in wiki-formatted text. The first argument is the file specification. The remaining arguments are optional and allow configuring the attributes and style of the rendered
<img>element:- digits and unit are interpreted as the size (ex. 120, 25%) for the image
right,left,toporbottomare interpreted as the alignment for the imagelink=some Link...replaces the link to the image source by the one specified using Link. If no value is specified, the link is simply removed.nolinkmeans without link to image source (deprecated, uselink=)key=valuestyle are interpreted as HTML attributes or CSS style indications for the image. Valid keys are:- align, border, width, height, alt, title, longdesc, class, id and usemap
bordercan only be a number
Examples:
[[Image(photo.jpg)]]# simplest[[Image(photo.jpg, 120px)]]# with image width size[[Image(photo.jpg, right)]]# aligned by keyword[[Image(photo.jpg, nolink)]]# without link to source[[Image(photo.jpg, align=right)]]# aligned by attribute[[Image(photo.jpg, 120px, class=mypic)]]# with image width size and a CSS class
[[Slider(args)]]Creates a slider with the images passed in. Enter uploaded image names seperated by commas.
Examples:
[[Slider(image1.jpg, image2.gif, image3.png)]]