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.renderer.doxia; |
21 |
|
|
22 |
|
import java.util.Map; |
23 |
|
|
24 |
|
import org.apache.maven.doxia.sink.Sink; |
25 |
|
import org.xwiki.rendering.listener.Format; |
26 |
|
import org.xwiki.rendering.listener.HeaderLevel; |
27 |
|
import org.xwiki.rendering.listener.ListType; |
28 |
|
import org.xwiki.rendering.listener.Listener; |
29 |
|
import org.xwiki.rendering.listener.MetaData; |
30 |
|
import org.xwiki.rendering.listener.reference.ResourceReference; |
31 |
|
import org.xwiki.rendering.syntax.Syntax; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 59.1% |
Uncovered Elements: 56 (137) |
Complexity: 65 |
Complexity Density: 0.87 |
|
39 |
|
public class DoxiaSinkListener implements Listener |
40 |
|
{ |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
private Sink sink; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
private HeaderLevel headerLevel; |
52 |
|
|
53 |
|
|
54 |
|
@param |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
56 |
21 |
public DoxiaSinkListener(Sink sink)... |
57 |
|
{ |
58 |
21 |
this.sink = sink; |
59 |
|
} |
60 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
61 |
21 |
@Override... |
62 |
|
public void beginDocument(MetaData metadata) |
63 |
|
{ |
64 |
21 |
this.sink.head(); |
65 |
21 |
this.sink.head_(); |
66 |
21 |
this.sink.body(); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
69 |
21 |
@Override... |
70 |
|
public void endDocument(MetaData metadata) |
71 |
|
{ |
72 |
21 |
this.sink.body_(); |
73 |
|
} |
74 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
75 |
0 |
@Override... |
76 |
|
public void beginGroup(Map<String, String> parameters) |
77 |
|
{ |
78 |
|
|
79 |
|
} |
80 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
81 |
0 |
@Override... |
82 |
|
public void endGroup(Map<String, String> parameters) |
83 |
|
{ |
84 |
|
|
85 |
|
} |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
87 |
2 |
@Override... |
88 |
|
public void onVerbatim(String content, boolean inline, Map<String, String> parameters) |
89 |
|
{ |
90 |
|
|
91 |
2 |
this.sink.verbatim(null); |
92 |
2 |
this.sink.text(content); |
93 |
2 |
this.sink.verbatim_(); |
94 |
|
} |
95 |
|
|
|
|
| 58.3% |
Uncovered Elements: 5 (12) |
Complexity: 5 |
Complexity Density: 0.42 |
|
96 |
10 |
@Override... |
97 |
|
public void beginFormat(Format format, Map<String, String> parameters) |
98 |
|
{ |
99 |
|
|
100 |
10 |
switch (format) { |
101 |
6 |
case BOLD: |
102 |
6 |
this.sink.bold(); |
103 |
6 |
break; |
104 |
4 |
case ITALIC: |
105 |
4 |
this.sink.italic(); |
106 |
4 |
break; |
107 |
0 |
case STRIKEDOUT: |
108 |
|
|
109 |
|
|
110 |
0 |
break; |
111 |
0 |
case UNDERLINED: |
112 |
|
|
113 |
|
|
114 |
0 |
break; |
115 |
0 |
default: |
116 |
|
|
117 |
|
} |
118 |
|
} |
119 |
|
|
|
|
| 58.3% |
Uncovered Elements: 5 (12) |
Complexity: 5 |
Complexity Density: 0.42 |
|
120 |
10 |
@Override... |
121 |
|
public void endFormat(Format format, Map<String, String> parameters) |
122 |
|
{ |
123 |
|
|
124 |
10 |
switch (format) { |
125 |
6 |
case BOLD: |
126 |
6 |
this.sink.bold_(); |
127 |
6 |
break; |
128 |
4 |
case ITALIC: |
129 |
4 |
this.sink.italic_(); |
130 |
4 |
break; |
131 |
0 |
case STRIKEDOUT: |
132 |
|
|
133 |
|
|
134 |
0 |
break; |
135 |
0 |
case UNDERLINED: |
136 |
|
|
137 |
|
|
138 |
0 |
break; |
139 |
0 |
default: |
140 |
|
|
141 |
|
} |
142 |
|
} |
143 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
144 |
10 |
@Override... |
145 |
|
public void beginList(ListType type, Map<String, String> parameters) |
146 |
|
{ |
147 |
10 |
if (type == ListType.BULLETED) { |
148 |
10 |
this.sink.list(); |
149 |
|
} else { |
150 |
|
|
151 |
0 |
this.sink.numberedList(Sink.NUMBERING_DECIMAL); |
152 |
|
} |
153 |
|
} |
154 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
155 |
18 |
@Override... |
156 |
|
public void beginListItem() |
157 |
|
{ |
158 |
18 |
this.sink.listItem(); |
159 |
|
} |
160 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
161 |
0 |
@Override... |
162 |
|
public void beginMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline) |
163 |
|
{ |
164 |
|
|
165 |
|
|
166 |
|
} |
167 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
18 |
@Override... |
169 |
|
public void beginParagraph(Map<String, String> parameters) |
170 |
|
{ |
171 |
18 |
this.sink.paragraph(); |
172 |
|
} |
173 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
174 |
12 |
@Override... |
175 |
|
public void beginSection(Map<String, String> parameters) |
176 |
|
{ |
177 |
|
|
178 |
|
} |
179 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
180 |
12 |
@Override... |
181 |
|
public void beginHeader(HeaderLevel level, String id, Map<String, String> parameters) |
182 |
|
{ |
183 |
|
|
184 |
12 |
int levelAsInt = (level.getAsInt() < 6) ? level.getAsInt() : 5; |
185 |
12 |
this.sink.section(levelAsInt, null); |
186 |
12 |
this.sink.sectionTitle(levelAsInt, null); |
187 |
|
|
188 |
|
|
189 |
12 |
this.headerLevel = level; |
190 |
|
} |
191 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
192 |
10 |
@Override... |
193 |
|
public void endList(ListType type, Map<String, String> parameters) |
194 |
|
{ |
195 |
10 |
if (type == ListType.BULLETED) { |
196 |
10 |
this.sink.list_(); |
197 |
|
} else { |
198 |
0 |
this.sink.numberedList_(); |
199 |
|
} |
200 |
|
} |
201 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
202 |
18 |
@Override... |
203 |
|
public void endListItem() |
204 |
|
{ |
205 |
18 |
this.sink.listItem_(); |
206 |
|
} |
207 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
208 |
0 |
@Override... |
209 |
|
public void endMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline) |
210 |
|
{ |
211 |
|
|
212 |
|
|
213 |
|
} |
214 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
215 |
18 |
@Override... |
216 |
|
public void endParagraph(Map<String, String> parameters) |
217 |
|
{ |
218 |
18 |
this.sink.paragraph_(); |
219 |
|
} |
220 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
221 |
12 |
@Override... |
222 |
|
public void endSection(Map<String, String> parameters) |
223 |
|
{ |
224 |
|
|
225 |
12 |
int levelAsInt = (this.headerLevel.getAsInt() < 6) ? this.headerLevel.getAsInt() : 5; |
226 |
12 |
this.sink.section_(levelAsInt); |
227 |
|
} |
228 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
229 |
12 |
@Override... |
230 |
|
public void endHeader(HeaderLevel level, String id, Map<String, String> parameters) |
231 |
|
{ |
232 |
|
|
233 |
12 |
int levelAsInt = (level.getAsInt() < 6) ? level.getAsInt() : 5; |
234 |
12 |
this.sink.sectionTitle_(levelAsInt); |
235 |
|
} |
236 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
237 |
0 |
@Override... |
238 |
|
public void onMacro(String id, Map<String, String> parameters, String content, boolean inline) |
239 |
|
{ |
240 |
|
|
241 |
|
|
242 |
|
} |
243 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
244 |
0 |
@Override... |
245 |
|
public void onNewLine() |
246 |
|
{ |
247 |
|
|
248 |
|
|
249 |
|
|
250 |
0 |
this.sink.text("\n"); |
251 |
|
} |
252 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
253 |
74 |
@Override... |
254 |
|
public void onSpace() |
255 |
|
{ |
256 |
|
|
257 |
74 |
this.sink.text(" "); |
258 |
|
} |
259 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
260 |
0 |
@Override... |
261 |
|
public void onSpecialSymbol(char symbol) |
262 |
|
{ |
263 |
|
|
264 |
0 |
this.sink.text("" + symbol); |
265 |
|
} |
266 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
267 |
130 |
@Override... |
268 |
|
public void onWord(String word) |
269 |
|
{ |
270 |
130 |
this.sink.text(word); |
271 |
|
} |
272 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
273 |
0 |
@Override... |
274 |
|
public void onId(String name) |
275 |
|
{ |
276 |
|
|
277 |
|
} |
278 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
279 |
0 |
@Override... |
280 |
|
public void onRawText(String text, Syntax syntax) |
281 |
|
{ |
282 |
|
|
283 |
|
|
284 |
|
|
285 |
0 |
this.sink.rawText(text); |
286 |
|
} |
287 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
288 |
0 |
@Override... |
289 |
|
public void onHorizontalLine(Map<String, String> parameters) |
290 |
|
{ |
291 |
|
|
292 |
0 |
this.sink.horizontalRule(); |
293 |
|
} |
294 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
295 |
0 |
@Override... |
296 |
|
public void onEmptyLines(int count) |
297 |
|
{ |
298 |
|
|
299 |
|
} |
300 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
301 |
0 |
@Override... |
302 |
|
public void beginDefinitionList(Map<String, String> parameters) |
303 |
|
{ |
304 |
|
|
305 |
0 |
this.sink.definitionList(); |
306 |
|
} |
307 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
308 |
0 |
@Override... |
309 |
|
public void endDefinitionList(Map<String, String> parameters) |
310 |
|
{ |
311 |
|
|
312 |
0 |
this.sink.definitionList_(); |
313 |
|
} |
314 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
315 |
0 |
@Override... |
316 |
|
public void beginDefinitionTerm() |
317 |
|
{ |
318 |
0 |
this.sink.definedTerm(); |
319 |
|
} |
320 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
321 |
0 |
@Override... |
322 |
|
public void beginDefinitionDescription() |
323 |
|
{ |
324 |
0 |
this.sink.definition(); |
325 |
|
} |
326 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
327 |
0 |
@Override... |
328 |
|
public void endDefinitionTerm() |
329 |
|
{ |
330 |
0 |
this.sink.definedTerm_(); |
331 |
|
} |
332 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
333 |
0 |
@Override... |
334 |
|
public void endDefinitionDescription() |
335 |
|
{ |
336 |
0 |
this.sink.definition_(); |
337 |
|
} |
338 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
339 |
0 |
@Override... |
340 |
|
public void beginQuotation(Map<String, String> parameters) |
341 |
|
{ |
342 |
|
|
343 |
|
} |
344 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
345 |
0 |
@Override... |
346 |
|
public void endQuotation(Map<String, String> parameters) |
347 |
|
{ |
348 |
|
|
349 |
|
} |
350 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
351 |
0 |
@Override... |
352 |
|
public void beginQuotationLine() |
353 |
|
{ |
354 |
|
|
355 |
|
} |
356 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
357 |
0 |
@Override... |
358 |
|
public void endQuotationLine() |
359 |
|
{ |
360 |
|
|
361 |
|
} |
362 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
363 |
3 |
@Override... |
364 |
|
public void beginTable(Map<String, String> parameters) |
365 |
|
{ |
366 |
3 |
this.sink.table(); |
367 |
|
} |
368 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
369 |
12 |
@Override... |
370 |
|
public void beginTableCell(Map<String, String> parameters) |
371 |
|
{ |
372 |
12 |
this.sink.tableCell(); |
373 |
|
} |
374 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
375 |
6 |
@Override... |
376 |
|
public void beginTableHeadCell(Map<String, String> parameters) |
377 |
|
{ |
378 |
6 |
this.sink.tableHeaderCell(); |
379 |
|
} |
380 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
381 |
9 |
@Override... |
382 |
|
public void beginTableRow(Map<String, String> parameters) |
383 |
|
{ |
384 |
9 |
this.sink.tableRow(); |
385 |
|
} |
386 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
387 |
3 |
@Override... |
388 |
|
public void endTable(Map<String, String> parameters) |
389 |
|
{ |
390 |
3 |
this.sink.table_(); |
391 |
|
} |
392 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
393 |
12 |
@Override... |
394 |
|
public void endTableCell(Map<String, String> parameters) |
395 |
|
{ |
396 |
12 |
this.sink.tableCell_(); |
397 |
|
} |
398 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
399 |
6 |
@Override... |
400 |
|
public void endTableHeadCell(Map<String, String> parameters) |
401 |
|
{ |
402 |
6 |
this.sink.tableHeaderCell_(); |
403 |
|
} |
404 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
405 |
9 |
@Override... |
406 |
|
public void endTableRow(Map<String, String> parameters) |
407 |
|
{ |
408 |
9 |
this.sink.tableRow_(); |
409 |
|
} |
410 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
411 |
0 |
@Override... |
412 |
|
public void beginLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) |
413 |
|
{ |
414 |
0 |
this.sink.link(reference.getReference()); |
415 |
|
} |
416 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
417 |
0 |
@Override... |
418 |
|
public void endLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) |
419 |
|
{ |
420 |
0 |
this.sink.link_(); |
421 |
|
} |
422 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
423 |
0 |
@Override... |
424 |
|
public void onImage(ResourceReference reference, boolean freestanding, Map<String, String> parameters) |
425 |
|
{ |
426 |
0 |
this.sink.figure(); |
427 |
|
|
428 |
|
|
429 |
|
|
430 |
0 |
this.sink.figureGraphics(reference.getReference()); |
431 |
0 |
this.sink.figure_(); |
432 |
|
} |
433 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
434 |
0 |
@Override... |
435 |
|
public void beginMetaData(MetaData metadata) |
436 |
|
{ |
437 |
|
|
438 |
|
} |
439 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
440 |
0 |
@Override... |
441 |
|
public void endMetaData(MetaData metadata) |
442 |
|
{ |
443 |
|
|
444 |
|
} |
445 |
|
} |