On 22/sep/09, at 12:27, Dennis Dam wrote:
Hi all,
I'm crossposting this mail to the CMS 6 and CMS 7 lists, because
this is
something that concerns both CMSes.
I noticed that the HTML cleaner does not handle <span> elements
correctly;
or at least: I expected it to work differently.
I'm using the language picker Xinha plugin in CMS 7. This plugin
inserts a
<span> element around selected text and sets two attributes: a class
attribute with the value "haslang" and a lang attribute with the 2-
letter
code for the language (i.e. "en"). So the resulting html could be:
<span lang="nl" class="haslang">Goedemiddag</span> is a Dutch word.
When saving the document, the html cleaner component strips the lang
attribute. In fact, it strips all other attributes when it
encounters a
class attribute, except the class attribute itself.
I want to fix this code in the HTML cleaner, so the list of allowed
attributes is used for the <span> element, instead of ignoring that
list
when a class attribute is encountered. I'm wondering though, if that
will
break existing projects (using either Hippo CMS 6 or CMS 7) ??
Anyone? If
nobody objects, I will fix the part in the HTML cleaner that strips
all
other attributes.
Hi Dennis,
I had a similar problem in my project using Hippo 6: in order to solve
it, I had to write my own nl.hippo.htmlcleaner.HtmlRepairer
(unfortunately subclassing was not an option) in order to override
elementCleanup(List bits), when it comes to
if (startElement.localName.equals("span")) {
Essentially I had to move the conditions to keep the <span> from
has only class attribute with recognized value
has style with certain recognized effects (bold/italic) -> translate
to semantic correct tag.
to
has only class attribute with recognized value
has style
Of course, instead of translating <span> to <em> or <strong>, I keep
it with the correct attributes.
Cheers.
--
Francesco Chicchiriccò
Delivery Manager
everett Italia ▸
TRUSTED TO KNOW
Head Office
Via Torino, 2 - 20123 Milano - Italia
Tel:
+39 02 72546847
Fax:
+39 02 72546418
Technology Centre
Via Federico Fellini, 2 G2/1 - 65010 Spoltore (PE) - Italia
Tel:
+39 085 2120342 / +39 085 2120537
Fax:
+39 085 2120342 / +39 085 2120537
Mob:
+39 329 0573276
e-mail:
[email protected]
Web:
http://www.everett.it
********************************************
Hippocms-dev: Hippo CMS development public mailinglist
Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html