Ticket #3: macro.patch

File macro.patch, 1.4 kB (added by fimion, 4 years ago)

a patch for macro.py

  • old/macro.py

    old new  
    105105            wiki_page = WikiPage(self.env, 'templates/' + name) 
    106106            html = wiki_page.text 
    107107#           args = util.escape(args) 
    108              
     108 
     109            #################### 
     110            # BEGIN FIMII EDIT # 
     111            #################### 
     112            strip_p = False 
     113            strip_n = False 
     114            # Check for {{!p}} and {{!n}} 
     115            while (html.find('{{!p}}',0,6) != -1 or html.find('{{!n}}',0,6) != -1): 
     116                if (html.find('{{!p}}',0,6) != -1): 
     117                    html = html.replace('{{!p}}','') 
     118                    strip_p = True 
     119                if (html.find('{{!n}}',0,6) != -1): 
     120                    html = html.replace('{{!n}}','') 
     121                    strip_n = True 
     122            ################## 
     123            # END FIMII EDIT # 
     124            ################## 
     125 
    109126 
    110127            # Now let's replace the holders with the passed arguments 
    111128            i = 0 
     
    116133                html = html.replace('{{%d}}' % (i+1), args[i]) 
    117134                i += 1 
    118135 
    119             # Finaly return the HTML to include 
    120             return wiki_to_html(html, self.env, req) 
     136            #################### 
     137            # BEGIN FIMII EDIT # 
     138            #################### 
     139            html = wiki_to_html(html, self.env, req) 
     140            if(strip_p): 
     141                html = html.replace('<p>','') 
     142                html = html.replace('</p>','') 
     143            if(strip_n): 
     144                html = html.strip() 
     145            return html 
     146            ################## 
     147            # END FIMII EDIT # 
     148            ################## 
     149 
     150 
     151 
     152