https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292017-04-24T02:34:46ZRedmineRedmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=781652017-04-24T02:34:46ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/18158">25634-r16501.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/18158/25634-r16501.png">25634-r16501.png</a> added</li><li><strong>File</strong> <a href="/attachments/18159">25634-r16502.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/18159/25634-r16502.png">25634-r16502.png</a> added</li><li><strong>Category</strong> changed from <i>Wiki</i> to <i>Text formatting</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Confirmed</i></li><li><strong>Priority</strong> changed from <i>Normal</i> to <i>High</i></li><li><strong>Target version</strong> set to <i>3.2.7</i></li><li><strong>Affected version</strong> changed from <i>3.3.3</i> to <i>3.2.6</i></li></ul><p>Confirmed in trunk. <a class="changeset" title="Filter arbitrary class names and ids in rendered HTML output (#25503). * Disallow setting arbitr..." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/16502">r16502</a> have broken syntax highlighting.</p>
<p><strong><a class="changeset" title="Helper methods to find out if a given language is supported (#25503). Patch by Jan Schulz-Hofen." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/16501">r16501</a> (good):</strong><br /><img src="https://www.redmine.org/attachments/download/18158/25634-r16501.png" style="border: 1px solid #ddd;" alt="" /></p>
<p><strong><a class="changeset" title="Filter arbitrary class names and ids in rendered HTML output (#25503). * Disallow setting arbitr..." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/16502">r16502</a> (bad):</strong><br /><img src="https://www.redmine.org/attachments/download/18159/25634-r16502.png" style="border: 1px solid #ddd;" alt="" /></p> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=781702017-04-24T03:58:20ZGo MAEDA
<ul></ul><p>This problem is due to <code>Redmine::SyntaxHighlighting::CodeRay::language_supported?</code>.</p>
<pre><code class="ruby syntaxhl"><span class="k">def</span> <span class="nf">language_supported?</span><span class="p">(</span><span class="n">language</span><span class="p">)</span>
<span class="o">::</span><span class="no">CodeRay</span><span class="o">::</span><span class="no">Scanners</span><span class="p">.</span><span class="nf">list</span><span class="p">.</span><span class="nf">include?</span><span class="p">(</span><span class="n">language</span><span class="p">.</span><span class="nf">to_s</span><span class="p">.</span><span class="nf">downcase</span><span class="p">.</span><span class="nf">to_sym</span><span class="p">)</span>
<span class="k">rescue</span>
<span class="kp">false</span>
<span class="k">end</span>
</code></pre>
<pre>
p language
# => "javascript"
p ::CodeRay::Scanners.list
# => [:c, :clojure, ... :java_script, ... :xml, :yaml]
p ::CodeRay::Scanners.list.include?(language.to_s.downcase.to_sym)
# => false
</pre> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=781712017-04-24T06:19:20ZMischa The Evil
<ul></ul><p>Here is a quick and dirty workaround (which I haven't actually tested yet) for users who are suffering from this regression and cannot wait for a released fix:<br /><pre><code class="patch syntaxhl"><span class="gh">Index: lib/redmine/syntax_highlighting.rb
===================================================================
</span><span class="gd">--- lib/redmine/syntax_highlighting.rb (revision 16543)
</span><span class="gi">+++ lib/redmine/syntax_highlighting.rb (working copy)
</span><span class="p">@@ -70,7 +70,8 @@</span>
end
def language_supported?(language)
<span class="gd">- ::CodeRay::Scanners.list.include?(language.to_s.downcase.to_sym)
</span><span class="gi">+ coderay_aliases = [:'c++', :cplusplus, :ecmascript, :ecma_script, :rhtml, :eruby, :irb, :javascript, :js, :pascal, :patch, :plain, :plaintext, :xhtml, :yml]
+ ::CodeRay::Scanners.list.include?(language.to_s.downcase.to_sym) || coderay_aliases.include?(language.to_s.downcase.to_sym)
</span> rescue
false
end
</code></pre></p> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=787112017-05-20T06:46:39ZGo MAEDA
<ul><li><strong>File</strong> <i>fix-defect-25634.diff</i> added</li></ul><p>This is a patch to fix this issue.</p> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=787122017-05-20T07:14:10ZGo MAEDA
<ul><li><strong>File</strong> deleted (<del><i>fix-defect-25634.diff</i></del>)</li></ul> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=787132017-05-20T07:15:15ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/18371">fix-defect-25634.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/18371/fix-defect-25634.diff">fix-defect-25634.diff</a> added</li></ul><p>Slightly improved the patch.</p> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=787912017-05-26T11:34:17ZHolger Just
<ul></ul><p>Thanks for the patch. I had indeed missed the alias names for Coderay.</p>
<p>Looks good to me!</p> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=788062017-05-27T07:53:30ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>Confirmed</i> to <i>Resolved</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>Patch committed, thanks.</p> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=788102017-05-27T08:36:18ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=788282017-05-28T13:43:55ZMischa The Evil
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/26055">Defect #26055</a>: Three issues with Redmine::SyntaxHighlighting::CodeRay.language_supported?</i> added</li></ul> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=788292017-05-28T13:44:48ZMischa The Evil
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Reopened</i></li></ul><p>Reopened in light of <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: Three issues with Redmine::SyntaxHighlighting::CodeRay.language_supported? (Closed)" href="https://www.redmine.org/issues/26055">#26055</a>.</p> Redmine - Defect #25634: Highlight language aliases are no more supportedhttps://www.redmine.org/issues/25634?journal_id=790722017-06-07T19:35:51ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>Reopened</i> to <i>Closed</i></li></ul>