Edgewall Software

Ticket #582: indented-tables.diff

File indented-tables.diff, 2.5 KB (added by athomas, 3 years ago)

Patch against r3234 with minor fix for paragraph breaks

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

     
    730730out: 
    731731|| RPC# || parameter len || ..... parameter ..... || 
    732732---- 
    733 ============================== 
     733============================== Indented tables, multiple columns 
     734|| a || b || 
     735  || a || b || 
     736    || a || b || 
     737------------------------------ 
     738<table class="wiki"> 
     739<tr><td> a </td><td> b  
     740</td></tr></table> 
     741<blockquote> 
     742<table class="wiki"> 
     743<tr><td> a </td><td> b  
     744</td></tr></table> 
     745</blockquote> 
     746<blockquote> 
     747<blockquote> 
     748<table class="wiki"> 
     749<tr><td> a </td><td> b  
     750</td></tr></table> 
     751</blockquote> 
     752</blockquote> 
     753------------------------------ 
     754|| a || b || 
     755  || a || b || 
     756    || a || b || 
    734757============================== General Wiki syntax, mix of headings and lists 
    735758= Heading 1 = 
    736759Paragraph 
  • trac/wiki/formatter.py

     
    531531    # Blockquote 
    532532 
    533533    def close_indentation(self): 
     534        self.close_table() 
    534535        self.out.write(('</blockquote>' + os.linesep) * self.indent_level) 
    535536        self.indent_level = 0 
    536537 
     
    539540            return 
    540541        diff = depth - self.indent_level 
    541542        if diff != 0: 
     543            self.close_table() 
    542544            self.close_paragraph() 
    543545            self.close_indentation() 
    544546            self.close_list() 
     
    571573    def open_table(self): 
    572574        if not self.in_table: 
    573575            self.close_paragraph() 
    574             self.close_indentation() 
    575576            self.close_list() 
    576577            self.close_def_list() 
    577578            self.in_table = 1 
     
    683684            # Handle new paragraph 
    684685            elif line == '': 
    685686                self.close_paragraph() 
    686                 self.close_indentation() 
     687                if not self.in_table: 
     688                    self.close_indentation() 
    687689                self.close_list() 
    688690                self.close_def_list() 
    689691                continue 
     
    700702            if self.in_def_list and not line.startswith(' '): 
    701703                self.close_def_list() 
    702704 
    703             if self.in_table and line[0:2] != '||': 
     705            if self.in_table and line.strip()[0:2] != '||': 
    704706                self.close_table() 
    705707 
    706708            if len(result) and not self.in_list_item and not self.in_def_list \