1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.internal.macro.container; |
21 |
|
|
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
import javax.inject.Inject; |
25 |
|
import javax.inject.Named; |
26 |
|
import javax.inject.Singleton; |
27 |
|
|
28 |
|
import org.xwiki.component.annotation.Component; |
29 |
|
import org.xwiki.rendering.block.Block; |
30 |
|
import org.xwiki.rendering.macro.MacroContentParser; |
31 |
|
import org.xwiki.rendering.macro.MacroExecutionException; |
32 |
|
import org.xwiki.rendering.macro.container.AbstractContainerMacro; |
33 |
|
import org.xwiki.rendering.macro.container.ContainerMacroParameters; |
34 |
|
import org.xwiki.rendering.macro.descriptor.DefaultContentDescriptor; |
35 |
|
import org.xwiki.rendering.transformation.MacroTransformationContext; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@version |
43 |
|
@since |
44 |
|
|
45 |
|
@Component |
46 |
|
@Named(ContainerMacro.MACRO_NAME) |
47 |
|
@Singleton |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 1 |
|
48 |
|
public class ContainerMacro extends AbstractContainerMacro<ContainerMacroParameters> |
49 |
|
{ |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
public static final String MACRO_NAME = "container"; |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
private static final String DESCRIPTION = "A macro to enclose multiple groups and add decoration, such as layout."; |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
private static final String CONTENT_DESCRIPTION = |
64 |
|
"The content to enclose in this container (wiki syntax). " |
65 |
|
+ "For the \"columns\" layout, a group should be added for each column."; |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
@Inject |
71 |
|
private MacroContentParser contentParser; |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
0 |
public ContainerMacro()... |
77 |
|
{ |
78 |
0 |
super("Container", DESCRIPTION, new DefaultContentDescriptor(CONTENT_DESCRIPTION, false), |
79 |
|
ContainerMacroParameters.class); |
80 |
|
} |
81 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
0 |
@Override... |
83 |
|
protected List<Block> getContent(ContainerMacroParameters parameters, String content, |
84 |
|
MacroTransformationContext context) throws MacroExecutionException |
85 |
|
{ |
86 |
0 |
return this.contentParser.parse(content, context, false, false).getChildren(); |
87 |
|
} |
88 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
0 |
@Override... |
90 |
|
public int getPriority() |
91 |
|
{ |
92 |
0 |
return 750; |
93 |
|
} |
94 |
|
} |