--- a/src/ldt/ldt/ldt_utils/models.py Thu Nov 10 11:38:15 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/models.py Thu Nov 10 12:59:41 2011 +0100
@@ -6,7 +6,7 @@
from ldt.core.models import Document
import ldt.indexation
from utils import (create_ldt, copy_ldt, create_empty_iri, update_iri,
- generate_uuid)
+ generate_uuid, clean_description)
import lucene
import lxml.etree
import mimetypes
@@ -387,17 +387,13 @@
doc = lxml.etree.fromstring(self.ldt)
self.contents.clear()
medias = doc.xpath('/iri/medias/media')
-
- # Remove html tags added by flash if necessary
- begin_str = "KERNING=\"0\">"
+
description = self.get_description(doc)
- begin = description.find(begin_str) + len(begin_str)
- end = description.find("</FONT")
-
- if begin > 0 and end > 0:
- description = description[begin:end]
+ new_desc = clean_description(description)
+
+ if new_desc:
desc_node = doc.xpath('/iri/project')[0]
- desc_node.set('abstract', description)
+ desc_node.set('abstract', new_desc)
self.ldt = lxml.etree.tostring(doc, pretty_print=True)
for media in medias:
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Thu Nov 10 11:38:15 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Thu Nov 10 12:59:41 2011 +0100
@@ -63,7 +63,8 @@
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
width: "470",
- plugins : "autoresize"
+ plugins : "autoresize",
+ entity_encoding : "raw",
});
--- a/src/ldt/ldt/ldt_utils/utils.py Thu Nov 10 11:38:15 2011 +0100
+++ b/src/ldt/ldt/ldt_utils/utils.py Thu Nov 10 12:59:41 2011 +0100
@@ -465,3 +465,20 @@
finally:
f.close()
+def clean_description(description):
+ """ Remove html tags added by flash if necessary """
+ new_desc = u''
+ begin_str = "KERNING=\"0\">"
+
+ for chunk in description.split("<TEXTFORMAT"):
+ begin = chunk.find(begin_str) + len(begin_str)
+ end = chunk.find("</FONT")
+
+ if begin > 0 and end > 0:
+ new_desc = new_desc + chunk[begin:end] + "<br />"
+
+ if new_desc:
+ return new_desc
+ return None
+
+