1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.wikimodel.xhtml; |
21 |
|
|
22 |
|
import org.xwiki.rendering.wikimodel.IWikiPrinter; |
23 |
|
import org.xwiki.rendering.wikimodel.PrintTextListener; |
24 |
|
import org.xwiki.rendering.wikimodel.ReferenceHandler; |
25 |
|
import org.xwiki.rendering.wikimodel.WikiFormat; |
26 |
|
import org.xwiki.rendering.wikimodel.WikiPageUtil; |
27 |
|
import org.xwiki.rendering.wikimodel.WikiParameters; |
28 |
|
import org.xwiki.rendering.wikimodel.util.WikiEntityUtil; |
29 |
|
|
30 |
|
|
31 |
|
@version |
32 |
|
@since |
33 |
|
|
|
|
| 90.5% |
Uncovered Elements: 6 (63) |
Complexity: 23 |
Complexity Density: 0.7 |
|
34 |
|
public class PrintInlineListener extends PrintTextListener |
35 |
|
{ |
36 |
|
|
37 |
|
|
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
4
|
public PrintInlineListener(IWikiPrinter printer)... |
40 |
|
{ |
41 |
4
|
super(printer); |
42 |
|
} |
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
44 |
1402
|
public PrintInlineListener(IWikiPrinter printer, boolean supportImage, boolean supportDownload)... |
45 |
|
{ |
46 |
1402
|
super(printer, supportImage, supportDownload); |
47 |
|
} |
48 |
|
|
49 |
|
|
50 |
|
@see |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
52 |
2192
|
@Override... |
53 |
|
public void beginFormat(WikiFormat format) |
54 |
|
{ |
55 |
2192
|
print(format.getTags(true)); |
56 |
2192
|
if (format.getParams().size() > 0) { |
57 |
25
|
print("<span class='wikimodel-parameters'" + format.getParams() + ">"); |
58 |
|
} |
59 |
|
} |
60 |
|
|
61 |
|
|
62 |
|
@see |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
4
|
@Override... |
65 |
|
public void beginPropertyInline(String str) |
66 |
|
{ |
67 |
4
|
print("<span class='wikimodel-property' url='" |
68 |
|
+ WikiPageUtil.escapeXmlAttribute(str) |
69 |
|
+ "'>"); |
70 |
|
} |
71 |
|
|
72 |
|
|
73 |
|
@see |
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
75 |
2192
|
@Override... |
76 |
|
public void endFormat(WikiFormat format) |
77 |
|
{ |
78 |
2192
|
if (format.getParams().size() > 0) { |
79 |
25
|
print("</span>"); |
80 |
|
} |
81 |
2192
|
print(format.getTags(false)); |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
@see |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
4
|
@Override... |
88 |
|
public void endPropertyInline(String inlineProperty) |
89 |
|
{ |
90 |
4
|
print("</span>"); |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@param |
101 |
|
@return |
102 |
|
|
|
|
| 68.4% |
Uncovered Elements: 6 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
103 |
692
|
protected String getSymbolEntity(String str)... |
104 |
|
{ |
105 |
692
|
String entity = null; |
106 |
692
|
if (isHtmlEntities()) { |
107 |
692
|
entity = WikiEntityUtil.getHtmlSymbol(str); |
108 |
|
} else { |
109 |
0
|
int code = WikiEntityUtil.getHtmlCodeByWikiSymbol(str); |
110 |
0
|
if (code > 0) { |
111 |
0
|
entity = "#" + Integer.toString(code); |
112 |
|
} |
113 |
|
} |
114 |
692
|
if (entity != null) { |
115 |
61
|
entity = "&" + entity + ";"; |
116 |
61
|
if (str.startsWith(" --")) { |
117 |
2
|
entity = " " + entity + " "; |
118 |
|
} |
119 |
|
} |
120 |
692
|
return entity; |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
@return |
130 |
|
|
131 |
|
|
132 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
692
|
protected boolean isHtmlEntities()... |
134 |
|
{ |
135 |
692
|
return true; |
136 |
|
} |
137 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
138 |
1406
|
@Override... |
139 |
|
protected ReferenceHandler newReferenceHandler() |
140 |
|
{ |
141 |
1406
|
return new ReferenceHandler(isSupportImage(), isSupportDownload()) |
142 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
143 |
1
|
@Override... |
144 |
|
protected void handleImage( |
145 |
|
String ref, |
146 |
|
String label, |
147 |
|
WikiParameters params) |
148 |
|
{ |
149 |
1
|
print("<img src='" |
150 |
|
+ WikiPageUtil.escapeXmlAttribute(ref) |
151 |
|
+ "'" |
152 |
|
+ params |
153 |
|
+ "/>"); |
154 |
|
} |
155 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
156 |
136
|
@Override... |
157 |
|
protected void handleReference( |
158 |
|
String ref, |
159 |
|
String label, |
160 |
|
WikiParameters params) |
161 |
|
{ |
162 |
136
|
print("<a href='" |
163 |
|
+ WikiPageUtil.escapeXmlAttribute(ref) |
164 |
|
+ "'" |
165 |
|
+ params |
166 |
|
+ ">" |
167 |
|
+ WikiPageUtil.escapeXmlString(label) |
168 |
|
+ "</a>"); |
169 |
|
} |
170 |
|
}; |
171 |
|
} |
172 |
|
|
173 |
|
|
174 |
|
@see |
175 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
176 |
28
|
@Override... |
177 |
|
public void onEscape(String str) |
178 |
|
{ |
179 |
28
|
print("<span class='wikimodel-escaped'>" |
180 |
|
+ WikiPageUtil.escapeXmlString(str) |
181 |
|
+ "</span>"); |
182 |
|
} |
183 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
184 |
6
|
@Override... |
185 |
|
public void onExtensionInline(String extensionName, WikiParameters params) |
186 |
|
{ |
187 |
6
|
print("<span class='wikimodel-extension' extension='" |
188 |
|
+ extensionName |
189 |
|
+ "'" |
190 |
|
+ params |
191 |
|
+ "/>"); |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
@see |
196 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
197 |
9
|
@Override... |
198 |
|
public void onLineBreak() |
199 |
|
{ |
200 |
9
|
print("<br />"); |
201 |
|
} |
202 |
|
|
203 |
|
|
204 |
|
@see |
205 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
206 |
692
|
@Override... |
207 |
|
public void onSpecialSymbol(String str) |
208 |
|
{ |
209 |
692
|
String entity = getSymbolEntity(str); |
210 |
692
|
if (entity == null) { |
211 |
631
|
entity = WikiPageUtil.escapeXmlString(str); |
212 |
|
} |
213 |
692
|
print(entity); |
214 |
|
} |
215 |
|
|
216 |
|
|
217 |
|
@see |
218 |
|
|
219 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
220 |
61
|
@Override... |
221 |
|
public void onVerbatimInline(String str, WikiParameters params) |
222 |
|
{ |
223 |
61
|
print("<tt class=\"wikimodel-verbatim\"" |
224 |
|
+ params |
225 |
|
+ ">" |
226 |
|
+ WikiPageUtil.escapeXmlString(str) |
227 |
|
+ "</tt>"); |
228 |
|
} |
229 |
|
} |