DoxiaMacros

HomePage | RecentChanges | Preferences

Guide to Doxia Macros

The Doxia Core module includes the Echo and Snippet macros, and you can create your own.

Macros are Plexus components with a role of org.apache.macro.doxia.macro.Macro. The role-hint is the macro name.

For example:

 /**
  * @plexus.component role="org.apache.maven.doxia.macro.Macro"
  * role-hint="echo"
  */
 public class EchoMacro extends AbstractMacro
 {
    public void execute( Sink sink, MacroRequest request ) { ... }
 }

is called with

  %{echo|param=value|param2=value2}

and will output

   param ---> value
   param2 ---> value2

(The echo macro simply prints out the key and value of any parameters that you supply.)

Note that macros must not be indented in your apt source document.

The following plugin config can be used to generate the Plexus component.xml file for the module containing your macro:

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

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited January 1, 2007 9:22 am by WendySmoak (diff)
Search: