Redmine wiki external filter plugin version 0.0.2 is released

Tagged:

New version of Redmine wiki external filter plugin is released, see full text for changes description.

Main changes in new version:

  • Added support for videos conversion and embedding using ffmpeg for video conversion and Flowplayer for embedding resulting flash video to wiki page.
  • Added support for multiple commands per macro: useful for example to generate both thumbnail and converted video from the same input source.
  • Improved SVG compatibility between browsers and added PNG fall-back for SVG displaying in IE when available.
  • In addition to stdout, stderr on command execution is now scanned and reported in the case of error too (requires having ‘popen4’ gem installed).
  • Unified block/inline rendering.
  • Split views to separate files.
  • Added support for using attachments names in macros input.
  • Added support for templates instead of using content_type-based view selection.

See full description for additional details.

Comment viewing options

ndl@home is currently in maintenance. During this maintenance it is not possible to change site content (like comments, pages and users).
Select your preferred way to display the comments and click "Save settings" to activate your changes.

Attachment Patch

Can you check the attachment patch to ensure that it still works with the redmine core? It doesn't appear to be up to date.

Re: Attachment Patch

NDL's picture

I assume you mean the patch that allows passing attachments names as macros arguments? The patch is against Redmine 0.9.3, as far as I know - the most up-to-date official version. I do not know whether it applies either to earlier versions or to current Redmine trunk. I’m not going to keep tracking trunk changes for either this patch or whatever else patches posted here as that would take too much time - most likely I will update them when switching to new Redmine version (either 0.9.4 or 0.9.5, depending on my time availability and Redmine releases scheduling).

Well the reason why I ask is

Well the reason why I ask is because you released this version March 27th. And the patch affects the file app/helpers/application_helper.rb, yet the last change on the trunk was on March 18th, see: http://github.com/edavis10/redmine/commits/master/app/helpers/applicatio...
Sorry don't mean to bug, I just really want to use this plugin, but I'm not very familiar with the redmine core to determine how to make the proper change myself.

Indeed

NDL's picture

I had a quick look at current trunk version of the “application_helper.rb” and the file was changed comparably significantly indeed compared to Redmine 0.9.3 I used for the patch, so you’re right - the patch cannot be applied anymore.

However, the way the code is written now makes my patch simpler, as the code was changed to do almost what my patch did - i.e. parse text not before formatter is applied (and looking for textile-specific links) but after it is converted to HTML. So now it should already work properly out of the box for all types of formatters with links to images - and extending it to work with all attachments (not images only) should be easier. Please try to apply the following patch:

--- application_helper.rb  2010-04-22 17:45:40.000000000 +0300
+++ application_helper.rb.patched 2010-04-22 18:14:26.862058332 +0300
@@ -460,17 +460,14 @@
     # when using an image link, try to use an attachment, if possible
     if options[:attachments] || (obj && obj.respond_to?(:attachments))
       attachments = nil
-      text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m|
-        filename, ext, alt, alttext = $1.downcase, $2, $3, $4 
+      text.gsub!(/((<img[^>]+src\s*=\s*)|(<a[^>]+href\s*=\s*))(("[^"]+")|('[^']+'))/i) do |m|
+        prefix = $1
+        filename = $4.downcase.gsub(/^["'](.+)["']$/, '\1')
         attachments ||= (options[:attachments] || obj.attachments).sort_by(&:created_on).reverse
         # search for the picture in attachments
         if found = attachments.detect { |att| att.filename.downcase == filename }
-          image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found
-          desc = found.description.to_s.gsub('"', '')
-          if !desc.blank? && alttext.blank?
-            alt = " title=\"#{desc}\" alt=\"#{desc}\""
-          end
-          "src=\"#{image_url}\"#{alt}"
+          link_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found
+          prefix + "\"" + link_url + "\""
         else
           m
         end

As I have no Redmine trunk copy running locally I cannot test this patch. Please let me know if it works for you.

BTW, the dates of patch/files in Redmine git might not be in sync indeed as I’ve published the patch not immediately after I made it but somewhat later.

No it still appears to be

No it still appears to be broken, the error is the following:

Error executing the graphviz macro (Error applying external filter: stdout is , stderr is Error: :0: syntax error near line 0 context:

Not likely related to attachments

NDL's picture

From the error message it doesn’t look like the problem has anything to do with the attachments patch, rather that the input to graphviz macro was wrong (or most likely missing completely).

What are you actually trying to accomplish? Also showing exact steps you take to invoke the macro and appropriate parts of Redmine log might be useful.

Syndicate content