Ticket #2240: escape_shref.2.patch
| File escape_shref.2.patch, 3.0 KB (added by cboos, 3 years ago) |
|---|
-
trac/wiki/tests/wiki-tests.txt
564 564 <a class="ext-link" href="rfc-2396.compatible://link"><span class="icon"></span>RFC 2396</a> 565 565 </p> 566 566 ============================== 567 Test:[[BR]] There should be a line break 568 569 !Change:[10] There should be a link to changeset [10] 570 571 Other !test:'''bold text''' is not bold 572 ------------------------------ 573 <p> 574 Test:<br /> There should be a line break 575 </p> 576 <p> 577 Change:<a class="missing changeset" href="/changeset/10" rel="nofollow">[10]</a> There should be a link to changeset <a class="missing changeset" href="/changeset/10" rel="nofollow">[10]</a> 578 </p> 579 <p> 580 Other test:<strong>bold text</strong> is not bold 581 </p> 582 ============================== 583 ![Test:[[BR]] There should be a line break] 584 585 ![Change:[10] There should be a link to changeset [10]] 586 587 Other ![test:'''bold text''' is not bold] 588 ------------------------------ 589 <p> 590 [Test:<br /> There should be a line break] 591 </p> 592 <p> 593 [Change:<a class="missing changeset" href="/changeset/10" rel="nofollow">[10]</a> There should be a link to changeset <a class="missing changeset" href="/changeset/10" rel="nofollow">[10]</a>] 594 </p> 595 <p> 596 Other [test:<strong>bold text</strong> is not bold] 597 </p> 598 ============================== 567 599 = ça marche! = 568 600 ------------------------------ 569 601 <h1 id="çamarche">ça marche!</h1> -
trac/wiki/formatter.py
147 147 r"(?P<inlinecode2>!?%s(?P<inline2>.*?)%s)" % (INLINE_TOKEN, 148 148 INLINE_TOKEN), 149 149 r"(?P<htmlescapeentity>!?&#\d+;)"] 150 _post_rules = [(r"(?P<shref>!?((?P<sns>%s):" % LINK_SCHEME + 150 _post_rules = [(r"(?P<escapehref>!\[?%s:|%s:\[\[(?:br|BR)\]\])" \ 151 % (LINK_SCHEME, LINK_SCHEME)), 152 (r"(?P<shref>(?P<sns>%s):" % LINK_SCHEME + 151 153 r"(?P<stgt>'[^']+'|\"[^\"]+\"|" 152 r"(?:\|(?=[^| ])|&(?!lt;)|[^|& ])*[^|'~_\.,& \)])) )"),153 (r"(?P<lhref> !?\[(?:(?P<lns>%s):" % LINK_SCHEME +154 r"(?:\|(?=[^| ])|&(?!lt;)|[^|& ])*[^|'~_\.,& \)]))"), 155 (r"(?P<lhref>\[(?:(?P<lns>%s):" % LINK_SCHEME + 154 156 r"(?P<ltgt>'[^']+'|\"[^\"]+\"|[^\] ]*)" 155 157 r"|(?P<rel>[/.][^ [\]]*))" 156 158 r"(?: (?P<label>'[^']+'|\"[^\"]+\"|[^\]]+))?\])"), … … 247 249 self.open_tag(*italic) 248 250 return tmp 249 251 252 def _escapehref_formatter(self, match, fullmatch): 253 return match[0] == '!' and match[1:] or '%s<br />' % match[:-6] 254 250 255 def _shref_formatter(self, match, fullmatch): 251 256 ns = fullmatch.group('sns') 252 257 target = fullmatch.group('stgt')
