Edgewall Software

Ticket #5647: ticket-5647-r7601.patch

File ticket-5647-r7601.patch, 1.2 KB (added by ebray, 4 years ago)

Updated patch for latest trunk with slightly more flexible RE. Also removed a seemingly superfulous unicode() call.

  • trac/wiki/formatter.py

     
    6161class WikiProcessor(object): 
    6262 
    6363    _code_block_re = re.compile('^<div(?:\s+class="([^"]+)")?>(.*)</div>$') 
     64    _block_elem_re = re.compile(r'^\s*<(?:div|table)(?:\s+[^>]+)?>', 
     65                                re.I | re.M) 
    6466 
    6567    def __init__(self, formatter, name, args={}): 
    6668        """Find the processor by name 
     
    206208                    interrupt_paragraph = True 
    207209            else: 
    208210                text = to_unicode(text) 
    209                 match = re.match(self._code_block_re, unicode(text)) 
     211                match = re.match(self._code_block_re, text) 
    210212                if match: 
    211213                    if match.group(1) and 'code' in match.group(1): 
    212214                        content_for_span = match.group(2) 
    213215                    else: 
    214216                        interrupt_paragraph = True 
    215                 elif text.startswith('<table'): 
     217                elif re.match(self._block_elem_re, text): 
    216218                    interrupt_paragraph = True 
    217219            if content_for_span: 
    218220                text = tag.span(class_='code-block')(*content_for_span)