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
33 @Component( role = Macro.class, hint = "ssi" )
34 public class SsiMacro
35 extends AbstractMacro
36 {
37 private static final String PARAM_FUNCTION = "function";
38
39 private boolean isInternalParameter( String name )
40 {
41 return PARAM_FUNCTION.equals( name ) || MacroRequest.isInternalParameter( name );
42 }
43
44 public void execute( Sink sink, MacroRequest request )
45 throws MacroExecutionException
46 {
47 String function = (String) request.getParameter( PARAM_FUNCTION );
48
49 required( PARAM_FUNCTION, function );
50
51 StringBuilder buff = new StringBuilder();
52 buff.append( '#' );
53 buff.append( function );
54
55 for ( Map.Entry<String, Object> entry : request.getParameters().entrySet() )
56 {
57 if ( !isInternalParameter( entry.getKey() ) )
58 {
59 buff.append( ' ' );
60 buff.append( entry.getKey() );
61 buff.append( "=\"" );
62 buff.append( entry.getValue() );
63 buff.append( '"' );
64 }
65 }
66
67 buff.append( ' ' );
68 sink.comment( buff.toString() );
69 }
70 }