dominch / redmine_highlightjs

A redmine plugin to highlight code blocks much better than coderay!
Other
23 stars 10 forks source link

undefined method `highlight_by_language' for Highlightjs #10

Closed ThomasLudwig closed 9 years ago

ThomasLudwig commented 9 years ago

Hi,

I'm trying this plugin in redmine 2.4 on ubuntu. I followed the installation procedure from http://www.redmine.org/projects/redmine/wiki/Plugins

I also had to add a symlink from /usr/share/redmine/public/plugin_assets/redmine_highlightjs to /usr/share/redmine/plugins/redmine_highlightjs/assets/

but when i try to use the plugin I get a 500 error on my page, with this in the log :
Started GET "/redmine/projects/frex/wiki/Sandbox" for 93.93.152.125 at 2015-09-16 14:47:22 +0200 Processing by WikiController#show as HTML Parameters: {"project_id"=>"frex", "id"=>"Sandbox"} Current user: tludwig (id=4) Rendered wiki/_content.html.erb (3.9ms) Rendered wiki/show.html.erb within layouts/base (8.8ms) Completed 500 Internal Server Error in 17.4ms

ActionView::Template::Error (undefined method highlight_by_language' for Highlightjs:Module): 1: <div class="wiki wiki-page"> 2: <%= textilizable content, :text, :attachments => content.page.attachments, 3: :edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title}) %> 4: </div> lib/redmine/syntax_highlighting.rb:23:inhighlight_by_language' lib/redmine/wiki_formatting/textile/formatter.rb:125:in block in smooth_offtags' lib/redmine/wiki_formatting/textile/formatter.rb:121:ingsub!' lib/redmine/wiki_formatting/textile/formatter.rb:121:in smooth_offtags' lib/redcloth3.rb:307:into_html' lib/redmine/wiki_formatting/textile/formatter.rb:43:in to_html' lib/redmine/wiki_formatting.rb:62:into_html' app/helpers/application_helper.rb:529:in textilizable' app/views/wiki/_content.html.erb:2:in_app_views_wikicontent_html_erb534908553950101736_53954980' app/views/wiki/show.html.erb:44:in _app_views_wiki_show_html_erb___2816532835930986738_53653820' app/controllers/wiki_controller.rb:97:inshow'

any clue ?

Thomas

dominch commented 9 years ago

Hi Thomas, You should not symlink anything, usually rails recreate all assets on restart, fastest way is to touch tmp/restart.txt file, also there is rake task RAILS_ENV=production rake redmine:plugins:assets

For second problem - check out file plugins/redmine_highlightjs/lib/highlightjs_highlighting.rb - it should contain needed function. If there is no such file or something is wrong about it get it again from repository. This code is responsible for turning off coderay, if this is different in redmine 2.4 then try to remove that block in init.rb:

     ActionDispatch::Callbacks.to_prepare do
       require_dependency 'highlightjs_highlighting'
       Redmine::SyntaxHighlighting.highlighter = 'Highlightjs'
     end

report me if that helped, turned on coderay should not broke anything and should be replaced by highlightjs.

ThomasLudwig commented 9 years ago

the file plugins/redmine_highlightjs/lib/highlightjs_highlighting.rb, seems ok, but the rake redmine:plugins:assets doesn't copy anything. It seems to be doing something for about a few seconds, but even with --verbose, I have not information as to what it is doing. and the public directory is left unchanged.

dominch commented 9 years ago

This task should create assets for all plugins, it just copy everything from plugin/%name%/assets to public/assets/%name%, when You have a bunch of them or just update them frequently it save lot of time. Check out if there is no permission errors or so. It should list all Your plugins with descriptions and create all needed assets.

Of course symlinking should work too.

I'll get redmine 2.4 again and try to find problem with error 500. It should be easy to fix. I'll ping You here.

dominch commented 9 years ago

@ThomasLudwig: please check out dev branch - I hope that version will work on Your side :+1:

ThomasLudwig commented 9 years ago

Everything is work fine now.

Thank you !

dominch commented 9 years ago

Great :) change will be released to master in 1.0.3 version after few other bugfixes.