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: 2024-10-04 03:12:52
[[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:
^ Footnotes are automatically linked
Available Macros
[[Anchor(args)]]
Inserts an anchor into a page.
[[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)]]
[[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.
[[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)]]
[[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
orbottom
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 usinglink
. If no value is specified, the link is simply removed.nolink
means without link to image source (deprecated, uselink=
)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 usemapborder
can only be a numberaltimage
is only valid for CDF files. It is ignored for other file types.details
indicates wether to display file information (size, etc.). Defaults to: on, Accepts: false, no, off, hide, hidden, none.
The single attributenodetails
is an alternative.
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.[[File(mydoc.pdf, details="off")]]
or[[File(mydoc.pdf, nodetails)]]
to link a file and NOT display file metadata.
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
[[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.
[[Footnote(args)]]
Add a footnote, or explicitly display collected footnotes when no args (footnote text) are given.
[[Groupevent(args)]]
Examples:
[[Groupevent(number=3)]]
- Displays the next three group events[[Groupevent(title=Group Events, number=2)]]
- Adds title above event list. Displays 2 events.[[Groupevent(id=123)]]
- Displays single group event with ID # 123
[[Helloworld(args)]]
Outputs "Hello world"
[[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
orbottom
are 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.nolink
means without link to image source (deprecated, uselink=
)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, desc="My caption here")]]
# caption text[[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
[[Link(args)]]
Embed a link.
Examples:
[[Link(/SomePage SomePage)]]
[[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.
[[Main(args)]]
Displays a message containing links to articles with further details on a topic. Accepts a list of comma-separated page names.
[[Page(args)]]
This macro will insert a linked title to a wiki page. It can be passed either an ID or alias.
[[Pagename(args)]]
Accepts either 'alias' or 'title' as arg. Returns either the alias (default if no args given) or title of the current page.
[[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)]]
[[Randompage(args)]]
Generates a link to a random page.
[[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
[[Redirect(args)]]
Redirects to a URL with an optional delay (in seconds).
Examples:
[[Redirect(https://google.com)]]
[[Redirect(https://google.com, 5)]]
- Wait 5 seconds before redirecting.
[[Resources(args)]]
This macro will insert a linked title to a resource. It can be passed either an ID or alias.
[[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)]]
[[Span(args)]]
Wraps text or other elements inside a
<span>
tag.[[Tableofcontents(args)]]
Outputs a Table of Contents based off the page headers
[[Tag(args)]]
This macro will generate a link to a Tag.
[[Timestamp(args)]]
Displays a time-stamp in the following format: YYYY-MM-DD HH:MM:SS
[[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)]]
[[Twitter(args)]]
Embeds a Twitter Feed into the page. Can be a user feed(@hubzero) or a Twitter widget ID(see below), followed by a comma(,) and then the number of tweets to display.
A Twitter widget may be set up by going to Twitter's widget configuration page. After setting a widget up, the widget ID can be found as an 18 digit number in the URL of the settings, or within the HTML in the text box labeled "Copy and paste the code into the HTML of your site" as the item data-widget-id="####".
Examples:
[[Twitter(@hubzeroplatform,2)]]
Displays:
[[Unreferenced(args)]]
Displays a notice that a section is unreferenced. Accepts a date as the only argument.
[[Video(args)]]
Embeds a video into the Page. Accepts either full video URL (YouTube, Vimeo, Kaltura, Blip TV) or a file name or path.
Youtube URL: https://www.youtube.com/watch?v=FgfGOEpZEOw
Examples:
[[Video(MyVideo.m4v)]]
[[Video(https://www.youtube.com/watch?v=FgfGOEpZEOw)]]
[[Video(https://blip.tv/play/hNNNg4uIDAI.x?p=1)]]
[[Video(https://player.vimeo.com/video/67115692)]]
Size attributes may be given as single numeric values or with units (%, em, px). When an attribute name is given (e.g., width=600, height=338), order does not matter. Attribute values may be quoted but are not required to be. When a name attribute is not give (e.g., 600, 338), the first value will be set as width and the second value as height.
Examples:
[[Video(MyVideo.m4v, width="600", height="338")]]
[[Video(https://www.youtube.com/watch?v=FgfGOEpZEOw, width=600px, height=338px)]]
[[Video(https://blip.tv/play/hNNNg4uIDAI.x?p=1, 640, 380)]]
- width 640px, height 380px[[Video(https://player.vimeo.com/video/67115692, 100%)]]
- width of 100%
[[Youtube(args)]]
Embeds a Youtube Video into the Page. Accepts either full Youtube video URL or just Youtube Video ID (highlighted below).
Youtube URL: https://www.youtube.com/watch?v=FgfGOEpZEOw
Examples:
[[Youtube(FgfGOEpZEOw)]]
[[Youtube(https://www.youtube.com/watch?v=FgfGOEpZEOw)]]
[[Youtube(FgfGOEpZEOw, 640, 380)]] - width 640px, height 380px
[[Youtube(FgfGOEpZEOw, 100%)]] - width of 100%
Displays: