]> source.dussan.org Git - redmine.git/commitdiff
Backported r2192 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 28 Dec 2008 13:45:53 +0000 (13:45 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 28 Dec 2008 13:45:53 +0000 (13:45 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.7-stable@2194 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redcloth.rb
lib/redmine/wiki_formatting.rb
test/unit/helpers/application_helper_test.rb

index 421346cc773002d9332de2e3eba29596e755d4ca..7111de513014f392cdd7b418b2048d6125748086 100644 (file)
@@ -465,8 +465,7 @@ class RedCloth < String
             style << "vertical-align:#{ v_align( $& ) };" if text =~ A_VLGN
         end
 
-        style << "#{ htmlesc $1 };" if not filter_styles and
-            text.sub!( /\{([^}]*)\}/, '' )
+        style << "#{ htmlesc $1 };" if text.sub!( /\{([^}]*)\}/, '' ) && !filter_styles
 
         lang = $1 if
             text.sub!( /\[([^)]+?)\]/, '' )
index 39b81e44abf68f7e6d966c62a78b61471d05aa86..3fbb108ada9832e3983343fb713a893c184f3942 100644 (file)
@@ -32,6 +32,7 @@ module Redmine
         super
         self.hard_breaks=true
         self.no_span_caps=true
+        self.filter_styles=true
       end
       
       def to_html(*rules, &block)
index 04449d9219d57907051ecfbbdeb029be423c44cf..9b8debc97684e771808f03a3f1b04b968b09098a 100644 (file)
@@ -49,7 +49,8 @@ class ApplicationHelperTest < HelperTestCase
       '!http://foo.bar/image.jpg!' => '<img src="http://foo.bar/image.jpg" alt="" />',
       'floating !>http://foo.bar/image.jpg!' => 'floating <div style="float:right"><img src="http://foo.bar/image.jpg" alt="" /></div>',
       'with class !(some-class)http://foo.bar/image.jpg!' => 'with class <img src="http://foo.bar/image.jpg" class="some-class" alt="" />',
-      'with style !{width:100px;height100px}http://foo.bar/image.jpg!' => 'with style <img src="http://foo.bar/image.jpg" style="width:100px;height100px;" alt="" />',
+      # inline styles should be stripped
+      'with style !{width:100px;height100px}http://foo.bar/image.jpg!' => 'with style <img src="http://foo.bar/image.jpg" alt="" />',
       'with title !http://foo.bar/image.jpg(This is a title)!' => 'with title <img src="http://foo.bar/image.jpg" title="This is a title" alt="This is a title" />',
       'with title !http://foo.bar/image.jpg(This is a double-quoted "title")!' => 'with title <img src="http://foo.bar/image.jpg" title="This is a double-quoted &quot;title&quot;" alt="This is a double-quoted &quot;title&quot;" />',
     }