1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.xdomxml10.internal.parser; |
21 |
|
|
22 |
|
import java.util.HashSet; |
23 |
|
import java.util.Set; |
24 |
|
|
25 |
|
import javax.inject.Named; |
26 |
|
|
27 |
|
import org.xml.sax.Attributes; |
28 |
|
import org.xml.sax.SAXException; |
29 |
|
import org.xwiki.component.annotation.Component; |
30 |
|
import org.xwiki.component.annotation.InstantiationStrategy; |
31 |
|
import org.xwiki.component.descriptor.ComponentInstantiationStrategy; |
32 |
|
import org.xwiki.rendering.xdomxml10.internal.parser.parameter.ResourceReferenceParser; |
33 |
|
|
34 |
|
@Component |
35 |
|
@Named("image") |
36 |
|
@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) |
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 5 |
Complexity Density: 0.83 |
|
37 |
|
public class ImageBlockParser extends DefaultBlockParser |
38 |
|
{ |
39 |
|
private static final Set<String> NAMES = new HashSet<String>() |
40 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
41 |
0 |
{... |
42 |
0 |
add("freestanding"); |
43 |
|
} |
44 |
|
}; |
45 |
|
|
46 |
|
private ResourceReferenceParser referenceParser = new ResourceReferenceParser(); |
47 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
0 |
public ImageBlockParser()... |
49 |
|
{ |
50 |
0 |
super(NAMES); |
51 |
|
} |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
53 |
0 |
@Override... |
54 |
|
protected void startElementInternal(String uri, String localName, String qName, Attributes attributes) |
55 |
|
throws SAXException |
56 |
|
{ |
57 |
0 |
if (qName.equals("reference")) { |
58 |
0 |
setCurrentHandler(this.referenceParser); |
59 |
|
} else { |
60 |
0 |
super.startElementInternal(uri, localName, qName, attributes); |
61 |
|
} |
62 |
|
} |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
0 |
@Override... |
65 |
|
protected void beginBlock() throws SAXException |
66 |
|
{ |
67 |
0 |
getListener().onImage(this.referenceParser.getValue(), |
68 |
|
getParameterAsBoolean("freestanding", false), getCustomParameters()); |
69 |
|
} |
70 |
|
} |