Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Dashboard
Maven User
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h1>Guide to Doxia Macros</h1> <table class="wysiwyg-macro" data-macro-name="warning" data-macro-parameters="title=Out of Date" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e3dhcm5pbmc6dGl0bGU9T3V0IG9mIERhdGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"> <p>This page is out-of-date. Please see the <a href="http://maven.apache.org/doxia/macros/">Doxia Macros Guide</a>.</p></td></tr></table> <p>The Doxia Core module includes the Echo and Snippet macros, and you can create your own.</p> <p>Macros are Plexus components with a role of org.apache.macro.doxia.macro.Macro.</p> <p>The role-hint is the macro name.</p> <p>For example:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> /** * @plexus.component role="org.apache.maven.doxia.macro.Macro" * role-hint="echo" */ public class EchoMacro extends AbstractMacro { public void execute( Sink sink, MacroRequest request ) { ... } } </pre></td></tr></table> <p>is called with</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> %{echo|param=value|param2=value2} </pre></td></tr></table> <p>and will output</p> <table class="wysiwyg-macro" data-macro-name="noformat" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e25vZm9ybWF0fQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> param ---> value param2 ---> value2 </pre></td></tr></table> <p>(The echo macro simply prints out the key and value of any parameters that you supply.)</p> <p>Note that macros <strong>must</strong> <strong>not</strong> be indented in your apt source document.</p> <p>In the execute method, <a class="confluence-link unresolved" data-content-title="TODO" data-linked-resource-default-alias="TODO" href="#">TODO</a></p> <p>The following plugin config can be used to generate the Plexus component.xml file for the module containing your macro:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <build> ... <plugins> <plugin> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-maven-plugin</artifactId> <executions> <execution> <goals> <goal>descriptor</goal> </goals> </execution> </executions> </plugin> ... </plugins> ... </build> </pre></td></tr></table> <h1>Using Doxia Macros by samples</h1> <h2>Snippet</h2> <p>For instance, in apt file:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> %{snippet|id=superpom|url=http://svn.apache.org/repos/asf/maven/components/trunk/maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml} </pre></td></tr></table> <p>And in xdoc file:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <macro name="snippet" id="superpom" url="http://svn.apache.org/repos/asf/maven/components/trunk/maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml"/> </pre></td></tr></table> <h2>Table Of Content (toc)</h2> <p>For instance, in APT file:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> %{toc|section=2|fromDepth=1|toDepth=2} </pre></td></tr></table> <p>And in Xdoc file:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <macro name="toc" section="1" fromDepth="1" toDepth="2"/> </pre></td></tr></table> <p>From Javadoc:</p> <table class="confluenceTable"><tbody> <tr> <td class="confluenceTd"><p> section </p></td> <td class="confluenceTd"><p> Display the specificated section number or all sections if 0 (in this case, other paramaters are ignored). <br class="atl-forced-newline" /> Positive int, not mandatory, 0 by default. </p></td> </tr> <tr> <td class="confluenceTd"><p> fromDepth </p></td> <td class="confluenceTd"><p> Display the depth starting for the given section number. <br class="atl-forced-newline" /> Positive int, not mandatory, 0 by default. </p></td> </tr> <tr> <td class="confluenceTd"><p> toDepth </p></td> <td class="confluenceTd"><p> Display the depth ending for the given section number. <br class="atl-forced-newline" /> Positive int, not mandatory, 5 by default. </p></td> </tr> </tbody></table>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced