Support

Support Options

Submit a Support Ticket

 
HomeTopics › Help: Wiki Macros

Help: Wiki Macros

A macro inserts dynamic HTML data in any context supporting Wiki Formatting.

Using Macros

Macro calls are enclosed in two square brackets.

Examples

[[Timestamp]]

Display: 2012-05-26 08:37:55

[[Resource(100)]]

Display: Curriculum on Nanotechnology

[[Tag(heattransfer)]]

Display: heat transfer

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:

  1. Footnotes are automatically linked

Available Macros

[[Tag(args)]]

This macro will generate a link to a Tag.

[[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 width attribute (ex. 120, 25%) for the file/image
  • right, left, top or bottom are 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 using link. If no value is specified, the link is simply removed.
  • nolink means without link to image source (deprecated, use link=)
  • key=value style 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
  • border can only be a number
  • altimage is 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.
[[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:



[[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)]]

[[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.

[[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)]]
[[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
[[Span(args)]]

Wraps text or other elements inside a <span> tag.

[[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.

[[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)]]

[[Tableofcontents(args)]]

Outputs a Table of Contents based off the page headers

[[Resource(args)]]

This macro will insert a linked title to a resource. It can be passed wither an ID or alias.

[[Groupevent(args)]]

Displays group events.

[[Page(args)]]

This macro will insert a linked title to a wiki page. It can be passed either an ID or alias.

[[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:

[[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)]]

[[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.

[[Helloworld(args)]]

Outputs "Hello world"

[[Randompage(args)]]

Generates a link to a random page.

[[Pagename(args)]]

Accepts either 'alias' or 'title' as arg. Returns either the alias (default if no args given) or title of the current page.

[[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)]]

[[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, top or bottom are interpreted as the alignment for the image
  • link=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.
  • nolink means without link to image source (deprecated, use link=)
  • key=value style 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
  • border can 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
[[Timestamp(args)]]

Displays a time-stamp in the following format: YYYY-MM-DD HH:MM:SS

[[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)]]

[[Footnote(args)]]

Add a footnote, or explicitly display collected footnotes when no args (footnote text) are given.

[[Anchor(args)]]

Inserts an anchor into a page.

Created on 18 Feb 2008, Last modified on 03 Mar 2009 0 Visitors, 0 Visits

nanoHUB.org, a resource for nanoscience and nanotechnology, is supported by the National Science Foundation and other funding agencies.