Defect #7033

'class' attribute of <pre> tag shouldn't be truncate

Added by ctx nop almost 7 years ago. Updated almost 7 years ago.

Status:ClosedStart date:2010-12-03
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Text formatting
Target version:1.0.5
Resolution:Fixed Affected version:1.0.4

Description

When you edit a message you can use pre tag like this :

<pre class="warning">Some preformated message</pre>

But class attribute is altered by the engine, space in attibute is considered as a break, so you can't use custom CSS classes.

For exemple, if I write

<pre class="class1 class2">...</pre>

the resulting page source is

<pre class="class1> ... </pre>

Note the closing quote is also missing which is breaking the page.
class attribute should be kept without any change so that the user can use custom CSS class.

In fact, I encountered this problem when trying to use SyntaxHighlighter (http://alexgorbatchev.com/SyntaxHighlighter/) which use this syntax :

<pre class="brush: lng">
...
</pre>

A workaround is to use the HTML entity for non-breakable space, like this :

<pre class="brush:&nbsp;lng">
...
</pre>

But it is really user-unfriendly.

infos :
  • ruby -v ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
  • rails -v Rails 2.3.5
  • mysql --version mysql Ver 14.14 Distrib 5.1.52, for pc-linux-gnu (x86_64) using readline 5.1
  • Redmine 1.0.2.stable.4390
  • svn info

Forgotten something ?
Please forgive my bad english.

Associated revisions

Revision 4468
Added by Jean-Philippe Lang almost 7 years ago

Fixed: class attribute with spaces on pre tags truncated (#7033).

History

#1 Updated by Jean-Philippe Lang almost 7 years ago

  • Category set to Text formatting

#2 Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from New to Resolved
  • Target version set to 1.0.5
  • Affected version (unused) set to 1.0.4
  • Resolution set to Fixed
  • Affected version set to 1.0.4

Fixed in r4468.

#3 Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from Resolved to Closed

Merged in 1.0-stable.

Also available in: Atom PDF