I have this for my filter:

@[class|style|title],
a[href|target],
img[class|src|width|height|alt|border:0],
em/i, strong/b, strike, del, sub, sup, q, acronym, samp, kbd,
ul, ol, li, dl, dt, dd,
p[align&grt;center?justify?left?right], br, hr,
div[align&grt;center?justify?left?right], span,
table[width|cellpadding|cellspacing=0|border=0], tr[align|valign], td[align|valign|width], tbody, th[align|valign|width], thead, tfoot, colgroup, col, caption,
address, blockquote, pre, cite, code,
h1, h2, h3, h4, h5, h6

In Advanced rules, all fields are blank.

the img tag class attribute is always strip. How can I make the class attribute come through? I don't quit understand the "Rules for Class Names: " field. I tried putting

a-z*

thinking this mean one letter a-z and anything. But still the class attribute is stripped.

What should I do the make the class attribute come through? I just want anything legal to be allow and don't mind whatever combination the user enter.

Comments

markus_petrux’s picture

Status: Active » Fixed

This is because internally, only a set of characters is allowed. The description of the "Rules for Class Names" option reads "Class Names should start with a lower case letter "a-z" and can be followed by one or more lower case letters "a-z", digits "0-9", hyphens "-" and/or underscores "_". The asterisk character "*" can be used in rules to represent any number of characters from the second position of the rule.".

Where it says "any number of characters" it wants to mean that, but only limited to valid characters as described previously.

If you need to be able to use more characters, then do not use this filter, or write a separate input format filter that expands a macro to whatever else you may need as described in the other issue you opened yesterday: #552962: How to create rule to all <pre class="brush: php;first-line=100">

mattyoung’s picture

Ah sorry, this is unrelated to #552962: How to create rule to all <pre class="brush: php;first-line=100">.

Basically what I need is to get the filter to allow

<img class="image-left imceItem" src="....">

Just now got an email from someone telling me I need to explicitly specify what's allowed for class name in "Rules for Class Names"

So I add:

image-*,imceItem

this error out because upper case letter is not allowed. So I changed it to

image-*,imce*

<img class="image-left"> comes out. But imceItem is filtered out.

imceItem is from the tinyMCE rich editor. I don't think I need it for viewing the node. But what if I do need uppercase for some class name?

Questions:

1) how can I specify a very liberal "Rules for class name" expression to allow any "legal" class names so I don't need to add more expression as I have more class name I need to allow?

2) no upper case in class name?

Thank you very much!

markus_petrux’s picture

1) Nothing I'm willing to do because it may complicate things more and more... and we may risk opening the door to security issues. If you need freedom, then don't filter HTML. There are other HTML filters that may suit your needs, or write additional input format filters that are able to process macros that hide these things to Wysiwyg Filter.

2) Oh, I see. Ok, so we could do it, as we already did here: #368682: Accept style property names in uppercase. Please, feel free to file a separate feature request. However, I think I won't have the time for that in the short/middle term. Patches for review are welcome though.

mattyoung’s picture

I filed a feature request: #553968: Allow upper case letters for class/id name

I'll see if I can make a patch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

arski’s picture

Sorry to bring this up again but I just recently bumped into this and am wondering why isn't it possible to allow all class names with a-z0-9-_ ? Basically if I wanted to do that now, I would need to write some 35 rules like a*, b*, c*... why not allow people to do just.. *.. so to say? :)

Thanks