These macros recreate the amazon linking functionality from Chat11
|
For the Codegeist 2007 contest I wrote an Amazon Web Services Plugin. |
First we'll show the simplest versions of the macros, later we'll show more advanced usage of the macro system to add more features. These macros are User Macros, and are available for system administrators to install in their wiki.
Documentation about macros:
- http://confluence.atlassian.com/display/DOC/User+Macros

- Wiki markup in macros: http://jira.atlassian.com/browse/CONF-3887

- Velocity macro documentation: http://confluence.atlassian.com/display/DOC/Velocity+Template+Overview

Basic Link To A Book On Amazon.com
This macro recreates the isbnlink functionality from Chat11
This macro makes a basic link to a book on Amazon.com
- Go to Administration > User Macros > Create User Macro
- Macro name: amazon
- Uncheck Macro has a body
- Output: Macro generates HTML markup
- Template:
<a href="http://www.amazon.com/exec/obidos/ASIN/$param0/webmill0c32-20">$param1</a>
Usage: First parameter is the ISBN number, the second parameter is the book title.
{amazon:067232847X|Red Hat Fedora 5 Unleashed}
Which is rendered as: Red Hat Fedora 5 Unleashed
It's also possible to use named parameters.
<a href="http://www.amazon.com/exec/obidos/ASIN/$paramisbn/webmill0c32-20">$paramtitle</a>
can be used as
{amazon2:isbn=067232847X|title=Red Hat Fedora 5 Unleashed}
which renders as: Red Hat Fedora 5 Unleashed
Link Including The Book Cover
|
This html will render with a picture of the book cover. Macroname: amazonpic <table><tr><td> <a href="http://www.amazon.com/exec/obidos/ASIN/$paramisbn/webmill0c32-20" target="books"> <img src="http://images.amazon.com/images/P/$paramisbn.01.MZZZZZZZ.jpg" border="0" alt="Cover of ISBN $paramisbn"></a></td> <td width=120> <a href="http://www.amazon.com/exec/obidos/ASIN/$paramisbn/webmill0c32-20" target="books"> $paramtitle</a></td></tr></table> This wikitext: {amazonpic:isbn=067232847X|title=Red Hat Fedora 5 Unleashed}
|
Which is rendered as:
|
Another Amazon Macro
There is also an Amazon plugin included with the Confluence download. This requires you to use a java compiler to compile the macro, then include it in the file system for Confluence. This is not too difficult.
The one that came with my version of Confluence (2.4.5), was broke, and I wrote an article about how to debug and fix it: Confluence Example Plugin - Amazon Web Services Plugin
