1 package org.apache.maven.doxia.macro;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Map;
23 import org.apache.maven.doxia.sink.Sink;
24 import org.codehaus.plexus.component.annotations.Component;
25
26
27
28
29
30
31
32 @Component( role = Macro.class, hint = "ssi" )
33 public class SsiMacro
34 extends AbstractMacro
35 {
36 private static final String PARAM_FUNCTION = "function";
37
38 private boolean isInternalParameter( String name )
39 {
40 return PARAM_FUNCTION.equals( name ) || MacroRequest.isInternalParameter( name );
41 }
42
43 public void execute( Sink sink, MacroRequest request )
44 throws MacroExecutionException
45 {
46 String function = (String) request.getParameter( PARAM_FUNCTION );
47
48 required( PARAM_FUNCTION, function );
49
50 StringBuilder buff = new StringBuilder();
51 buff.append( '#' );
52 buff.append( function );
53
54 for ( Map.Entry<String, Object> entry : request.getParameters().entrySet() )
55 {
56 if ( !isInternalParameter( entry.getKey() ) )
57 {
58 buff.append( ' ' );
59 buff.append( entry.getKey() );
60 buff.append( "=\"" );
61 buff.append( entry.getValue() );
62 buff.append( '"' );
63 }
64 }
65
66 buff.append( ' ' );
67 sink.comment( buff.toString() );
68 }
69 }