Skip to Content
Menu
This question has been flagged
2 Replies
2646 Views

Hi everyone

I have a website page with a <code></code> block inside. Inside this code block is some code that has < and > symbols:

#include <Wire.h>

I can't write it like this because then Odoo complains that there is a XMLSyntaxError: Opening and ending tag mismatch when I try to update my module.

I also tried writing it like:

#include &lt;Wire.h&gt;

But then odoo renders the <Wire.h> as HTML code and creates a <Wire.h></Wire.h> block inside my <code></code> block...

Does anyone know any solution for this?   

Avatar
Discard
Best Answer

A (not beautiful) solution is to use a variable, and then t-esc this one.

<t t-set='mytext' t-value='#include &lt;Wire.h&gt;</t>'/>
<t t-esc='mytext' />
Avatar
Discard
Best Answer

you can use cdata symtax in xml file, for example:

<field name='text_field><![CDATA[
Within this Character Data block I can
use double dashes as much as I want (along with <, &, ', and ")
*and* %MyParamEntity; will be expanded to the text
"Has been expanded" ... however, I can't use
the CEND sequence. If I need to use CEND I must escape one of the
brackets or the greater-than sign using concatenated CDATA sections.
]]>
</field>

on website template you can use "t-raw" or "t-ecs" for render this value:
https://www.odoo.com/vi_VN/forum/help-1/question/what-is-the-difference-between-t-esc-and-t-raw-92184



  




Avatar
Discard
Related Posts Replies Views Activity
1
Mar 23
11851
0
Dec 24
41
1
Feb 24
281
0
Dec 23
489
0
Aug 22
1899