update macros escaping patch to apply cleanly to redmein trunk as of 2011-10-24
[from now] 2012/01/10 16:09:04
[from now] 2012/01/10 18:49:13
[from now] 2012/01/11 20:57:35

diff --git a/lib/wiki_external_filter_patch.rb b/lib/wiki_external_filter_patch.rb
index 79dd0e7..7ff63b3 100644
--- a/lib/wiki_external_filter_patch.rb
+++ b/lib/wiki_external_filter_patch.rb
@@ -1,6 +1,8 @@
 require 'digest/md5'

-module ApplicationHelper
+module Redmine
+  module WikiFormatting
+
   MACROS_RE = /
     (!)?                        # escaping
     (\{\{                        # opening tag
@@ -9,12 +11,12 @@ module ApplicationHelper
     \}\}                        # closing tag
     )
   /xm unless const_defined?(:MACROS_RE)
-end

-module Redmine
-  module WikiFormatting
+
     class << self
-      include ApplicationHelper
+
+
+
       def to_html_with_external_filter(format, text, options={})
         text, @@macros_grabbed = preprocess_macros(text)
         to_html_without_external_filter(format, text, options)
@@ -44,6 +46,16 @@ end

 module Redmine::WikiFormatting::Macros::Definitions
   def exec_macro_with_macros_grabbed(name, obj, args)
+    logger.debug "MACRO EXEC: [name: #{name}, :args: #{args}]"
+    if name =~ /_macros_grabbed/
+      name = 'graphviz'
+      args =<<-EOS
+digraph{
+ hoge -> fuga;
+ }
+      EOS
+    end
+    logger.debug "MACRO EXEC: [name: #{name}, :args: #{args}]"
     exec_macro_without_macros_grabbed(name, obj, args)
   end
   alias_method_chain :exec_macro, :macros_grabbed
[from now] 2012/01/11 23:19:01

diff --git a/lib/wiki_external_filter_patch.rb b/lib/wiki_external_filter_patch.rb
index 7ff63b3..8e57da8 100644
--- a/lib/wiki_external_filter_patch.rb
+++ b/lib/wiki_external_filter_patch.rb
@@ -12,11 +12,8 @@ module Redmine
     )
   /xm unless const_defined?(:MACROS_RE)

-
     class << self

-
-
       def to_html_with_external_filter(format, text, options={})
         text, @@macros_grabbed = preprocess_macros(text)
         to_html_without_external_filter(format, text, options)
@@ -27,9 +24,8 @@ module Redmine
         text = text.gsub(MACROS_RE) do |s|
           esc, all, macro = $1, $2, $3.downcase
           if esc.nil? and (WikiExternalFilterHelper.has_macro macro rescue false)
-            args = $5
-            key = Digest::MD5.hexdigest("#{macro}:#{args}")
-            macros_grabbed[key] = {:macro => macro, :args => args}
+            args = $5.chomp
+            key = ["#{macro}:#{args}"].pack('m').gsub(/\n/,'')
             "{{_macros_grabbed(#{key})}}"
           else
             s
@@ -46,16 +42,10 @@ end

 module Redmine::WikiFormatting::Macros::Definitions
   def exec_macro_with_macros_grabbed(name, obj, args)
-    logger.debug "MACRO EXEC: [name: #{name}, :args: #{args}]"
     if name =~ /_macros_grabbed/
-      name = 'graphviz'
-      args =<<-EOS
-digraph{
- hoge -> fuga;
- }
-      EOS
+      args[0].unpack('m')[0] =~ /([^:]+):(.*)/m
+      name,args = [$1,$2]
     end
-    logger.debug "MACRO EXEC: [name: #{name}, :args: #{args}]"
     exec_macro_without_macros_grabbed(name, obj, args)
   end
   alias_method_chain :exec_macro, :macros_grabbed
Not need to copy wiki_external_filter.yml. It will get from plugin config/ dir
Little development fix
Fix for HTML br tag
Fix formatting for uml
Fix formatting for uml
Updated for simplification of installation.
Merge remote branch 'chiastolite/1.3support'
Merge remote branch 'freedayko/master'
Merge remote branch 'snnrk/master'

Conflicts:
	app/helpers/wiki_external_filter_helper.rb