Changeset 1766 for trunk/pylucid_project/tests
- Timestamp:
- 09/15/08 12:48:38 (18 months ago)
- Files:
-
- 1 modified
-
trunk/pylucid_project/tests/markup_creole.py (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid_project/tests/markup_creole.py
r1764 r1766 12 12 ~~~~~~~~~~ 13 13 http://code.google.com/p/creoleparser/source/browse/trunk/creoleparser/tests.py 14 http://hg.moinmo.in/moin/1. 7/file/tip/MoinMoin/parser/14 http://hg.moinmo.in/moin/1.8/file/tip/MoinMoin/parser/ 15 15 http://sheep.art.pl/devel/creole/file/tip 16 http://djikiki.googlecode.com/svn/trunk/djikiki/creole/ 16 http://code.google.com/p/djikiki/source/browse/#svn/trunk/djikiki/creole 17 http://creoleparser.googlepages.com/cheatsheetplus.html 18 http://www.wikicreole.org/creole-sandbox/EditX.jsp?page=Home 19 http://www.wikicreole.org/wiki/Sandbox 17 20 18 21 Differences to Creole 1.0 … … 83 86 def test_creole_basic1(self): 84 87 out_string = self._parse("a text line.") 85 self.assertEqual(out_string, "<p>a text line.</p>\n \n")88 self.assertEqual(out_string, "<p>a text line.</p>\n") 86 89 87 90 def test_creole_basic2(self): … … 94 97 95 98 def test_creole_basic3(self): 96 self.assertCreole(r"""97 Basics: **bold** or //italic//98 or **//both//** or //**both**//99 """, """100 <p>Basics: <b>bold</b> or <i>italic</i><br />101 or <b><i>both</i></b> or <i><b>both</b></i></p>102 """)103 104 def test_creole_basic4(self):105 99 self.assertCreole(r""" 106 100 Here is [[a internal]] link. … … 122 116 The current page name: >{{ PAGE.name }}< great? 123 117 A {% lucidTag page_update_list count=10 %} PyLucid plugin 124 125 118 {% sourcecode py %} 126 119 import sys … … 128 121 sys.stdout("Hello World!") 129 122 {% endsourcecode %} 130 131 123 A [[www.domain.tld|link]]. 132 124 a {{/image.jpg|My Image}} image … … 137 129 <p>The current page name: >{{ PAGE.name }}< great?<br /> 138 130 A {% lucidTag page_update_list count=10 %} PyLucid plugin</p> 139 140 131 {% sourcecode py %} 141 132 import sys … … 143 134 sys.stdout("Hello World!") 144 135 {% endsourcecode %} 145 146 136 <p>A <a href="www.domain.tld">link</a>.<br /> 147 137 a <img src="/image.jpg" alt="My Image"> image</p> 148 138 149 139 <p>no image: {{ foo|bar }}!<br /> 150 140 picture <a href="www.domain.tld"><img src="foo.JPG" alt="Foo"></a> as a link</p> … … 153 143 def test_nowiki1(self): 154 144 self.assertCreole(r""" 145 this: 155 146 {{{ 156 147 //This// does **not** get [[formatted]] 157 148 }}} 158 """, """ 149 and this: {{{** <i>this</i> ** }}} 150 151 === Closing braces in nowiki: 152 {{{ 153 if (x != NULL) { 154 for (i = 0; i < size; i++) { 155 if (x[i] > 0) { 156 x[i]--; 157 }}} 158 }}} 159 """, """ 160 <p>this:</p> 159 161 <pre> 160 162 //This// does **not** get [[formatted]] 161 163 </pre> 164 <p>and this: <tt>** <i>this</i> **</tt></p> 165 166 <h3>Closing braces in nowiki:</h3> 167 <pre> 168 if (x != NULL) { 169 for (i = 0; i < size; i++) { 170 if (x[i] > 0) { 171 x[i]--; 172 }}} 173 </pre> 162 174 """) 163 175 … … 166 178 111 167 179 222 168 169 180 {{{ 170 181 333 171 182 }}} 172 173 183 444 184 185 one 186 {{{ 187 foobar 188 }}} 189 190 two 174 191 """, """ 175 192 <p>111<br /> 176 193 222</p> 177 178 194 <pre> 179 195 333 180 196 </pre> 181 197 <p>444</p> 198 199 <p>one</p> 200 <pre> 201 foobar 202 </pre> 203 <p>two</p> 204 """) 205 206 def test_escape_char(self): 207 self.assertCreole(r""" 208 ~#1 209 http://domain.tld/~bar/ 210 ~http://domain.tld/ 211 [[Link]] 212 ~[[Link]] 213 """, """ 214 <p>#1<br /> 215 <a href="http://domain.tld/~bar/">http://domain.tld/~bar/</a><br /> 216 http://domain.tld/<br /> 217 <a href="Link">Link</a><br /> 218 [[Link]]</p> 182 219 """) 183 220 … … 187 224 //**bold italics**// 188 225 //This is **also** good.// 189 """, """ 190 <p><b><i>bold italics</i></b><br /> 191 <i><b>bold italics</b></i><br /> 192 <i>This is <b>also</b> good.</i></p> 226 227 //[[a page|this is italic]]// 228 **[[a page]]** 229 //**[[a page]]**// 230 """, """ 231 <p><strong><i>bold italics</i></strong><br /> 232 <i><strong>bold italics</strong></i><br /> 233 <i>This is <strong>also</strong> good.</i></p> 234 235 <p><i><a href="a page">this is italic</a></i><br /> 236 <strong><a href="a page">a page</a></strong><br /> 237 <i><strong><a href="a page">a page</a></strong></i></p> 193 238 """) 194 239 195 240 def test_cross_paragraphs(self): 196 self.assertCreole( """241 self.assertCreole(r""" 197 242 Bold and italics should //be 198 243 able// to cross lines. … … 204 249 <p>Bold and italics should <i>be<br /> 205 250 able</i> to cross lines.</p> 206 251 207 252 <p>But, should <i>not be...</i></p> 208 253 209 254 <p>...able<i> to cross paragraphs.</i></p> 210 255 """) 211 256 212 257 def test_headlines(self): 213 self.assertCreole( """258 self.assertCreole(r""" 214 259 = Level 1 (largest) = 215 260 == Level 2 == … … 221 266 === Also level 3 = 222 267 === Also level 3 == 223 === **not** //parsed// ===268 === **not** \\ //parsed// === 224 269 No == headline == or? 225 """, """270 """, r""" 226 271 <h1>Level 1 (largest)</h1> 227 272 <h2>Level 2</h2> … … 233 278 <h3>Also level 3</h3> 234 279 <h3>Also level 3</h3> 235 <h3>**not** //parsed//</h3>280 <h3>**not** \\ //parsed//</h3> 236 281 <p>No == headline == or?</p> 237 282 """) 238 283 239 def test_bullet_list(self):240 self.assertCreole("""241 * Item 1242 ** Item 1.1243 ** Item 1.2244 * Item 2245 ** Item 2.1246 *** Item 3.1247 *** Item 3.2248 """, """249 <ul>250 <li>Item 1251 <ul>252 <li>Item 1.1253 </li>254 <li>Item 1.2255 </li>256 </ul>257 </li>258 <li>Item 2259 <ul>260 <li>Item 2.1261 <ul>262 <li>Item 3.1263 </li>264 <li>Item 3.2265 </li>266 </ul>267 </li>268 </ul>269 </li>270 </ul>271 """)272 273 def test_number_list(self):274 self.assertCreole("""275 # Item 1276 ## Item 1.1277 # Item 2278 """, """279 <ol>280 <li>Item 1281 <ol>282 <li>Item 1.1283 </li>284 </ol>285 </li>286 <li>Item 2287 </li>288 </ol>289 """)290 291 284 def test_horizontal_rule(self): 292 self.assertCreole( """285 self.assertCreole(r""" 293 286 one 294 287 ---- … … 298 291 <hr /> 299 292 <p>two</p> 293 """) 294 295 def test_bullet_list(self): 296 self.assertCreole(r""" 297 * Item 1 298 ** Item 1.1 299 ** a **bold** Item 1.2 300 * Item 2 301 ** Item 2.1 302 *** [[a link Item 3.1]] 303 *** Force\\linebreak 3.2 304 *** item 3.3 305 *** item 3.4 306 307 up to five levels 308 * 1 309 ** 2 310 *** 3 311 **** 4 312 ***** 5 313 """, """ 314 <ul> 315 \t<li>Item 1 316 \t<ul> 317 \t\t<li>Item 1.1</li> 318 \t\t<li>a <strong>bold</strong> Item 1.2</li> 319 \t</ul></li> 320 \t<li>Item 2 321 \t<ul> 322 \t\t<li>Item 2.1 323 \t\t<ul> 324 \t\t\t<li><a href="a link Item 3.1">a link Item 3.1</a></li> 325 \t\t\t<li>Force<br /> 326 \t\t\tlinebreak 3.2</li> 327 \t\t\t<li>item 3.3</li> 328 \t\t\t<li>item 3.4</li> 329 \t\t</ul></li> 330 \t</ul></li> 331 </ul> 332 <p>up to five levels</p> 333 <ul> 334 \t<li>1 335 \t<ul> 336 \t\t<li>2 337 \t\t<ul> 338 \t\t\t<li>3 339 \t\t\t<ul> 340 \t\t\t\t<li>4 341 \t\t\t\t<ul> 342 \t\t\t\t\t<li>5</li> 343 \t\t\t\t</ul></li> 344 \t\t\t</ul></li> 345 \t\t</ul></li> 346 \t</ul></li> 347 </ul> 348 """) 349 350 def test_number_list(self): 351 self.assertCreole(r""" 352 # Item 1 353 ## Item 1.1 354 ## a **bold** Item 1.2 355 # Item 2 356 ## Item 2.1 357 ### [[a link Item 3.1]] 358 ### Force\\linebreak 3.2 359 ### item 3.3 360 ### item 3.4 361 362 up to five levels 363 # 1 364 ## 2 365 ### 3 366 #### 4 367 ##### 5 368 """, """ 369 <ol> 370 \t<li>Item 1 371 \t<ol> 372 \t\t<li>Item 1.1</li> 373 \t\t<li>a <strong>bold</strong> Item 1.2</li> 374 \t</ol></li> 375 \t<li>Item 2 376 \t<ol> 377 \t\t<li>Item 2.1 378 \t\t<ol> 379 \t\t\t<li><a href="a link Item 3.1">a link Item 3.1</a></li> 380 \t\t\t<li>Force<br /> 381 \t\t\tlinebreak 3.2</li> 382 \t\t\t<li>item 3.3</li> 383 \t\t\t<li>item 3.4</li> 384 \t\t</ol></li> 385 \t</ol></li> 386 </ol> 387 <p>up to five levels</p> 388 <ol> 389 \t<li>1 390 \t<ol> 391 \t\t<li>2 392 \t\t<ol> 393 \t\t\t<li>3 394 \t\t\t<ol> 395 \t\t\t\t<li>4 396 \t\t\t\t<ol> 397 \t\t\t\t\t<li>5</li> 398 \t\t\t\t</ol></li> 399 \t\t\t</ol></li> 400 \t\t</ol></li> 401 \t</ol></li> 402 </ol> 403 """) 404 405 def test_list(self): 406 """ Bold, Italics, Links, Pre in Lists """ 407 self.assertCreole(r""" 408 * **bold** item 409 * //italic// item 410 411 # item about a [[certain_page]] 412 # {{{ //this// is **not** [[processed]] }}} 413 """, """ 414 <ul> 415 \t<li><strong>bold</strong> item</li> 416 \t<li><i>italic</i> item</li> 417 </ul> 418 <ol> 419 \t<li>item about a <a href="certain_page">certain_page</a></li> 420 \t<li><tt>//this// is **not** [[processed]]</tt></li> 421 </ol> 422 """) 423 424 def test_table(self): 425 self.assertCreole(r""" 426 A Table... 427 |= Headline |= a other\\headline |= the **big end | 428 | a cell | a **big** cell |**//bold italics//** | 429 | next\\line | No == headline == or? | | 430 | | | open end 431 ...end 432 """, """ 433 <p>A Table...</p> 434 <table> 435 <tr> 436 \t<th>Headline</th> 437 \t<th>a other<br /> 438 \t\theadline</th> 439 \t<th>the <strong>big end</strong></th> 440 </tr> 441 <tr> 442 \t<td>a cell</td> 443 \t<td>a <strong>big</strong> cell</td> 444 \t<td><strong><i>bold italics</i></strong></td> 445 </tr> 446 <tr> 447 \t<td>next<br /> 448 \t\tline</td> 449 \t<td>No == headline == or?</td> 450 \t<td></td> 451 </tr> 452 <tr> 453 \t<td></td> 454 \t<td></td> 455 \t<td>open end</td> 456 </tr> 457 </table> 458 <p>...end</p> 459 """) 460 461 def test_html_lines(self): 462 self.assertCreole(r""" 463 This is a normal Text block witch would 464 escape html chars like < and > ;) 465 <p>this <strong class="my">html code</strong> line pass-through</p> 466 end 467 """, """ 468 <p>This is a normal Text block witch would<br /> 469 escape html chars like < and > ;)</p> 470 <p>this <strong class="my">html code</strong> line pass-through</p> 471 <p>end</p> 300 472 """) 301 473