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