Defect #4253

Formatting errors in <code> block

Added by Aleksej Lebedev about 5 years ago. Updated about 5 years ago.

Status:ClosedStart date:2009-11-20
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Text formatting
Target version:-
Resolution:Fixed Affected version:

Description

In block characters < and > are replaced with HTML entities. Example:

<pre><code class="html">
<embed src="/upload/banners/{$page_razdel}/{$key}.swf" width="498" height="70" 
  type="application/x-shockwave-flash" 
  pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</code></pre> 

<pre><code class="xml">
    <web>
        <host value="http://${admin_host::domain}/business/admin/" />
        <static_host value="${admin_host::web::host}static/" />
        <img_dir value="${admin_host::web::static_host}images/" />
        <css_dir value="${admin_host::web::static_host}css/" />
        <js_dir value="${admin_host::web::static_host}js/" />
        <upload_dir value="${admin_host::web::host}upload/" />
    </web>
</code></pre>

<pre><code class="php"><?php
$go_page = "onClick=\"return dropdownmenu(this, event, UserMenu('".htmlspecialchars($go_page)."', '".$row['user_id']."', '".$member_id['user_group']."'), '170px')\" onMouseout=\"delayhidemenu()\"";

if ($config['allow_alt_url'] == "yes") {
    $tpl->set('{author}', "<a {$go_page} href=\"".$config['http_home_url']."user/".urlencode($row['name'])."/\">".$row['name']."</a>");
} else {
    $tpl->set('{author}', "<a {$go_page} href=\"$PHP_SELF?sa=userinfo&amp;user=".urlencode($row['name'])."\">".$row['name']."</a>");
}

?></code></pre>

Result:

Without works fine.

about.txt Magnifier - Redmine info (565 Bytes) Aleksej Lebedev, 2009-11-20 07:29

code_error.png (27.3 KB) Aleksej Lebedev, 2009-11-20 07:29


Related issues

Related to Feature #3359: Update CodeRay 0.9 Closed 2009-05-13

History

#1 Updated by Henrik Ammer about 5 years ago

Same here, just noted it when I added my own bug some seconds ago.

Seems like a Textile bug to me. I know that the Textileversion in PHP has even added a bc. for a block of code and even a bc.. if there are alot of newlines in it.

#2 Updated by Henrik Ammer about 5 years ago

Related to #4243?

#3 Updated by Aleksej Lebedev about 5 years ago

Henrik J├Ânsson wrote:

Related to #4243?

Probably not, because the formatting does not work everywhere (in wiki, issues, comments, etc.)

I know Ruby is very bad, but looking at source:/trunk/lib/redmine/wiki_formatting/textile/formatter.rb@2824#L58 problem is probably in the wrong use of the method html, because :escape param does not exist in source:/trunk/vendor/plugins/coderay-0.9.0/lib/coderay/encoders/html.rb@3014.

Most likely, this problem appeared after updating coderay to version 0.9.0, because in r2838 everything worked (coderay was updated in r3014).

#4 Updated by Jean-Philippe Lang about 5 years ago

  • Category set to Text formatting
  • Status changed from New to Closed
  • Resolution set to Fixed

Coderay upgrade reverted in r3079. Got lots of errors when parsing ruby source files.

#5 Updated by Aleksej Lebedev about 5 years ago

  • Status changed from Closed to Reopened

Maybe the best solution is simply to replace <, >, etc. back to the characters?
(As I understand it was made in source:/trunk/vendor/plugins/coderay-0.9.0/lib/coderay/for_redcloth.rb@3076)

#6 Updated by Jean-Philippe Lang about 5 years ago

  • Status changed from Reopened to Closed

As I said, I got many errors on redmine.org with coderay 0.9.
So this is not an option.

#7 Updated by Mischa The Evil about 5 years ago

Jean-Philippe,

Please see issue #3359 for a dedicated issue regarding updating the CodeRay library.

 
Kind regards,

Mischa.

Also available in: Atom PDF