Форумы / Cotonti / Support / Pre tags are being stripped

Hodges
#1 25.04.2014 14:45

Good afternoon,

So it seems that when I insert a code snippet the class attribute (containing the markup language identifier, e.g. class="brush:xml;") is getting stripped out of the pre tag that's surrounding the code. It can't be CKEditor at fault because in plugins/ckeditor/lib/config.js:

	config.allowedContent = true; // disable ACF

So it must be HTML Purifier, right? Except everything I've read suggests it isn't that aggressive, and will leave class attributes alone.

Anyway, a little help here would be appreciated :)

Macik
#2 25.04.2014 20:12

Not 100%, but it can be HTML Purifier.

Try to experiment and save these tag with simple class:  <pre class="test">

If it works fine then special symbols is problem.

If it cleared (not saved) then check HTMLPurifier presets.

 

I'm checked this code on my page and it saved fine.

So look at these settings:

    'Attr.ForbiddenClasses' => '',

    'HTML.AllowedAttributes' => 'pre.class';

 

 

 

p.s. Using special symbols in class attrbut is not semantically right.

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
Hodges
#3 02.05.2014 13:23

Hi Macik,

The code <pre class="brush:xml;">TEXT</pre> reduces to <pre>TEXT</pre> whilst <pre class="brush">TEXT</pre> is left unaltered. I still haven't figured this out yet.

I don't understand why this isn't happening on cotonti.com since I'm using HTML Purifier as it ships with Cotonti Siena 0.9.16.

- Hodges

EDIT: I've just paused HTML Purifier whilst submitting a page and the class value was left unaltered so it's definitely HTML Purifier.

EDIT2: Although this isn't yet fixed, I've just realised I didn't have the parser plugin installed (I had assumed it shipped with stock cotonti). Anyway for those who don't know the link is here: https://github.com/trustmaster/cot-syntaxhighlighter

Отредактировано: Hodges (02.05.2014 13:39, 9 лет назад)
Macik
#4 02.05.2014 16:32
#39495 Hodges:

Hi Macik,

The code <pre class="brush:xml;">TEXT</pre> reduces to <pre>TEXT</pre> whilst <pre class="brush">TEXT</pre> is left unaltered. I still haven't figured this out yet.  I don't understand why this isn't happening on cotonti.com since I'm using HTML Purifier as it ships with Cotonti Siena 0.9.16.

I checked it on my old install (0.9.10) and it worked with default HTML purifier setting. By the way both variants works:  <pre class="brush:xml;"> and <pre class="brush:xml">

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F