https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292011-05-18T14:51:18ZRedmineRedmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=289912011-05-18T14:51:18ZEtienne Massip
<ul><li><strong>Category</strong> changed from <i>Wiki</i> to <i>Text formatting</i></li><li><strong>Target version</strong> set to <i>Candidate for next minor release</i></li></ul> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=878542018-10-05T23:58:06ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/21581">pre-parse-bug@2x.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/21581/pre-parse-bug@2x.png">pre-parse-bug@2x.png</a> added</li><li><strong>Subject</strong> changed from <i>Parsing of pre tag in wiki is buggy</i> to <i>Tags start with 'pre' are handled as 'pre' tag in Textile</i></li><li><strong>Description</strong> updated (<a title="View differences" href="/journals/87854/diff?detail_id=70152">diff</a>)</li></ul><p>This old bug is still alive in Redmine 4.0 under development.</p>
<p>"preeeee" in the following text is misrecognized as "pre".</p>
<pre>
<preeeee>
aaaaaaa
</preeeee>
</pre>
<p><img src="https://www.redmine.org/attachments/download/21581/pre-parse-bug@2x.png" srcset="https://www.redmine.org/attachments/download/21581/pre-parse-bug@2x.png 2x" style="width: 227px;border: 1px solid #ccc;" alt="" /></p> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=878582018-10-06T00:48:12ZGo MAEDA
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/87858/diff?detail_id=70159">diff</a>)</li></ul> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=883812018-11-15T04:43:20ZTakenori TAKAKItakenory@gmail.com
<ul></ul><p>To fix this probrem, It would be necessary to add a harf-space character <br />between the pattern of tag name and pattern of the attributes in the regxp defined on RedCloth3::OFFTAG_MATCH.</p>
<p>As below.<br /><pre><code class="diff syntaxhl"><span class="gh">diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 6ffd7c78c..074017a35 100644
</span><span class="gd">--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
</span><span class="gi">+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
</span><span class="p">@@ -1049,7 +1049,7 @@</span> class RedCloth3 < String
end
OFFTAGS = /(code|pre|kbd|notextile)/
<span class="gd">- OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi
</span><span class="gi">+ OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS } [^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi
</span> OFFTAG_OPEN = /<#{ OFFTAGS }/
OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
</code></pre></p> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=884272018-11-19T00:06:09ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/21828">8395-note4.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/21828/8395-note4.png">8395-note4.png</a> added</li><li><strong>Status</strong> changed from <i>New</i> to <i>Needs feedback</i></li></ul><p>Takenori TAKAKI wrote:</p>
<blockquote>
<p>To fix this probrem, It would be necessary to add a harf-space character <br />between the pattern of tag name and pattern of the attributes in the regxp defined on RedCloth3::OFFTAG_MATCH.</p>
<p>As below.<br />[...]</p>
</blockquote>
<p>After applying the patch <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: Tags start with 'pre' are handled as 'pre' tag in Textile (Closed)" href="https://www.redmine.org/issues/8395#note-4">#8395#note-4</a>, an unnecessary blank line is inserted before the first line inside <code>pre</code>. Could you check the patch?</p> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=884282018-11-19T00:07:06ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/21829">8395-note4.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/21829/8395-note4.png">8395-note4.png</a> added</li></ul><p><img src="https://www.redmine.org/attachments/download/21829/8395-note4.png" style="width: 252px;border: 1px solid #ccc;" alt="" /></p> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=884352018-11-20T06:22:03ZTakenori TAKAKItakenory@gmail.com
<ul></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>After applying the patch <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: Tags start with 'pre' are handled as 'pre' tag in Textile (Closed)" href="https://www.redmine.org/issues/8395#note-4">#8395#note-4</a>, an unnecessary blank line is inserted before the first line inside <code>pre</code>. Could you check the patch?</p>
</blockquote>
<p>Thank you for pointing out my patch's bug (<a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: Tags start with 'pre' are handled as 'pre' tag in Textile (Closed)" href="https://www.redmine.org/issues/8395#note-6">#8395#note-6</a>). I confirmed same trouble on my environment too...<br />To fix the bug, Necessary to change RedCloth3::OFFTAG_MATCH as below.</p>
<pre><code class="diff syntaxhl"><span class="gh">diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 6ffd7c78c..6894d4ee6 100644
</span><span class="gd">--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
</span><span class="gi">+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
</span><span class="p">@@ -1049,7 +1049,7 @@</span> class RedCloth3 < String
end
OFFTAGS = /(code|pre|kbd|notextile)/
<span class="gd">- OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi
</span><span class="gi">+ OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }(?:>| [^>]*>)))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi
</span> OFFTAG_OPEN = /<#{ OFFTAGS }/
OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
</code></pre>
<p>Could you please try the new patch again?</p> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=884772018-11-22T06:39:27ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Needs feedback</i> to <i>New</i></li><li><strong>Target version</strong> changed from <i>Candidate for next minor release</i> to <i>3.4.7</i></li></ul><p>LGTM. The patch can be applied to the trunk and 3.4-stable cleanly. Setting target version to 3.4.7.</p> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=885222018-11-25T23:44:06ZMarius BĂLTEANU
<ul><li><strong>File</strong> <a href="/attachments/21879">test_for_8395.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/21879/test_for_8395.patch">test_for_8395.patch</a> added</li></ul><p>Attached a test case for this issue.</p>
<p>Another way to fix this is to add to the regex the word boundary (\b):<br /><pre><code class="diff syntaxhl"><span class="gh">diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 6ffd7c7..56085ad 100644
</span><span class="gd">--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
</span><span class="gi">+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
</span><span class="p">@@ -1049,7 +1049,7 @@</span> class RedCloth3 < String
end
OFFTAGS = /(code|pre|kbd|notextile)/
<span class="gd">- OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi
</span><span class="gi">+ OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }\b>)|(<#{ OFFTAGS }\b[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\b\W|\Z)/mi
</span> OFFTAG_OPEN = /<#{ OFFTAGS }/
OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
<span class="p">@@ -1216,4 +1216,3 @@</span> class RedCloth3 < String
text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "&lt;#{$1}#{'&gt;' unless $3.blank?}" }
end
end
</code></pre></p> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=885242018-11-25T23:44:49ZMarius BĂLTEANU
<ul><li><strong>Related to</strong> deleted (<i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/7309">Defect #7309</a>: '<pre/>' tag</i>)</li></ul> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=885272018-11-25T23:44:57ZMarius BĂLTEANU
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/7309">Defect #7309</a>: '<pre/>' tag</i> added</li></ul> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=885312018-11-26T04:40:25ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul> Redmine - Defect #8395: Tags start with 'pre' are handled as 'pre' tag in Textilehttps://www.redmine.org/issues/8395?journal_id=885322018-11-26T04:56:54ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul><p>Committed <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: Tags start with 'pre' are handled as 'pre' tag in Textile (Closed)" href="https://www.redmine.org/issues/8395#note-9">#8395#note-9</a>. Thank you all for the contribution.</p>