1 | |
package org.apache.maven.doxia.module.confluence; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import java.io.PrintWriter; |
23 | |
import java.io.StringWriter; |
24 | |
import java.io.Writer; |
25 | |
import java.util.Stack; |
26 | |
|
27 | |
import javax.swing.text.html.HTML.Attribute; |
28 | |
|
29 | |
import org.apache.maven.doxia.sink.AbstractTextSink; |
30 | |
import org.apache.maven.doxia.sink.SinkEventAttributes; |
31 | |
import org.apache.maven.doxia.util.HtmlTools; |
32 | |
import org.codehaus.plexus.util.StringUtils; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
public class ConfluenceSink |
44 | |
extends AbstractTextSink |
45 | |
implements ConfluenceMarkup |
46 | |
{ |
47 | |
|
48 | |
private final PrintWriter out; |
49 | |
|
50 | |
|
51 | |
private StringWriter writer; |
52 | |
|
53 | |
|
54 | |
private boolean headFlag; |
55 | |
|
56 | 64 | private int levelList = 0; |
57 | |
|
58 | |
|
59 | |
private final Stack<String> listStyles; |
60 | |
|
61 | |
|
62 | |
private boolean verbatimBoxedFlag; |
63 | |
|
64 | |
|
65 | |
private boolean tableHeaderFlag; |
66 | |
|
67 | |
|
68 | |
private String linkName; |
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
protected ConfluenceSink( Writer writer ) |
77 | 64 | { |
78 | 64 | this.out = new PrintWriter( writer ); |
79 | 64 | this.listStyles = new Stack<String>(); |
80 | |
|
81 | 64 | init(); |
82 | 64 | } |
83 | |
|
84 | |
|
85 | |
public void anchor( String name ) |
86 | |
{ |
87 | 4 | write( ANCHOR_START_MARKUP + name + ANCHOR_END_MARKUP ); |
88 | 4 | } |
89 | |
|
90 | |
|
91 | |
public void anchor( String name, SinkEventAttributes attributes ) |
92 | |
{ |
93 | 0 | anchor( name ); |
94 | 0 | } |
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
public void anchor_() |
101 | |
{ |
102 | |
|
103 | 4 | } |
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
public void author() |
110 | |
{ |
111 | |
|
112 | 2 | } |
113 | |
|
114 | |
|
115 | |
public void author( SinkEventAttributes attributes ) |
116 | |
{ |
117 | 0 | author(); |
118 | 0 | } |
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
public void author_() |
125 | |
{ |
126 | |
|
127 | 2 | } |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
public void body() |
134 | |
{ |
135 | |
|
136 | 2 | } |
137 | |
|
138 | |
|
139 | |
public void body( SinkEventAttributes attributes ) |
140 | |
{ |
141 | 0 | body(); |
142 | 0 | } |
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
public void body_() |
149 | |
{ |
150 | |
|
151 | 2 | } |
152 | |
|
153 | |
|
154 | |
public void bold() |
155 | |
{ |
156 | 4 | write( BOLD_START_MARKUP ); |
157 | 4 | } |
158 | |
|
159 | |
|
160 | |
public void bold_() |
161 | |
{ |
162 | 4 | write( BOLD_END_MARKUP ); |
163 | 4 | } |
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
public void comment( String comment ) |
170 | |
{ |
171 | |
|
172 | 4 | } |
173 | |
|
174 | |
|
175 | |
public void close() |
176 | |
{ |
177 | 100 | out.write( writer.toString() ); |
178 | 100 | out.close(); |
179 | |
|
180 | 100 | init(); |
181 | 100 | } |
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
public void date() |
188 | |
{ |
189 | |
|
190 | 2 | } |
191 | |
|
192 | |
|
193 | |
public void date( SinkEventAttributes attributes ) |
194 | |
{ |
195 | 0 | date(); |
196 | 0 | } |
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
public void date_() |
203 | |
{ |
204 | |
|
205 | 2 | } |
206 | |
|
207 | |
|
208 | |
public void definedTerm() |
209 | |
{ |
210 | 4 | write( " " ); |
211 | 4 | } |
212 | |
|
213 | |
|
214 | |
public void definedTerm( SinkEventAttributes attributes ) |
215 | |
{ |
216 | 0 | definedTerm(); |
217 | 0 | } |
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
public void definedTerm_() |
224 | |
{ |
225 | |
|
226 | 4 | } |
227 | |
|
228 | |
|
229 | |
|
230 | |
|
231 | |
|
232 | |
public void definition() |
233 | |
{ |
234 | |
|
235 | 4 | } |
236 | |
|
237 | |
|
238 | |
|
239 | |
|
240 | |
|
241 | |
public void definition( SinkEventAttributes attributes ) |
242 | |
{ |
243 | |
|
244 | 0 | } |
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
public void definition_() |
251 | |
{ |
252 | |
|
253 | 4 | } |
254 | |
|
255 | |
|
256 | |
|
257 | |
|
258 | |
|
259 | |
public void definitionList() |
260 | |
{ |
261 | |
|
262 | 2 | } |
263 | |
|
264 | |
|
265 | |
|
266 | |
|
267 | |
|
268 | |
public void definitionList( SinkEventAttributes attributes ) |
269 | |
{ |
270 | |
|
271 | 0 | } |
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
|
277 | |
public void definitionList_() |
278 | |
{ |
279 | |
|
280 | 2 | } |
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
public void definitionListItem() |
287 | |
{ |
288 | |
|
289 | 4 | } |
290 | |
|
291 | |
|
292 | |
|
293 | |
|
294 | |
|
295 | |
public void definitionListItem( SinkEventAttributes attributes ) |
296 | |
{ |
297 | |
|
298 | 0 | } |
299 | |
|
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
public void definitionListItem_() |
305 | |
{ |
306 | |
|
307 | 4 | } |
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | |
|
313 | |
public void figure() |
314 | |
{ |
315 | |
|
316 | 4 | } |
317 | |
|
318 | |
|
319 | |
public void figure( SinkEventAttributes attributes ) |
320 | |
{ |
321 | 2 | figure(); |
322 | 2 | } |
323 | |
|
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
public void figure_() |
329 | |
{ |
330 | |
|
331 | 4 | } |
332 | |
|
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
public void figureCaption() |
338 | |
{ |
339 | |
|
340 | 4 | } |
341 | |
|
342 | |
|
343 | |
public void figureCaption( SinkEventAttributes attributes ) |
344 | |
{ |
345 | 2 | figureCaption(); |
346 | 2 | } |
347 | |
|
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
public void figureCaption_() |
353 | |
{ |
354 | |
|
355 | 4 | } |
356 | |
|
357 | |
|
358 | |
public void figureGraphics( String name ) |
359 | |
{ |
360 | 4 | writeEOL(); |
361 | 4 | write( FIGURE_START_MARKUP + name + FIGURE_END_MARKUP ); |
362 | 4 | } |
363 | |
|
364 | |
|
365 | |
public void figureGraphics( String src, SinkEventAttributes attributes ) |
366 | |
{ |
367 | 2 | figureGraphics( src ); |
368 | 2 | if ( attributes != null && attributes.getAttribute( Attribute.ALT.toString() ) != null ) |
369 | |
{ |
370 | 0 | write( attributes.getAttribute( Attribute.ALT.toString() ).toString() ); |
371 | 0 | writeEOL( true ); |
372 | |
} |
373 | 2 | } |
374 | |
|
375 | |
|
376 | |
public void flush() |
377 | |
{ |
378 | 50 | close(); |
379 | 50 | writer.flush(); |
380 | 50 | } |
381 | |
|
382 | |
|
383 | |
public void head() |
384 | |
{ |
385 | 2 | init(); |
386 | |
|
387 | 2 | headFlag = true; |
388 | 2 | } |
389 | |
|
390 | |
|
391 | |
public void head( SinkEventAttributes attributes ) |
392 | |
{ |
393 | 0 | head(); |
394 | 0 | } |
395 | |
|
396 | |
|
397 | |
public void head_() |
398 | |
{ |
399 | 2 | headFlag = false; |
400 | 2 | } |
401 | |
|
402 | |
|
403 | |
|
404 | |
|
405 | |
|
406 | |
public void horizontalRule() |
407 | |
{ |
408 | |
|
409 | 4 | } |
410 | |
|
411 | |
|
412 | |
public void horizontalRule( SinkEventAttributes attributes ) |
413 | |
{ |
414 | 0 | horizontalRule(); |
415 | 0 | } |
416 | |
|
417 | |
|
418 | |
public void italic() |
419 | |
{ |
420 | 4 | write( ITALIC_START_MARKUP ); |
421 | 4 | } |
422 | |
|
423 | |
|
424 | |
public void italic_() |
425 | |
{ |
426 | 4 | write( ITALIC_END_MARKUP ); |
427 | 4 | } |
428 | |
|
429 | |
|
430 | |
public void lineBreak() |
431 | |
{ |
432 | 36 | write( LINE_BREAK_MARKUP ); |
433 | 36 | writeEOL(); |
434 | 36 | } |
435 | |
|
436 | |
|
437 | |
public void lineBreak( SinkEventAttributes attributes ) |
438 | |
{ |
439 | 0 | lineBreak(); |
440 | 0 | } |
441 | |
|
442 | |
|
443 | |
public void link( String name ) |
444 | |
{ |
445 | 10 | linkName = name; |
446 | 10 | } |
447 | |
|
448 | |
|
449 | |
public void link( String name, SinkEventAttributes attributes ) |
450 | |
{ |
451 | 0 | link( name ); |
452 | 0 | } |
453 | |
|
454 | |
|
455 | |
public void link_() |
456 | |
{ |
457 | 10 | linkName = null; |
458 | 10 | write( LINK_END_MARKUP ); |
459 | 10 | } |
460 | |
|
461 | |
|
462 | |
public void list() |
463 | |
{ |
464 | 6 | if ( !writer.toString().endsWith( EOL + EOL ) ) |
465 | |
{ |
466 | 2 | writeEOL( true ); |
467 | |
} |
468 | |
|
469 | 6 | levelList++; |
470 | 6 | } |
471 | |
|
472 | |
|
473 | |
public void list( SinkEventAttributes attributes ) |
474 | |
{ |
475 | 0 | list(); |
476 | 0 | } |
477 | |
|
478 | |
|
479 | |
public void list_() |
480 | |
{ |
481 | 6 | levelList--; |
482 | 6 | } |
483 | |
|
484 | |
|
485 | |
public void listItem() |
486 | |
{ |
487 | 12 | write( StringUtils.repeat( "*", levelList ) + " " ); |
488 | 12 | } |
489 | |
|
490 | |
|
491 | |
public void listItem( SinkEventAttributes attributes ) |
492 | |
{ |
493 | 0 | listItem(); |
494 | 0 | } |
495 | |
|
496 | |
|
497 | |
public void listItem_() |
498 | |
{ |
499 | 12 | writeEOL( true ); |
500 | 12 | } |
501 | |
|
502 | |
|
503 | |
public void monospaced() |
504 | |
{ |
505 | 4 | write( MONOSPACED_START_MARKUP ); |
506 | 4 | } |
507 | |
|
508 | |
|
509 | |
public void monospaced_() |
510 | |
{ |
511 | 4 | write( MONOSPACED_END_MARKUP ); |
512 | 4 | } |
513 | |
|
514 | |
|
515 | |
|
516 | |
|
517 | |
|
518 | |
public void nonBreakingSpace() |
519 | |
{ |
520 | |
|
521 | 6 | } |
522 | |
|
523 | |
|
524 | |
public void numberedList( int numbering ) |
525 | |
{ |
526 | 6 | levelList++; |
527 | |
|
528 | |
String style; |
529 | 6 | switch ( numbering ) |
530 | |
{ |
531 | |
case NUMBERING_UPPER_ALPHA: |
532 | |
case NUMBERING_LOWER_ALPHA: |
533 | |
case NUMBERING_UPPER_ROMAN: |
534 | |
case NUMBERING_LOWER_ROMAN: |
535 | |
case NUMBERING_DECIMAL: |
536 | |
default: |
537 | 6 | style = NUMBERING_MARKUP; |
538 | |
} |
539 | |
|
540 | 6 | listStyles.push( style ); |
541 | 6 | } |
542 | |
|
543 | |
|
544 | |
public void numberedList( int numbering, SinkEventAttributes attributes ) |
545 | |
{ |
546 | 0 | numberedList( numbering ); |
547 | 0 | } |
548 | |
|
549 | |
|
550 | |
public void numberedList_() |
551 | |
{ |
552 | 6 | levelList--; |
553 | 6 | listStyles.pop(); |
554 | 6 | } |
555 | |
|
556 | |
|
557 | |
public void numberedListItem() |
558 | |
{ |
559 | 10 | writeEOL( true ); |
560 | 10 | String style = listStyles.peek(); |
561 | 10 | write( style + SPACE ); |
562 | 10 | } |
563 | |
|
564 | |
|
565 | |
public void numberedListItem( SinkEventAttributes attributes ) |
566 | |
{ |
567 | 0 | numberedListItem(); |
568 | 0 | } |
569 | |
|
570 | |
|
571 | |
public void numberedListItem_() |
572 | |
{ |
573 | 10 | writeEOL( true ); |
574 | 10 | } |
575 | |
|
576 | |
|
577 | |
|
578 | |
|
579 | |
|
580 | |
public void pageBreak() |
581 | |
{ |
582 | |
|
583 | 4 | } |
584 | |
|
585 | |
|
586 | |
|
587 | |
|
588 | |
|
589 | |
public void paragraph() |
590 | |
{ |
591 | |
|
592 | 30 | } |
593 | |
|
594 | |
|
595 | |
public void paragraph( SinkEventAttributes attributes ) |
596 | |
{ |
597 | 0 | paragraph(); |
598 | 0 | } |
599 | |
|
600 | |
|
601 | |
public void paragraph_() |
602 | |
{ |
603 | 30 | writeEOL( true ); |
604 | 30 | writeEOL(); |
605 | 30 | } |
606 | |
|
607 | |
|
608 | |
|
609 | |
|
610 | |
|
611 | |
public void rawText( String text ) |
612 | |
{ |
613 | |
|
614 | 2 | } |
615 | |
|
616 | |
|
617 | |
|
618 | |
|
619 | |
|
620 | |
public void section( int level, SinkEventAttributes attributes ) |
621 | |
{ |
622 | |
|
623 | 0 | } |
624 | |
|
625 | |
|
626 | |
|
627 | |
|
628 | |
|
629 | |
public void section1() |
630 | |
{ |
631 | |
|
632 | 4 | } |
633 | |
|
634 | |
|
635 | |
|
636 | |
|
637 | |
|
638 | |
public void section1_() |
639 | |
{ |
640 | |
|
641 | 4 | } |
642 | |
|
643 | |
|
644 | |
|
645 | |
|
646 | |
|
647 | |
public void section2() |
648 | |
{ |
649 | |
|
650 | 4 | } |
651 | |
|
652 | |
|
653 | |
|
654 | |
|
655 | |
|
656 | |
public void section2_() |
657 | |
{ |
658 | |
|
659 | 4 | } |
660 | |
|
661 | |
|
662 | |
|
663 | |
|
664 | |
|
665 | |
public void section3() |
666 | |
{ |
667 | |
|
668 | 4 | } |
669 | |
|
670 | |
|
671 | |
|
672 | |
|
673 | |
|
674 | |
public void section3_() |
675 | |
{ |
676 | |
|
677 | 4 | } |
678 | |
|
679 | |
|
680 | |
|
681 | |
|
682 | |
|
683 | |
public void section4() |
684 | |
{ |
685 | |
|
686 | 4 | } |
687 | |
|
688 | |
|
689 | |
|
690 | |
|
691 | |
|
692 | |
public void section4_() |
693 | |
{ |
694 | |
|
695 | 4 | } |
696 | |
|
697 | |
|
698 | |
|
699 | |
|
700 | |
|
701 | |
public void section5() |
702 | |
{ |
703 | |
|
704 | 4 | } |
705 | |
|
706 | |
|
707 | |
|
708 | |
|
709 | |
|
710 | |
public void section5_() |
711 | |
{ |
712 | |
|
713 | 4 | } |
714 | |
|
715 | |
|
716 | |
|
717 | |
|
718 | |
|
719 | |
public void section_( int level ) |
720 | |
{ |
721 | |
|
722 | 0 | } |
723 | |
|
724 | |
|
725 | |
|
726 | |
|
727 | |
|
728 | |
public void sectionTitle() |
729 | |
{ |
730 | |
|
731 | 2 | } |
732 | |
|
733 | |
|
734 | |
public void sectionTitle( int level, SinkEventAttributes attributes ) |
735 | |
{ |
736 | 20 | if ( level > 0 && level < 6 ) |
737 | |
{ |
738 | 20 | write( "h" + level + ". " ); |
739 | |
} |
740 | 20 | } |
741 | |
|
742 | |
|
743 | |
public void sectionTitle1() |
744 | |
{ |
745 | 4 | sectionTitle( 1, null ); |
746 | 4 | } |
747 | |
|
748 | |
|
749 | |
public void sectionTitle1_() |
750 | |
{ |
751 | 4 | sectionTitle_( 1 ); |
752 | 4 | } |
753 | |
|
754 | |
|
755 | |
public void sectionTitle2() |
756 | |
{ |
757 | 4 | sectionTitle( 2, null ); |
758 | 4 | } |
759 | |
|
760 | |
|
761 | |
public void sectionTitle2_() |
762 | |
{ |
763 | 4 | sectionTitle_( 2 ); |
764 | 4 | } |
765 | |
|
766 | |
|
767 | |
public void sectionTitle3() |
768 | |
{ |
769 | 4 | sectionTitle( 3, null ); |
770 | 4 | } |
771 | |
|
772 | |
|
773 | |
public void sectionTitle3_() |
774 | |
{ |
775 | 4 | sectionTitle_( 3 ); |
776 | 4 | } |
777 | |
|
778 | |
|
779 | |
public void sectionTitle4() |
780 | |
{ |
781 | 4 | sectionTitle( 4, null ); |
782 | 4 | } |
783 | |
|
784 | |
|
785 | |
public void sectionTitle4_() |
786 | |
{ |
787 | 4 | sectionTitle_( 4 ); |
788 | 4 | } |
789 | |
|
790 | |
|
791 | |
public void sectionTitle5() |
792 | |
{ |
793 | 4 | sectionTitle( 5, null ); |
794 | 4 | } |
795 | |
|
796 | |
|
797 | |
public void sectionTitle5_() |
798 | |
{ |
799 | 4 | sectionTitle_( 5 ); |
800 | 4 | } |
801 | |
|
802 | |
|
803 | |
|
804 | |
|
805 | |
|
806 | |
public void sectionTitle_() |
807 | |
{ |
808 | |
|
809 | 2 | } |
810 | |
|
811 | |
|
812 | |
public void sectionTitle_( int level ) |
813 | |
{ |
814 | 20 | writeEOL( true ); |
815 | 20 | writeEOL(); |
816 | 20 | } |
817 | |
|
818 | |
|
819 | |
public void table() |
820 | |
{ |
821 | |
|
822 | 8 | writeEOL( true ); |
823 | 8 | writeEOL(); |
824 | 8 | } |
825 | |
|
826 | |
|
827 | |
public void table( SinkEventAttributes attributes ) |
828 | |
{ |
829 | 0 | table(); |
830 | 0 | } |
831 | |
|
832 | |
|
833 | |
public void table_() |
834 | |
{ |
835 | 8 | writeEOL( true ); |
836 | 8 | writeEOL(); |
837 | 8 | } |
838 | |
|
839 | |
|
840 | |
|
841 | |
|
842 | |
|
843 | |
public void tableCaption() |
844 | |
{ |
845 | |
|
846 | 4 | } |
847 | |
|
848 | |
|
849 | |
public void tableCaption( SinkEventAttributes attributes ) |
850 | |
{ |
851 | 0 | tableCaption(); |
852 | 0 | } |
853 | |
|
854 | |
|
855 | |
|
856 | |
|
857 | |
|
858 | |
public void tableCaption_() |
859 | |
{ |
860 | |
|
861 | 4 | } |
862 | |
|
863 | |
|
864 | |
public void tableCell() |
865 | |
{ |
866 | 26 | write( " " ); |
867 | 26 | } |
868 | |
|
869 | |
|
870 | |
public void tableCell( SinkEventAttributes attributes ) |
871 | |
{ |
872 | 0 | tableCell(); |
873 | 0 | } |
874 | |
|
875 | |
|
876 | |
public void tableCell( String width ) |
877 | |
{ |
878 | 0 | tableCell(); |
879 | 0 | } |
880 | |
|
881 | |
|
882 | |
public void tableCell_() |
883 | |
{ |
884 | 26 | write( " " ); |
885 | 26 | write( TABLE_CELL_MARKUP ); |
886 | 26 | } |
887 | |
|
888 | |
|
889 | |
public void tableHeaderCell() |
890 | |
{ |
891 | 4 | tableHeaderFlag = true; |
892 | 4 | write( TABLE_CELL_HEADER_START_MARKUP ); |
893 | 4 | } |
894 | |
|
895 | |
|
896 | |
public void tableHeaderCell( SinkEventAttributes attributes ) |
897 | |
{ |
898 | 0 | tableHeaderCell(); |
899 | 0 | } |
900 | |
|
901 | |
|
902 | |
public void tableHeaderCell( String width ) |
903 | |
{ |
904 | 0 | tableHeaderCell(); |
905 | 0 | } |
906 | |
|
907 | |
|
908 | |
public void tableHeaderCell_() |
909 | |
{ |
910 | 4 | write( TABLE_CELL_HEADER_END_MARKUP ); |
911 | 4 | } |
912 | |
|
913 | |
|
914 | |
public void tableRow() |
915 | |
{ |
916 | 14 | write( TABLE_ROW_MARKUP ); |
917 | 14 | } |
918 | |
|
919 | |
|
920 | |
public void tableRow( SinkEventAttributes attributes ) |
921 | |
{ |
922 | 0 | tableRow(); |
923 | 0 | } |
924 | |
|
925 | |
|
926 | |
public void tableRow_() |
927 | |
{ |
928 | 14 | if ( tableHeaderFlag ) |
929 | |
{ |
930 | 2 | tableHeaderFlag = false; |
931 | 2 | write( TABLE_ROW_MARKUP ); |
932 | |
} |
933 | 14 | writeEOL( true ); |
934 | 14 | } |
935 | |
|
936 | |
|
937 | |
|
938 | |
|
939 | |
|
940 | |
public void tableRows( int[] justification, boolean grid ) |
941 | |
{ |
942 | |
|
943 | 8 | } |
944 | |
|
945 | |
|
946 | |
|
947 | |
|
948 | |
|
949 | |
public void tableRows_() |
950 | |
{ |
951 | |
|
952 | 8 | } |
953 | |
|
954 | |
|
955 | |
public void text( String text ) |
956 | |
{ |
957 | 210 | if ( headFlag ) |
958 | |
{ |
959 | 6 | return; |
960 | |
} |
961 | |
|
962 | 204 | if ( linkName != null ) |
963 | |
{ |
964 | 10 | write( LINK_START_MARKUP ); |
965 | |
} |
966 | |
|
967 | 204 | content( text ); |
968 | |
|
969 | 204 | if ( linkName != null ) |
970 | |
{ |
971 | 10 | write( LINK_MIDDLE_MARKUP + linkName ); |
972 | |
} |
973 | 204 | } |
974 | |
|
975 | |
|
976 | |
public void text( String text, SinkEventAttributes attributes ) |
977 | |
{ |
978 | 2 | text( text ); |
979 | 2 | } |
980 | |
|
981 | |
|
982 | |
|
983 | |
|
984 | |
|
985 | |
public void title() |
986 | |
{ |
987 | |
|
988 | 2 | } |
989 | |
|
990 | |
|
991 | |
public void title( SinkEventAttributes attributes ) |
992 | |
{ |
993 | 0 | title(); |
994 | 0 | } |
995 | |
|
996 | |
|
997 | |
|
998 | |
|
999 | |
|
1000 | |
public void title_() |
1001 | |
{ |
1002 | |
|
1003 | 2 | } |
1004 | |
|
1005 | |
|
1006 | |
|
1007 | |
|
1008 | |
|
1009 | |
public void unknown( String name, Object[] requiredParams, SinkEventAttributes attributes ) |
1010 | |
{ |
1011 | |
|
1012 | 0 | } |
1013 | |
|
1014 | |
|
1015 | |
public void verbatim( boolean boxed ) |
1016 | |
{ |
1017 | 6 | if ( boxed ) |
1018 | |
{ |
1019 | 6 | verbatimBoxedFlag = true; |
1020 | |
} |
1021 | |
|
1022 | 6 | if ( verbatimBoxedFlag ) |
1023 | |
{ |
1024 | 6 | write( "{code|borderStyle=solid}" ); |
1025 | |
} |
1026 | |
else |
1027 | |
{ |
1028 | 0 | write( "{noformat}" ); |
1029 | |
} |
1030 | 6 | writeEOL( true ); |
1031 | 6 | } |
1032 | |
|
1033 | |
|
1034 | |
public void verbatim_() |
1035 | |
{ |
1036 | 6 | if ( verbatimBoxedFlag ) |
1037 | |
{ |
1038 | 6 | write( "{code}" ); |
1039 | |
} |
1040 | |
else |
1041 | |
{ |
1042 | 0 | write( "{noformat}" ); |
1043 | |
} |
1044 | |
|
1045 | 6 | writeEOL( true ); |
1046 | 6 | writeEOL(); |
1047 | 6 | } |
1048 | |
|
1049 | |
|
1050 | |
|
1051 | |
|
1052 | |
|
1053 | |
private void write( String text ) |
1054 | |
{ |
1055 | 700 | writer.write( unifyEOLs( text ) ); |
1056 | 700 | } |
1057 | |
|
1058 | |
|
1059 | |
|
1060 | |
|
1061 | |
private void writeEOL() |
1062 | |
{ |
1063 | 112 | write( EOL ); |
1064 | 112 | } |
1065 | |
|
1066 | |
|
1067 | |
|
1068 | |
|
1069 | |
private void writeEOL( boolean trim ) |
1070 | |
{ |
1071 | 126 | if ( !trim ) |
1072 | |
{ |
1073 | 0 | writeEOL(); |
1074 | 0 | return; |
1075 | |
} |
1076 | |
|
1077 | 126 | String tmp = writer.toString().trim(); |
1078 | 126 | writer = new StringWriter(); |
1079 | 126 | writer.write( tmp ); |
1080 | 126 | write( EOL ); |
1081 | 126 | } |
1082 | |
|
1083 | |
|
1084 | |
|
1085 | |
|
1086 | |
|
1087 | |
|
1088 | |
protected void content( String text ) |
1089 | |
{ |
1090 | 204 | write( escapeHTML( text ) ); |
1091 | 204 | } |
1092 | |
|
1093 | |
|
1094 | |
protected void init() |
1095 | |
{ |
1096 | 166 | super.init(); |
1097 | |
|
1098 | 166 | this.writer = new StringWriter(); |
1099 | 166 | this.headFlag = false; |
1100 | 166 | this.levelList = 0; |
1101 | 166 | this.listStyles.clear(); |
1102 | 166 | this.verbatimBoxedFlag = false; |
1103 | 166 | this.tableHeaderFlag = false; |
1104 | 166 | this.linkName = null; |
1105 | 166 | } |
1106 | |
|
1107 | |
|
1108 | |
|
1109 | |
|
1110 | |
|
1111 | |
|
1112 | |
|
1113 | |
|
1114 | |
protected static String escapeHTML( String text ) |
1115 | |
{ |
1116 | 204 | return HtmlTools.escapeHTML( text ); |
1117 | |
} |
1118 | |
} |