Project

General

Profile

Actions

Defect #4472

open

Escape <code> tag

Added by Mikhail Yakshin over 14 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Text formatting
Start date:
2009-12-22
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

When using Textile-like wiki syntax, pre tag with code renders incorrectly. The simplest way to reproduce it is below:

42

It yields the same output as from:

42

What's more interesting, using @ syntax with code inside makes renderer go absolutely crazy:

It outputs mysterious line:


Related issues

Has duplicate Redmine - Defect #7375: <pre> ... </pre> doesn't escape wiki syntax correctlyClosed2011-01-19

Actions
Actions #1

Updated by Etienne Massip about 13 years ago

  • Target version set to Candidate for next minor release
Actions #2

Updated by Ivan Cenov about 12 years ago

before pre section

111111111111
code code bold bold italic italic underline underline deleted deleted
222222222222
after pre section

Actions #3

Updated by Jonas De Meulenaere over 8 years ago

This issue remains a problem. I'm using Redmine 2.4.3.stable.

I try to display an XML response in a ticket. I use display my xml message nicely, I use the code class="xml" tag for syntax highlighting and the pre tag to keep the indenting. To do so nicely, I need to put the code tag within the pre tag. If I put the pre tag within the code tag, the code is not highlighted. This works well.

However there is no way to escape the code tag if you want to. Maybe since code is not a Textile tag, there is no way to escape it (using e.g. notextile). With or without the code highlighting, If my message itself contains a code tag, I do not manage to display it correctly.

Example:

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <test>
            &lt;code&gt;3&lt;/code&gt;
        &lt;test&gt;
    &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;

The problem lies IMHO in the fact that in different libraries/plugins are used (CodeRay & RedCloth/Textile) and Redmine does some patching on it, see in the bottom of formatter.rb .

Actions #4

Updated by Jonas De Meulenaere about 7 years ago

  • Subject changed from <code> inside <pre> to Escape <code> tag

The only way to display a code tag is with HTML escaping (using &lt;), but only in clear text:

<code>1234</code>

Within a code or a pre, it does not work:

&lt;code>1234&lt;/code>
&lt;code>1234&lt;/code>

All means with notextile don't work.

This is a simple code tag with notextile before

1234

This is a simple code tag with notextile around

1234

It doesn't work within a quote:

1234

It doesn't work within a pre (with and without notextile):

1234
1234

It doesn't work within a pre + code (with and without notextile):

&lt;code&gt;1234&lt;/code&gt;
1234

It doesn't work within == either:

1234
== 1234 ==
Actions #5

Updated by Benjamin GUILLAUME almost 2 years ago

Hello,

I just had the same issue. I need to use the <code> xml tag inside <pre><code class="xml"></code></pre> to correctly describe the issue to our dev team.

The only way to have something "relevant" is to use &nbsp;, &lt; and &gt; surrounded by @ caracter :

<Response>
    <search>
        <code>3</code>
        <message>OK</message>
        <count>0</count>
        <nextPage>false</nextPage>
        <nextPageUrl/>
    </search>
</Response>

But still, it's not very convenient.

Here is the output when using <code> tag inside <pre><code class="xml"></code></pre>:

<Response>
    <search>
        &lt;code&gt;3&lt;/code&gt;
        &lt;message&gt;OK&lt;/message&gt;
        &lt;count&gt;0&lt;/count&gt;
        &lt;nextPage&gt;false&lt;/nextPage&gt;
        &lt;nextPageUrl/&gt;
    &lt;/search&gt;
&lt;/Response&gt;

Is there any other known workaround? Is it planed to correct this point?

Thanks!

Actions

Also available in: Atom PDF