Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
3811 Visninger

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
Kassér
Bedste svar

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
Kassér
Bedste svar

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
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
mar. 23
14681
0
dec. 24
51
1
feb. 24
1584
0
dec. 23
1662
0
aug. 22
3138