wiki-external-filter-textile-workaround-2010-06-30.patch

Yuya Nishihara, 2010-06-29 17:27

Download (3.11 KB)

View differences:

lib/redmine/wiki_formatting/textile/formatter.rb
108 108
                      (
109 109
                      \{\{                        # opening tag
110 110
                      ([\w]+)                     # macro name
111
                      (\(([^\}]*)\))?             # optional arguments
111
                      (\((.*?)\))?                # optional arguments
112 112
                      \}\}                        # closing tag
113 113
                      )
114
                    /x unless const_defined?(:MACROS_RE)
114
                    /xm unless const_defined?(:MACROS_RE)
115 115
        
116 116
        def inline_macros(text)
117 117
          text.gsub!(MACROS_RE) do
lib/redmine/wiki_formatting/textile/formatter.rb
116 116
        def inline_macros(text)
117 117
          text.gsub!(MACROS_RE) do
118 118
            esc, all, macro = $1, $2, $3.downcase
119
            args = ($5 || '').split(',').each(&:strip)
119
            # workaround for wiki_external_filter plugin
120
            if (WikiExternalFilterHelper.has_macro macro rescue false)
121
              args = $5
122
              args.gsub!('<br />', "\n") if hard_breaks
123
            else
124
              args = ($5 || '').split(',').each(&:strip)
125
            end
120 126
            if esc.nil?
121 127
              begin
122 128
                @macros_runner.call(macro, args)
lib/redmine/wiki_formatting/textile/formatter.rb
120 120
            if (WikiExternalFilterHelper.has_macro macro rescue false)
121 121
              args = $5
122 122
              args.gsub!('<br />', "\n") if hard_breaks
123
              args.gsub!(%r|</?p>|, "\n")
124
              args.gsub!(%r{(<pre><code>|</code></pre>)}, '')
123 125
            else
124 126
              args = ($5 || '').split(',').each(&:strip)
125 127
            end