Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
3321 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
mar 23
13895
0
dic 24
51
1
feb 24
1112
0
dic 23
1179
0
ago 22
2742