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.Writer;
23
24 import org.apache.maven.doxia.sink.Sink;
25 import org.apache.maven.doxia.sink.impl.AbstractSinkTest;
26 import org.apache.maven.doxia.util.HtmlTools;
27
28
29
30
31
32
33
34
35 public class ConfluenceSinkTest
36 extends AbstractSinkTest
37 {
38
39 protected Sink createSink( Writer writer )
40 {
41 return new ConfluenceSink( writer );
42 }
43
44
45 protected String getAnchorBlock( String anchor )
46 {
47 return ConfluenceMarkup.ANCHOR_START_MARKUP + anchor + ConfluenceMarkup.ANCHOR_END_MARKUP + anchor;
48 }
49
50
51 protected boolean isXmlSink()
52 {
53 return false;
54 }
55
56
57
58 protected String getAuthorBlock( String author )
59 {
60 return null;
61 }
62
63
64
65 protected String getBodyBlock()
66 {
67 return null;
68 }
69
70
71 protected String getBoldBlock( String text )
72 {
73 return ConfluenceMarkup.BOLD_START_MARKUP + text + ConfluenceMarkup.BOLD_END_MARKUP;
74 }
75
76
77
78 protected String getDateBlock( String date )
79 {
80 return null;
81 }
82
83
84
85 protected String getDefinitionListBlock( String definum, String definition )
86 {
87 return null;
88 }
89
90
91 protected String getFigureBlock( String source, String caption )
92 {
93 String figureBlock = EOL + ConfluenceMarkup.FIGURE_START_MARKUP + source + ConfluenceMarkup.FIGURE_END_MARKUP;
94 if ( caption != null )
95 {
96 figureBlock += caption;
97 }
98 return figureBlock;
99 }
100
101
102
103 protected String getHeadBlock()
104 {
105 return null;
106 }
107
108
109 protected String getHorizontalRuleBlock()
110 {
111 return "";
112 }
113
114
115 protected String getItalicBlock( String text )
116 {
117 return ConfluenceMarkup.ITALIC_START_MARKUP + text + ConfluenceMarkup.ITALIC_END_MARKUP;
118 }
119
120
121 protected String getLineBreakBlock()
122 {
123 return ConfluenceMarkup.LINE_BREAK_MARKUP + EOL;
124 }
125
126
127 protected String getLinkBlock( String link, String text )
128 {
129 return ConfluenceMarkup.LINK_START_MARKUP + text + ConfluenceMarkup.LINK_MIDDLE_MARKUP + link
130 + ConfluenceMarkup.LINK_END_MARKUP;
131 }
132
133
134 protected String getListBlock( String item )
135 {
136 return ConfluenceMarkup.LIST_ITEM_MARKUP + item + EOL;
137 }
138
139
140 protected String getMonospacedBlock( String text )
141 {
142 return ConfluenceMarkup.MONOSPACED_START_MARKUP + text + ConfluenceMarkup.MONOSPACED_END_MARKUP;
143 }
144
145
146 protected String getNonBreakingSpaceBlock()
147 {
148 return "";
149 }
150
151
152 protected String getNumberedListBlock( String item )
153 {
154 return ConfluenceMarkup.NUMBERING_MARKUP + " " + item + EOL;
155 }
156
157
158 protected String getPageBreakBlock()
159 {
160 return "";
161 }
162
163
164 protected String getParagraphBlock( String text )
165 {
166 return text + EOL + EOL;
167 }
168
169
170 protected String getRawTextBlock( String text )
171 {
172 return "";
173 }
174
175
176 protected String getSection1Block( String title )
177 {
178 return "h1. " + title + EOL + EOL;
179 }
180
181
182 protected String getSection2Block( String title )
183 {
184 return "h2. " + title + EOL + EOL;
185 }
186
187
188 protected String getSection3Block( String title )
189 {
190 return "h3. " + title + EOL + EOL;
191 }
192
193
194 protected String getSection4Block( String title )
195 {
196 return "h4. " + title + EOL + EOL;
197 }
198
199
200 protected String getSection5Block( String title )
201 {
202 return "h5. " + title + EOL + EOL;
203 }
204
205
206 protected String getSectionTitleBlock( String title )
207 {
208 return title;
209 }
210
211
212 protected String getTableBlock( String cell, String caption )
213 {
214 return "| " + cell + " |" + EOL + "Table_caption" + EOL + EOL;
215 }
216
217
218 protected String getTextBlock( String text )
219 {
220 return HtmlTools.escapeHTML( text );
221 }
222
223
224
225 protected String getTitleBlock( String title )
226 {
227 return null;
228 }
229
230
231 protected String getVerbatimBlock( String text )
232 {
233 return "{code|borderStyle=solid}" + EOL + text + "{code}" + EOL + EOL;
234 }
235
236
237 protected String outputExtension()
238 {
239 return "twiki";
240 }
241
242
243
244
245
246 public void testSuperScript()
247 {
248 verifyValignSup( "^ValignSup^" );
249 }
250
251 public void testSubScript()
252 {
253 verifyValignSub( "~ValignSub~" );
254 }
255
256 public void testStrikeStrough()
257 {
258 verifyDecorationLineThrough( "-DecorationLineThrough-" );
259 }
260
261 public void testUnderline()
262 {
263 verifyDecorationUnderline( "+DecorationUnderline+" );
264 }
265
266
267
268
269
270
271
272 public void testAuthor()
273 {
274
275 }
276
277
278
279 public void testDate()
280 {
281
282 }
283
284
285
286 public void testHead()
287 {
288
289 }
290
291
292
293 public void testBody()
294 {
295
296 }
297
298
299
300 public void testTitle()
301 {
302
303 }
304
305
306
307 public void testDefinitionList()
308 {
309
310 }
311
312
313 protected String getCommentBlock( String text )
314 {
315 return "";
316 }
317 }