Edgewall Software

Ticket #1153: shref_fixes_r2399.patch

File shref_fixes_r2399.patch, 3.8 kB (added by cboos, 3 years ago)

Combining fixes for this ticket and the related #2240

  • trac/wiki/tests/wiki-tests.txt

     
    103103============================== 
    104104Add-on to changeset:123: 
    105105Some change. 
    106  
    107106ticket:1 
    108107This ticket is the first one 
     108changeset:123> 
    109109------------------------------ 
    110110<p> 
    111111Add-on to <a class="missing changeset" href="/changeset/123" rel="nofollow">changeset:123</a>: 
    112112Some change. 
    113 </p> 
    114 <p> 
    115113<a class="missing ticket" href="/ticket/1" rel="nofollow">ticket:1</a> 
    116114This ticket is the first one 
     115<a class="missing changeset" href="/changeset/123" rel="nofollow">changeset:123</a>&gt; 
    117116</p> 
    118117------------------------------ 
    119118Add-on to <a class="missing changeset" href="/changeset/123" rel="nofollow">changeset:123</a>: 
    120119Some change. 
    121  
    122120<a class="missing ticket" href="/ticket/1" rel="nofollow">ticket:1</a> 
    123121This ticket is the first one 
     122<a class="missing changeset" href="/changeset/123" rel="nofollow">changeset:123</a>&gt; 
    124123============================== 
    125124CamelCase AlabamA ABc AlaBamA FooBar 
    126125------------------------------ 
     
    357356</p> 
    358357------------------------------ 
    359358============================== 
     359Test:[[BR]] There should be a line break 
     360 
     361Change:[10] There should be a link to changeset [10] 
     362 
     363Other test:'''bold text''' is not bold 
     364------------------------------ 
     365<p> 
     366Test:<br /> There should be a line break 
     367</p> 
     368<p> 
     369Change:<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> 
     370</p> 
     371<p> 
     372Other test:<strong>bold text</strong> is not bold 
     373</p> 
     374------------------------------ 
     375Test:  There should be a line break 
     376 
     377Change:<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> 
     378 
     379Other test:<strong>bold text</strong> is not bold 
     380============================== 
    360381{{{ 
    361382Preformatted text. 
    362383}}} 
  • trac/wiki/tests/formatter.py

     
    8383        try: 
    8484            self.assertEquals(self.correct, v) 
    8585        except AssertionError, e: 
    86             raise AssertionError('%s\n\%s:%s: for the input ' 
     86            raise AssertionError('%s\n%s:%s: for the input ' 
    8787                                 '(formatter flavor was "%s")' \ 
    8888                                 % (str(e), self.file, self.line, 
    8989                                    formatter.flavor)) 
  • trac/wiki/formatter.py

     
    137137 
    138138    QUOTED_STRING = r"'[^']+'|\"[^\"]+\"" 
    139139 
    140     SHREF_TARGET_MIDDLE = r"(?:\|(?=[^|\s])|&(?!lt;)|[^|&\s])" 
    141     SHREF_TARGET_LAST_CHAR = r"[^|'~_\.,&\s\)\]:?!]" 
     140    SHREF_TARGET_FIRST = r"[\w/?!#@]" 
     141    SHREF_TARGET_MIDDLE = r"(?:\|(?=[^|\s])|&(?!lt;|gt;)|[^|&\s])" 
     142    SHREF_TARGET_LAST = r"[a-zA-Z0-9/=]" # we don't want "_" 
    142143 
    143144    LHREF_RELATIVE_TARGET = r"[/.][^\s[\]]*" 
    144145 
     
    163164 
    164165    _post_rules = [ 
    165166        # shref corresponds to short TracLinks, i.e. sns:stgt 
    166         r"(?P<shref>((?P<sns>%s):(?P<stgt>%s|%s*%s)))" \ 
     167        r"(?P<shref>((?P<sns>%s):(?P<stgt>%s|%s(?:%s*%s)?)))" \ 
    167168        % (LINK_SCHEME, QUOTED_STRING, 
    168            SHREF_TARGET_MIDDLE, SHREF_TARGET_LAST_CHAR), 
     169           SHREF_TARGET_FIRST, SHREF_TARGET_MIDDLE, SHREF_TARGET_LAST), 
    169170        # lhref corresponds to long TracLinks, i.e. [lns:ltgt label?] 
    170171        r"(?P<lhref>\[(?:(?P<lns>%s):(?P<ltgt>%s|[^\]\s]*)|(?P<rel>%s))" 
    171172        r"(?:\s+(?P<label>%s|[^\]]+))?\])" \