I want to build a mini markup mechanism for PDF reports. How can I use regular expression in Qweb report to change the output?
I want to create a bold text string from * * a bold text string * *
For that I use
Bacon Burger
in my template. In my model (wich I inherit from sale.order) I define a method
def minimarkupmagic(self,txt):
txt = re.sub(r'\*{2,2}(.*?)\*{2,2}', r'\1', txt)
txt = re.sub(r'_{2,2}(.*?)_{2,2}', r'\1', txt)
txtArr = txt.split('\n')
txt = '
'.join(txtArr)
return txt
and send it to my template within
docargs = {
...,
'minimarkupmagic': self.minimarkupmagic
}
from def render_html().
It works half way: I only get an output like
in my report, so it seems that the method runs after the rendering of the HTML to PDF.
So how could I get my HTML get interpreted earlier and get my correct output?
Thnx!
EDIT: I just found the answer: I found out that it works if you use t-raw. I used t-esc... :-)