1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832
|
local $/;
require 't/runtests.pl';
runtests( data => <DATA>, dialect => 'MediaWiki', wiki_uri => 'http://www.test.com/wiki/' );
close DATA;
__DATA__
external link
__H__
<p><a href="http://example.com">[http://example.com]</a></p>
__W__
[http://example.com <nowiki>[http://example.com]</nowiki>]
__NEXT__
nowiki template
__H__
<p>mark stubs with {{stub}}</p>
__W__
<nowiki>mark stubs with {{stub}}</nowiki>
__NEXT__
nowiki quoted
__H__
<p>what happens to 'quoted text'?</p>
__W__
what happens to 'quoted text'?
__NEXT__
nowiki doubly quoted
__H__
<p>how about ''doubly quoted''?</p>
__W__
<nowiki>how about ''doubly quoted''?</nowiki>
__NEXT__
nowiki triply quoted
__H__
<p>and '''triply quoted'''?</p>
__W__
<nowiki>and '''triply quoted'''?</nowiki>
__NEXT__
nowiki hr
__H__
<p>----</p>
__W__
<nowiki>----</nowiki>
__NEXT__
nowiki ul
__H__
<p>* ul</p>
__W__
<nowiki>* ul</nowiki>
__NEXT__
nowiki ol
__H__
<p># ol</p>
__W__
<nowiki># ol</nowiki>
__NEXT__
nowiki def
__H__
<p>; def</p>
__W__
<nowiki>; def</nowiki>
__NEXT__
nowiki indent
__H__
<p>: indent</p>
__W__
<nowiki>: indent</nowiki>
__NEXT__
nowiki internal links
__H__
<p>an [[internal]] link</p>
__W__
<nowiki>an [[internal]] link</nowiki>
__NEXT__
nowiki table markup
__H__
<p>{|<br />
| table<br />
|}</p>
__W__
<nowiki>{|</nowiki><br /> | table<br /> |}
__NEXT__
nowiki ext link
__H__
<p>[http://example.com]</p>
__W__
<nowiki>[http://example.com]</nowiki>
__NEXT__
(bug #46453) triggering <nowiki> too often
__H__
<em>x</em>:bla
__W__
''x'':bla
__NEXT__
do not add a <nowiki> tag only if offending character(s) occur at the beginning of text node
__H__
<p>text <strong>*</strong>
<p>text <strong>#</strong>
<p>text <strong>;</strong>
<p>text <strong>:</strong>
<p>text <strong>=</strong>
<p>text <strong>!</strong>
<p>text <strong>|</strong>
<p>text <strong>----</strong>
<p>text <strong>{|</strong>
__W__
text '''*'''
text '''#'''
text ''';'''
text ''':'''
text '''='''
text '''!'''
text '''|'''
text '''----'''
text '''{|'''
__NEXT__
tr attributes
__H__
<html><table><tr align="left" valign="top"><td>ok</td></tr></table></html>
__W__
{|
|- align="left" valign="top"
| ok
|}
__NEXT__
preserve cite
__H__
<html><cite id="good">text</cite></html>
__W__
<cite id="good">text</cite>
__NEXT__
preserve var
__H__
<html><var id="good">text</var></html>
__W__
<var id="good">text</var>
__NEXT__
preserve blockquote
__H__
<html><blockquote cite="something" onclick="alert('hello')">text</blockquote></html>
__W__
<blockquote cite="something">text</blockquote>
__NEXT__
preserve ruby
__H__
<html><ruby>text</ruby></html>
__W__
<ruby>text</ruby>
__NEXT__
preserve rb
__H__
<html><rb id="ok">text</rb></html>
__W__
<rb id="ok">text</rb>
__NEXT__
preserve rt
__H__
<html><rt id="ok" blah="blah">text</rt></html>
__W__
<rt id="ok">text</rt>
__NEXT__
preserve rp
__H__
<html><rp id="ok" something="ok" bad="good" class="stuff">text</rp></html>
__W__
<rp id="ok" class="stuff">text</rp>
__NEXT__
preserve div
__H__
<html><div id="thing" align="left" bad="good">ok</div></html>
__W__
<div id="thing" align="left">ok</div>
__NEXT__
empty line break
__H__
<html><br id="thing"></br></html>
__W__
<br id="thing" />
__NEXT__
br attribs
__H__
<html>ok<br id="stuff" class="things" title="ok" style="clear:both" clear="both"></html>
__W__
ok<br id="stuff" class="things" title="ok" style="clear: both" clear="both" />
__NEXT__
wrap in html
__H__
<a href="http://google.com">GOOGLE</a><br/>
NewLine
__W__
[http://google.com GOOGLE]<br /> NewLine
__NEXT__
bold
__H__
<html><b>bold</b></html>
__W__
'''bold'''
__NEXT__
italics
__H__
<html><i>italics</i></html>
__W__
''italics''
__NEXT__
bold and italics
__H__
<html><b>bold</b> and <i>italics</i></html>
__W__
'''bold''' and ''italics''
__NEXT__
bold-italics nested
__H__
<html><b><i>bold-italics</i> nested</b></html>
__W__
'''''bold-italics'' nested'''
__NEXT__
strong
__H__
<html><strong>strong</strong></html>
__W__
'''strong'''
__NEXT__
emphasized
__H__
<html><em>emphasized</em></html>
__W__
''emphasized''
__NEXT__
underlined
__H__
<html><u>underlined</u></html>
__W__
<u>underlined</u>
__NEXT__
strikethrough
__H__
<html><s>strike</s></html>
__W__
<s>strike</s>
__NEXT__
deleted
__H__
<html><del>deleted text</del></html>
__W__
<del>deleted text</del>
__NEXT__
inserted
__H__
<html><ins>inserted</ins></html>
__W__
<ins>inserted</ins>
__NEXT__
span tags removed if naked (ie, have no attribs)
__H__
<html><span>text here</span></html>
__W__
text here
__NEXT__
strip aname
__H__
<html><a name="thing"></a></html>
__W__
__NEXT__
one-line phrasals
__H__
<html><i>phrasals
in one line</i></html>
__W__
''phrasals in one line''
__NEXT__
paragraph blocking
__H__
<html><p>p1</p><p>p2</p></html>
__W__
p1
p2
__NEXT__
lists
__H__
<html><ul><li>1</li><li>2</li></ul></html>
__W__
* 1
* 2
__NEXT__
nested lists
__H__
<html><ul><li>1<ul><li>1a</li><li>1b</li></ul></li><li>2</li></ul>
__W__
* 1
** 1a
** 1b
* 2
__NEXT__
nested lists (different types)
__H__
<html><ul><li>1<ul><li>a<ol><li>i</li></ol></li><li>b</li></ul></li><li>2<dl><dd>indented</dd></dl></li></ul></html>
__W__
* 1
** a
**# i
** b
* 2
*: indented
__NEXT__
hr
__H__
<html><hr /></html>
__W__
----
__NEXT__
br
__H__
<html><p>stuff<br />stuff two</p></html>
__W__
stuff<br />stuff two
__NEXT__
div
__H__
<html><div>thing</div></html>
__W__
<div>thing</div>
__NEXT__
div w/ attrs
__H__
<html><div id="name" class="panel" onclick="popup()">thing</div></html>
__W__
<div id="name" class="panel">thing</div>
__NEXT__
sub
__H__
<html><p>H<sub>2</sub>O</p></html>
__W__
H<sub>2</sub>O
__NEXT__
sup
__H__
<html><p>x<sup>2</sup></p></html>
__W__
x<sup>2</sup>
__NEXT__
center
__H__
<html><center>centered text</center></html>
__W__
<center>centered text</center>
__NEXT__
small
__H__
<html><small>small text</small></html>
__W__
<small>small text</small>
__NEXT__
code
__H__
<html><code>$name = 'stan';</code></html>
__W__
<code>$name = 'stan';</code>
__NEXT__
tt
__H__
<html><tt>tt text</tt></html>
__W__
<tt>tt text</tt>
__NEXT__
font-to-span conversion ::TODO("HTML::WikiConverter::Normalizer not doing font-to-span conversion yet")
__H__
<html><font color="blue" face="Arial" size="+2">font</font></html>
__W__
<span style="font-size:+2; color:blue; font-family:Arial">font</span>
__NEXT__
font
__H__
<html><font color="blue" face="Arial" size="+2">font</font></html>
__W__
<font size="+2" color="blue" face="Arial">font</font>
__NEXT__
pre
__H__
<html><pre>this
is
preformatted
text</pre></html>
__W__
this
is
preformatted
text
__NEXT__
indent
__H__
<html><dl><dd>indented text</dd></dl></html>
__W__
: indented text
__NEXT__
nested indent
__H__
<html><dl><dd>stuff<dl><dd>double-indented</dd></dl></dd></dl></html>
__W__
: stuff
:: double-indented
__NEXT__
h1
__H__
<h1>h1</h1>
__W__
=h1=
__NEXT__
h2
__H__
<h2>h2</h2>
__W__
==h2==
__NEXT__
h3
__H__
<h3>h3</h3>
__W__
===h3===
__NEXT__
h4
__H__
<h4>h4</h4>
__W__
====h4====
__NEXT__
h5
__H__
<h5>h5</h5>
__W__
=====h5=====
__NEXT__
h6
__H__
<h6>h6</h6>
__W__
======h6======
__NEXT__
img
__H__
<html><img src="thing.gif" /></html>
__W__
[[Image:thing.gif]]
__NEXT__
table
__H__
<table>
<caption>Stuff</caption>
<tr>
<th> Name </th> <td> David </td>
</tr>
<tr>
<th> Age </th> <td> 24 </td>
</tr>
<tr>
<th> Height </th> <td> 6' </td>
</tr>
<tr>
<td>
<table>
<tr>
<td> Nested </td>
<td> tables </td>
</tr>
<tr>
<td> are </td>
<td> fun </td>
</tr>
</table>
</td>
</tr>
</table>
__W__
{|
|+ Stuff
|-
! Name
| David
|-
! Age
| 24
|-
! Height
| 6'
|-
|
{|
| Nested
| tables
|-
| are
| fun
|}
|}
__NEXT__
table w/ attrs
__H__
<table border=1 cellpadding=3 bgcolor=#ffffff onclick='alert("alert!")'>
<caption>Stuff</caption>
<tr id="first" class="unselected">
<th id=thing bgcolor=black> Name </th> <td> Foo </td>
</tr>
<tr class="selected">
<th> Age </th> <td>24</td>
</tr>
<tr class="unselected">
<th> <u>Height</u> </th> <td> 6' </td>
</tr>
</table>
__W__
{| border="1" cellpadding="3" bgcolor="#ffffff"
|+ Stuff
|- id="first" class="unselected"
! id="thing" bgcolor="black" | Name
| Foo
|- class="selected"
! Age
| 24
|- class="unselected"
! <u>Height</u>
| 6'
|}
__NEXT__
table w/ blocks
__H__
<table>
<tr>
<td align=center>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</td>
</tr>
</table>
__W__
{|
| align="center" |
Paragraph 1
Paragraph 2
|}
__NEXT__
strip empty aname
__H__
<html><a name="thing"></a> some text</html>
__W__
some text
__NEXT__
wiki link (text == title)
__H__
<html><a href="/wiki/Some_wiki_page">Some wiki page</a></html>
__W__
[[Some wiki page]]
__NEXT__
wiki link (text case != title case)
__H__
<html><a href="/wiki/Another_page">another page</a></html>
__W__
[[another page]]
__NEXT__
wiki link (text != title)
__H__
<html><a href="/wiki/Another_page">some text</a></html>
__W__
[[Another page|some text]]
__NEXT__
external links
__H__
<html><a href="http://www.test.com">thing</a></html>
__W__
[http://www.test.com thing]
__NEXT__
external links (rel2abs)
__H__
<html><a href="thing.html">thing</a></html>
__W__
[http://www.test.com/thing.html thing]
__NEXT__
strip urlexpansion
__H__
<html><a href="http://www.google.com">Google</a> <span class=" urlexpansion ">(http://www.google.com)</span></html>
__W__
[http://www.google.com Google]
__NEXT__
strip printfooter
__H__
<html><div class="printfooter">Retrieved from blah blah</div></html>
__W__
__NEXT__
strip catlinks
__H__
<html><div id="catlinks"><p>Categories: ...</p></div></html>
__W__
__NEXT__
strip editsection
__H__
<html>This is <div class="editsection"><a href="?action=edit§ion=1">edit</a></div> great</html>
__W__
This is
great
__NEXT__
escape bracketed urls
__H__
<html><p>This is a text node with what looks like an ext. link [http://example.org].</p></html>
__W__
This is a text node with what looks like an ext. link <nowiki>[http://example.org]</nowiki>.
__NEXT__
line with vertical bar
__H__
<html><p>| a line with a vertical bar</p></html>
__W__
<nowiki>| a line with a vertical bar</nowiki>
__NEXT__
line that starts with a bang
__H__
<html><p>! a line that starts with a bang</p></html>
__W__
<nowiki>! a line that starts with a bang</nowiki>
__NEXT__
line that looks like a section
__H__
<html><p>= a line that looks like a section</p></html>
__W__
<nowiki>= a line that looks like a section</nowiki>
__NEXT__
pre-many (bug #14527)
__H__
<html><pre>preformatted text
with spaces
should produce only one
pre-block</pre></html>
__W__
preformatted text
with spaces
should produce only one
pre-block
__NEXT__
pre following pre
__H__
<html><pre>preformatted text</pre>
<pre>more preformatted text</pre>
<pre>once again</pre></html>
__W__
preformatted text
more preformatted text
once again
__NEXT__
preserve ::preserve_bold(1)
__H__
<b>hello</b>
__W__
<b>hello</b>
__NEXT__
hr under td
__H__
<table><tr><td><hr></td></tr></table>
__W__
{|
|
----
|}
__NEXT__
img alt
__H__
<img src="thing.gif" alt="Just a test" />
__W__
[[Image:thing.gif|Just a test]]
__NEXT__
no preserve templates ::preserve_templates(0)
__H__
{{template}}
__W__
<nowiki>{{template}}</nowiki>
__NEXT__
preserve templates ::preserve_templates(1)
{{template}}
__W__
{{template}}
__NEXT__
no preserve nowiki ::preserve_nowiki(0)
__H__
<nowiki>hey</nowiki>
__W__
hey
__NEXT__
preserve nowiki ::preserve_nowiki(1)
__H__
<nowiki>hey</nowiki>
__W__
<nowiki>hey</nowiki>
__NEXT__
preserve image width
__H__
<img src="thing.jpg" width="200" height="400" alt="The Thing" />
__W__
[[Image:thing.jpg|200px|The Thing]]
__NEXT__
tbody and thead fixes (bug #28402)
__H__
<table border="1">
<colgroup>
<col />
<col />
<col />
</colgroup>
<thead>
<tr>
<th>heading col 1</th>
<th>heading col 2</th>
<th>heading last col</th>
</tr>
</thead>
<tbody>
<tr>
<td>data first col first row</td>
<td>data c2 r1</td>
<td>data c3 r1</td>
</tr>
<tr>
<td>data c1 r2</td>
<td>data c2 r2</td>
<td>data c3 r2</td>
</tr>
<tr>
<td>data c1 r3</td>
<td>data c2 r3</td>
<td>data c3 r3</td>
</tr>
</tbody>
</table>
__W__
{| border="1"
|-
! heading col 1
! heading col 2
! heading last col
|-
| data first col first row
| data c2 r1
| data c3 r1
|-
| data c1 r2
| data c2 r2
| data c3 r2
|-
| data c1 r3
| data c2 r3
| data c3 r3
|}
__NEXT__
don't pad headings ::pad_headings(0)
__H__
<h2>Heading</h2>
__W__
==Heading==
__NEXT__
table with zeros
__H__
<table>
<tr><td>0</td></tr>
<tr><td>1</td></tr>
<tr><td>0</td></tr>
<tr><td>1</td></tr>
</table>
__W__
{|
| 0
|-
| 1
|-
| 0
|-
| 1
|}
__NEXT__
(bug #40845) internal links, without wiki_uri
__H__
<a href='class_browser.html'>Class Browser</a>
__W__
[http://www.test.com/class_browser.html Class Browser]
__NEXT__
(bug #40845) internal links, with wiki_uri=base_uri ::wiki_uri('http://www.test.com/')
__H__
<a href='class_browser.html'>Class Browser</a>
__W__
[[class browser.html|Class Browser]]
__NEXT__
(bug #40845) broken links with anchors, without wiki_uri
__H__
<a href='#Adding'>adding</a>
__W__
[http://www.test.com#Adding adding]
__NEXT__
(bug #40845) links with anchors, with wiki_uri ::wiki_uri('http://www.test.com/') ::TODO('wiki_uri not working with an ending slash')
__H__
<a href='#Adding'>adding</a>
__W__
[[#Adding|adding]]
__NEXT__
(bug #24745) font/span weirdness ::TODO("HTML::WikiConverter::Normalizer doesn't handle this yet");
__H__
<p><span style='font-size:40.0pt; font-family:"ArialNarrow"'>The Test Header</span></p>
__W__
<span style="font-size:40pt; font-family:ArialNarrow">The Test Header</span>
__NEXT__
(bug #29342) Tag attributes with 0 ::TODO("this is actually an H::WC-specific bug")
__H__
<table cellspacing="0" cellpadding="3" border="1">
<tr><td>Hello</td><td>World</td></tr>
</table>
__W__
{| border="1" cellpadding="3" cellspacing="0"
| Hello
| World
|}
|