Ticket #2172: oneliner_fixes_and_tests.patch
| File oneliner_fixes_and_tests.patch, 21.5 kB (added by cboos, 3 years ago) |
|---|
-
trac/wiki/tests/wiki-tests.txt
13 13 </li></ul></li></ul><p> 14 14 Another paragraph 15 15 </p> 16 ------------------------------ 17 = Heading 1 = 18 Paragraph 19 * Item 1 20 * Item 2 21 Another paragraph 16 22 ============================== 17 23 Paragraph 18 24 ---- … … 35 41 <p> 36 42 <a class="ext-link" href="http://www.edgewall.com/"><span class="icon"></span>http://www.edgewall.com/</a> 37 43 </p> 44 ------------------------------ 45 Paragraph 46 ---- 47 1. Item 1 48 2. Item 2 49 ||Table||cell|| 50 ||Foo||Bar||Baz|| 51 <a class="ext-link" href="http://www.edgewall.com/"><span class="icon"></span>http://www.edgewall.com/</a> 38 52 ============================== 39 53 #1, [1], r1, {1} 40 54 ------------------------------ 41 55 <p> 42 56 <a class="missing ticket" href="/ticket/1" rel="nofollow">#1</a>, <a class="missing changeset" href="/changeset/1" rel="nofollow">[1]</a>, <a class="missing changeset" href="/changeset/1" rel="nofollow">r1</a>, <a class="report" href="/report/1">{1}</a> 43 57 </p> 58 ------------------------------ 44 59 ============================== 45 60 !#1, ![1], !r1, !{1} 46 61 ------------------------------ 47 62 <p> 48 63 #1, [1], r1, {1} 49 64 </p> 65 ------------------------------ 66 #1, [1], r1, {1} 50 67 ============================== 51 68 [1:2], r1:2, [12:23], r12:23 52 69 ------------------------------ 53 70 <p> 54 71 <a class="source" href="/log/?rev=2&stop_rev=1">[1:2]</a>, <a class="source" href="/log/?rev=2&stop_rev=1">r1:2</a>, <a class="source" href="/log/?rev=23&stop_rev=12">[12:23]</a>, <a class="source" href="/log/?rev=23&stop_rev=12">r12:23</a> 55 72 </p> 73 ------------------------------ 56 74 ============================== 57 75 ![1:2], !r1:2, ![12:23], !r12:23 58 76 ------------------------------ 59 77 <p> 60 78 [1:2], r1:2, [12:23], r12:23 61 79 </p> 80 ------------------------------ 81 [1:2], r1:2, [12:23], r12:23 62 82 ============================== 63 83 ticket:1, changeset:1, report:1, source:foo/bar 64 84 … … 70 90 <p> 71 91 Issue <a class="missing ticket" href="/ticket/1" rel="nofollow">1</a>, CS<a class="missing changeset" href="/changeset/1" rel="nofollow">1</a>, Listing <a class="report" href="/report/1">1</a>, File <a class="source" href="/browser/foo/bar">foo/bar</a> 72 92 </p> 93 ------------------------------ 73 94 ============================== 95 Add-on to changeset:123: 96 Some change. 97 98 ticket:1 99 This ticket is the first one 100 ------------------------------ 101 <p> 102 Add-on to <a class="missing changeset" href="/changeset/123" rel="nofollow">changeset:123</a>: 103 Some change. 104 </p> 105 <p> 106 <a class="missing ticket" href="/ticket/1" rel="nofollow">ticket:1</a> 107 This ticket is the first one 108 </p> 109 ------------------------------ 110 Add-on to <a class="missing changeset" href="/changeset/123" rel="nofollow">changeset:123</a>: 111 Some change. 112 113 <a class="missing ticket" href="/ticket/1" rel="nofollow">ticket:1</a> 114 This ticket is the first one 115 ============================== 74 116 [ticket:1 ticket 1], [changeset:1 changeset 1], [report:1 report 1], 75 117 [source:foo/bar source foo/bar], [http://www.edgewall.com/ edgewall] 76 118 ------------------------------ … … 78 120 <a class="missing ticket" href="/ticket/1" rel="nofollow">ticket 1</a>, <a class="missing changeset" href="/changeset/1" rel="nofollow">changeset 1</a>, <a class="report" href="/report/1">report 1</a>, 79 121 <a class="source" href="/browser/foo/bar">source foo/bar</a>, <a class="ext-link" href="http://www.edgewall.com/"><span class="icon"></span>edgewall</a> 80 122 </p> 123 ------------------------------ 81 124 ============================== 82 125 CamelCase AlabamA ABc AlaBamA FooBar 83 126 ------------------------------ 84 127 <p> 85 128 <a class="missing wiki" href="/wiki/CamelCase" rel="nofollow">CamelCase?</a> AlabamA ABc AlaBamA <a class="missing wiki" href="/wiki/FooBar" rel="nofollow">FooBar?</a> 86 129 </p> 130 ------------------------------ 87 131 ============================== 88 132 CamelCase,CamelCase.CamelCase:CamelCase 89 133 ------------------------------ 90 134 <p> 91 135 <a class="missing wiki" href="/wiki/CamelCase" rel="nofollow">CamelCase?</a>,<a class="missing wiki" href="/wiki/CamelCase" rel="nofollow">CamelCase?</a>.CamelCase:CamelCase 92 136 </p> 137 ------------------------------ 93 138 ============================== 94 139 !CamelCase 95 140 ------------------------------ 96 141 <p> 97 142 CamelCase 98 143 </p> 144 ------------------------------ 99 145 ============================== 100 146 <bug>http://localhost/bugzilla/show_bug.cgi?id=1284</bug> 804 101 147 ------------------------------ 102 148 <p> 103 149 <bug><a class="ext-link" href="http://localhost/bugzilla/show_bug.cgi?id=1284"><span class="icon"></span>http://localhost/bugzilla/show_bug.cgi?id=1284</a></bug> 804 104 150 </p> 151 ------------------------------ 105 152 ============================== 106 153 ||http://example.com/img.png||text|| 107 154 ------------------------------ 108 155 <table class="wiki"> 109 156 <tr><td><img src="http://example.com/img.png" alt="http://example.com/img.png" /></td><td>text 110 157 </td></tr></table> 158 ------------------------------ 159 ||<a class="ext-link" href="http://example.com/img.png"><span class="icon"></span>http://example.com/img.png</a>||text|| 111 160 ============================== 112 161 http://example.com/img.png?foo=bar 113 162 ------------------------------ 114 163 <p> 115 164 <img src="http://example.com/img.png?foo=bar" alt="http://example.com/img.png?foo=bar" /> 116 165 </p> 166 ------------------------------ 167 <a class="ext-link" href="http://example.com/img.png?foo=bar"><span class="icon"></span>http://example.com/img.png?foo=bar</a> 117 168 ============================== 118 169 in: 119 170 || RPC# || parameter len || ..... parameter ..... || … … 134 185 <tr><td> RPC# </td><td> parameter len </td><td> ..... parameter ..... 135 186 </td></tr></table> 136 187 <hr /> 188 ------------------------------ 189 in: 190 || RPC# || parameter len || ..... parameter ..... || 191 out: 192 || RPC# || parameter len || ..... parameter ..... || 193 ---- 137 194 ============================== 138 195 ''RFCs von ftp://ftp.rfc-editor.org/in-notes/rfcXXXX.txt'' 139 196 ------------------------------ 140 197 <p> 141 198 <i>RFCs von <a class="ext-link" href="ftp://ftp.rfc-editor.org/in-notes/rfcXXXX.txt"><span class="icon"></span>ftp://ftp.rfc-editor.org/in-notes/rfcXXXX.txt</a></i> 142 199 </p> 200 ------------------------------ 143 201 ============================== 144 202 [wiki:WikiStart Foo] [http://www.edgewall.com/ Edgewall] 145 203 … … 161 219 <p> 162 220 <a class="missing wiki" href="/wiki/Argv" rel="nofollow">*argv[] versus **argv?</a> 163 221 </p> 222 ------------------------------ 164 223 ============================== 165 224 foo (FooBar) 166 225 … … 172 231 <p> 173 232 foo (<a class="missing wiki" href="/wiki/FooBar" rel="nofollow">FooBar?</a> ) 174 233 </p> 234 ------------------------------ 175 235 ============================== 176 236 == Heading with trailing white-space == 177 237 ------------------------------ 178 238 <h2 id="Headingwithtrailingwhitespace">Heading with trailing white-space</h2> 239 ------------------------------ 240 == Heading with trailing white-space == 179 241 ============================== 180 242 == ''Formatted'' ~~Heading~~ == 181 243 ------------------------------ 182 244 <h2 id="FormattedHeading"><i>Formatted</i> <del>Heading</del></h2> 245 ------------------------------ 246 == ''Formatted'' ~~Heading~~ == 183 247 ============================== 184 248 == [wiki:SandBox Linked Heading] == 185 249 ------------------------------ 186 250 <h2 id="LinkedHeading"><a class="missing wiki" href="/wiki/SandBox" rel="nofollow">Linked Heading?</a></h2> 251 ------------------------------ 252 == [wiki:SandBox Linked Heading] == 187 253 ============================== 188 254 A0B1, ST62T53C6, IR32V1H000 189 255 ------------------------------ 190 256 <p> 191 257 A0B1, ST62T53C6, IR32V1H000 192 258 </p> 259 ------------------------------ 193 260 ============================== 194 261 Paragraph 195 262 * foo bar … … 212 279 </li></ul><p> 213 280 Paragraph 214 281 </p> 282 ------------------------------ 283 Paragraph 284 * foo bar 285 boo baz 286 * Subitem 287 Subitem line 2 288 * item 2 289 item 2 line 2 290 Paragraph 215 291 ============================== 216 292 '''ticket:1''', ''ticket:1'', ~~ticket:1~~, __ticket:1__ 217 293 ------------------------------ 218 294 <p> 219 295 <strong><a class="missing ticket" href="/ticket/1" rel="nofollow">ticket:1</a></strong>, <i><a class="missing ticket" href="/ticket/1" rel="nofollow">ticket:1</a></i>, <del><a class="missing ticket" href="/ticket/1" rel="nofollow">ticket:1</a></del>, <span class="underline"><a class="missing ticket" href="/ticket/1" rel="nofollow">ticket:1</a></span> 220 296 </p> 297 ------------------------------ 221 298 ============================== 222 299 SandBox SandBox, SandBox; SandBox: SandBox. SandBox? SandBox! (SandBox) {SandBox} [SandBox] 223 300 ------------------------------ 224 301 <p> 225 302 <a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a> <a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>, <a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>; <a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>: <a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>. <a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>? <a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>! (<a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>) {<a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>} [<a class="missing wiki" href="/wiki/SandBox" rel="nofollow">SandBox?</a>] 226 303 </p> 304 ------------------------------ 227 305 ============================== 228 306 source:/foo/bar 229 307 source:/foo/bar#42 … … 250 328 <a class="source" href="/browser/foo/bar?rev=42#L20">source:/foo/bar@42#L20</a> 251 329 <a class="source" href="/browser/foo/bar?rev=head#L20">source:/foo/bar@head#L20</a> 252 330 </p> 331 ------------------------------ 253 332 ============================== 254 333 query:?order=priority 255 334 … … 276 355 <p> 277 356 <a class="query" href="/query?milestone=1.0&milestone=2.0&owner=me&order=priority">query:milestone=1.0|2.0&owner=me</a> 278 357 </p> 358 ------------------------------ 279 359 ============================== 280 360 {{{ 281 361 Preformatted text. … … 283 363 ------------------------------ 284 364 <pre class="wiki">Preformatted text. 285 365 </pre> 366 ------------------------------ 367 {{{ 368 Preformatted text. 369 }}} 286 370 ============================== 287 371 {{{ 288 372 #!default … … 291 375 ------------------------------ 292 376 <pre class="wiki">Preformatted text. 293 377 </pre> 378 ------------------------------ 379 {{{ 380 #!default 381 Preformatted text. 382 }}} 294 383 ============================== 295 384 {{{ 296 385 #!/bin/sh … … 300 389 <pre class="wiki">#!/bin/sh 301 390 echo "foo" 302 391 </pre> 392 ------------------------------ 393 {{{ 394 #!/bin/sh 395 echo "foo" 396 }}} 303 397 ============================== 304 398 {{{ 305 399 #!html … … 307 401 }}} 308 402 ------------------------------ 309 403 <p>Hello World</p> 404 ------------------------------ 405 {{{ 406 #!html 407 <p>Hello World</p> 408 }}} 310 409 ============================== 311 410 {{{ 312 411 #!html … … 318 417 <pre><script>alert("");</script> 319 418 </pre> 320 419 </div> 420 ------------------------------ 421 {{{ 422 #!html 423 <script>alert("");</script> 424 }}} 321 425 ============================== 322 426 {{{ 323 427 #!html … … 329 433 <pre><div onclick="alert('')">Click me</div> 330 434 </pre> 331 435 </div> 436 ------------------------------ 437 {{{ 438 #!html 439 <div onclick="alert(<i>)">Click me</div> 440 }}}</i> 332 441 ============================== 333 442 ^superscript^, ,,subscript,,, normal. 334 443 ------------------------------ 335 444 <p> 336 445 <sup>superscript</sup>, <sub>subscript</sub>, normal. 337 446 </p> 447 ------------------------------ 448 <sup>superscript</sup>, <sub>subscript</sub>, normal. 338 449 ============================== 339 450 [[HelloWorld(hej hopp)]] 340 451 ------------------------------ 341 452 <p> 342 453 Hello World, args = hej hopp 343 454 </p> 455 ------------------------------ 456 [[HelloWorld(hej hopp)]] 344 457 ============================== 345 458 [[HelloWorld(hej hopp) ]] # This shouldnt executed as macro since it contain whitespace between ) and ] 346 459 ------------------------------ 347 460 <p> 348 461 [[HelloWorld(hej hopp) ]] # This shouldnt executed as macro since it contain whitespace between ) and ] 349 462 </p> 463 ------------------------------ 464 [[HelloWorld(hej hopp) ]] # This shouldnt executed as macro since it contain whitespace between ) and ] 350 465 ============================== 351 466 [[HelloWorld(hej hopp))]] # Extra right brace and still executed 352 467 ------------------------------ 353 468 <p> 354 469 Hello World, args = hej hopp) # Extra right brace and still executed 355 470 </p> 471 ------------------------------ 472 [[HelloWorld(hej hopp))]] # Extra right brace and still executed 356 473 ============================== 357 474 [[HelloWorld(hej hopp)]] [[HelloWorld(hej hopp2)]] # Test non greedy match 358 475 ------------------------------ 359 476 <p> 360 477 Hello World, args = hej hopp Hello World, args = hej hopp2 # Test non greedy match 361 478 </p> 479 ------------------------------ 480 [[HelloWorld(hej hopp)]] [[HelloWorld(hej hopp2)]] # Test non greedy match 362 481 ============================== 363 482 Inline [[html(<B> Test </B>)]] text 364 483 ------------------------------ 365 484 <p> 366 485 Inline <B> Test </B> text 367 486 </p> 487 ------------------------------ 488 Inline [[html(<B> Test </B>)]] text 368 489 ============================== 369 490 Test comment blocks 370 491 {{{ … … 375 496 <p> 376 497 Test comment blocks 377 498 </p> 499 ------------------------------ 500 Test comment blocks 501 {{{ 502 #!comment 503 This is simply removed from the output 504 }}} 378 505 ============================== 379 506 Inline [[comment(This should not be seen)]] comment 380 507 ------------------------------ 381 508 <p> 382 509 Inline comment 383 510 </p> 511 ------------------------------ 512 Inline [[comment(This should not be seen)]] comment 384 513 ============================== 385 514 This should be '''''bold and italic''''' 386 515 ------------------------------ 387 516 <p> 388 517 This should be <strong><i>bold and italic</i></strong> 389 518 </p> 519 ------------------------------ 390 520 ============================== 391 521 '''''one''''', '''''two''''', '''''three''''', '''''four''''' 392 522 ------------------------------ 393 523 <p> 394 524 <strong><i>one</i></strong>, <strong><i>two</i></strong>, <strong><i>three</i></strong>, <strong><i>four</i></strong> 395 525 </p> 526 ------------------------------ 396 527 ============================== 397 528 __~~underlineoversrike~~__ 398 529 ------------------------------ 399 530 <p> 400 531 <span class="underline"><del>underlineoversrike</del></span> 401 532 </p> 533 ------------------------------ 402 534 ============================== 403 535 __~~overlapping__tags~~ 404 536 ------------------------------ 405 537 <p> 406 538 <span class="underline"><del>overlapping</del></span><del>tags</del> 407 539 </p> 540 ------------------------------ 408 541 ============================== 409 542 __~~outoforderclosetags__~~ 410 543 ------------------------------ 411 544 <p> 412 545 <span class="underline"><del>outoforderclosetags</del></span><del></del> 413 546 </p> 547 ------------------------------ 414 548 ============================== 415 549 '''''bolditalic''' # Open italic should be closed before paragraph end 416 550 ------------------------------ 417 551 <p> 418 552 <strong><i>bolditalic</i></strong><i> # Open italic should be closed before paragraph end 419 553 </i></p> 554 ------------------------------ 420 555 ============================== 421 556 ''italic'''''bold''' 422 557 ------------------------------ 423 558 <p> 424 559 <i>italic</i><strong>bold</strong> 425 560 </p> 561 ------------------------------ 426 562 ============================== 427 563 '''bold'''''italic'' 428 564 ------------------------------ 429 565 <p> 430 566 <strong>bold</strong><i>italic</i> 431 567 </p> 568 ------------------------------ 432 569 ============================== 433 570 '''''bold 434 571 italic … … 439 576 italic 440 577 multiline</i></strong> 441 578 </p> 579 ------------------------------ 442 580 ============================== 443 581 '''''bold 444 582 italic … … 451 589 multiline 452 590 without endtags 453 591 </i></strong></p> 592 ------------------------------ 454 593 ============================== 455 594 term:: definition 456 595 ------------------------------ 457 596 <dl><dt>term</dt><dd>definition 458 597 </dd></dl> 598 ------------------------------ 599 term:: definition 459 600 ============================== 460 601 complex topic:: multiline 461 602 ''formatted'' … … 465 606 <i>formatted</i> 466 607 definition 467 608 </dd></dl> 609 ------------------------------ 610 complex topic:: multiline 611 <i>formatted</i> 612 definition 468 613 ============================== 469 614 milestone:foo 470 615 [milestone:boo Milestone Boo] … … 473 618 <a class="milestone" href="/milestone/foo">milestone:foo</a> 474 619 <a class="milestone" href="/milestone/boo">Milestone Boo</a> 475 620 </p> 621 ------------------------------ 476 622 ============================== 477 623 search:foo 478 624 search:"foo bar" … … 487 633 <a class="search" href="/search?q=bar">bar</a> 488 634 <a class="search" href="/search?q=">search</a> 489 635 </p> 636 ------------------------------ 490 637 ============================== 491 638 search:?q=foo&wiki=on 492 639 search:"?q=foo bar&wiki=on" … … 497 644 <a class="search" href="/search?q=foo+bar&wiki=on">search:"?q=foo bar&wiki=on"</a> 498 645 <a class="search" href="/search?q=bar&ticket=on">Bar in Tickets</a> 499 646 </p> 647 ------------------------------ 500 648 ============================== 501 649 '''Note:''' 502 650 ------------------------------ 503 651 <p> 504 652 <strong>Note:</strong> 505 653 </p> 654 ------------------------------ 655 <strong>Note:</strong> 506 656 ============================== 507 657 ticket:1 508 658 ticket:12 … … 525 675 <a class="missing ticket" href="/ticket/12" rel="nofollow">ticket:"12"</a> 526 676 <a class="missing ticket" href="/ticket/123" rel="nofollow">ticket:"123"</a> 527 677 </p> 678 ------------------------------ 528 679 ============================== 529 680 Relative links are supported: 530 681 [../parent See above] … … 539 690 <img src="/images/logo.png" alt="Our logo" /> 540 691 <a href="/">/</a> 541 692 </p> 693 ------------------------------ 542 694 ============================== 543 695 source:'even with whitespaces' 544 696 source:"even with whitespaces" … … 551 703 <a class="source" href="/browser/even%20with%20whitespaces">Path with spaces</a> 552 704 <a class="source" href="/browser/even%20with%20whitespaces">Path with spaces</a> 553 705 </p> 706 ------------------------------ 554 707 ============================== 555 708 svn+ssh://secureserver.org 556 709 [svn+ssh://secureserver.org SVN link] … … 563 716 <a class="ext-link" href="rfc-2396.compatible://link"><span class="icon"></span>rfc-2396.compatible://link</a> 564 717 <a class="ext-link" href="rfc-2396.compatible://link"><span class="icon"></span>RFC 2396</a> 565 718 </p> 719 ------------------------------ 566 720 ============================== 567 721 = ça marche! = 568 722 ------------------------------ 569 723 <h1 id="çamarche">ça marche!</h1> 724 ------------------------------ 725 = ça marche! = 570 726 ============================== 571 727 = "Test" = 572 728 ------------------------------ 573 729 <h1 id="Test">"Test"</h1> 730 ------------------------------ 731 = "Test" = 574 732 ============================== 575 733 = Foo <Bar> Baz = 576 734 ------------------------------ 577 735 <h1 id="FooltBargtBaz">Foo <Bar> Baz</h1> 736 ------------------------------ 737 = Foo <Bar> Baz = 578 738 ============================== 579 739 !__foo!__ 580 740 !~~bar!~~ … … 587 747 ,,boo,, 588 748 ^baz^ 589 749 </p> 750 ------------------------------ 590 751 ============================== 591 752 /absolute/path/is/NotWiki and relative/path/is/NotWiki 592 753 /ThisIsNotWikiEither and /ThisIs/NotWikiEither but ThisIs/SubWiki … … 595 756 /absolute/path/is/NotWiki and relative/path/is/NotWiki 596 757 /ThisIsNotWikiEither and /ThisIs/NotWikiEither but <a class="missing wiki" href="/wiki/ThisIs/SubWiki" rel="nofollow">ThisIs/SubWiki?</a> 597 758 </p> 759 ------------------------------ 598 760 ============================== 599 761 8FjBpOmy 600 762 anotherWikiPageName … … 603 765 8FjBpOmy 604 766 anotherWikiPageName 605 767 </p> 768 ------------------------------ 769 8FjBpOmy 770 anotherWikiPageName 606 771 ============================== 607 772 || a || 608 773 || b || … … 611 776 <tr><td> a 612 777 </td></tr><tr><td> b 613 778 </td></tr></table> 779 ------------------------------ 780 || a || 781 || b || -
trac/wiki/tests/formatter.py
5 5 import unittest 6 6 7 7 from trac.core import * 8 from trac.wiki.formatter import Formatter 8 from trac.wiki.formatter import Formatter, OneLinerFormatter 9 9 from trac.wiki.api import IWikiMacroProvider 10 10 11 11 … … 73 73 import trac.Search 74 74 75 75 env = DummyEnvironment() 76 76 77 out = StringIO.StringIO() 77 Formatter(env).format(self.input, out)78 self.format(env, out) 78 79 v = out.getvalue().replace('\r','') 79 80 self.assertEquals(self.correct, v) 80 81 82 def format(self, env, out): 83 Formatter(env).format(self.input, out) 84 85 86 class OneLinerTestCase(WikiTestCase): 87 def format(self, env, out): 88 OneLinerFormatter(env).format(self.input, out) 89 90 81 91 def suite(): 82 92 suite = unittest.TestSuite() 83 93 data = open(os.path.join(os.path.split(__file__)[0], 84 94 'wiki-tests.txt'), 'r').read() 85 95 tests = data.split('=' * 30 + '\n') 86 96 for test in tests: 87 input, correct = test.split('-' * 30 + '\n') 88 suite.addTest(WikiTestCase(input, correct)) 97 input, page, oneliner = test.split('-' * 30 + '\n') 98 suite.addTest(WikiTestCase(input, page)) 99 if oneliner: 100 suite.addTest(OneLinerTestCase(input, oneliner[:-1])) 89 101 return suite 90 102 91 103 if __name__ == '__main__': -
trac/wiki/formatter.py
149 149 r"(?P<htmlescapeentity>!?&#\d+;)"] 150 150 _post_rules = [(r"(?P<shref>!?((?P<sns>%s):" % LINK_SCHEME + 151 151 r"(?P<stgt>'[^']+'|\"[^\"]+\"|" 152 r"(?:\|(?=[^| ])|&(?!lt;)|[^|& ])*[^|'~_\.,& \)])))"), 152 r"(?:\|(?=[^|\s])|&(?!lt;)|" 153 r"[^|&\s])*[^|'~_\.,&\s\)\]:])))"), 153 154 (r"(?P<lhref>!?\[(?:(?P<lns>%s):" % LINK_SCHEME + 154 r"(?P<ltgt>'[^']+'|\"[^\"]+\"|[^\] ]*)"155 r"|(?P<rel>[/.][^ [\]]*))"156 r"(?: (?P<label>'[^']+'|\"[^\"]+\"|[^\]]+))?\])"),155 r"(?P<ltgt>'[^']+'|\"[^\"]+\"|[^\]\s]*)" 156 r"|(?P<rel>[/.][^\s[\]]*))" 157 r"(?:\s+(?P<label>'[^']+'|\"[^\"]+\"|[^\]]+))?\])"), 157 158 (r"(?P<macro>!?\[\[(?P<macroname>[\w/+-]+)" 158 159 r"(\]\]|\((?P<macroargs>.*?)\)\]\]))"), 159 160 r"(?P<heading>^\s*(?P<hdepth>=+)\s.*\s(?P=hdepth)\s*$)",
