From e4142a833884205050309d4141e28c1b3bb1fe8c Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Thu, 11 Jan 2018 01:32:18 +0000 Subject: [PATCH] Allow "max-height", "max-width", "min-height" and "min-width" CSS properties in Textile (#26552). Patch by Michael Gerz and Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17173 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/wiki_formatting/textile/redcloth3.rb | 2 +- test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 7ed29bbd8..291a0e2d4 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -514,7 +514,7 @@ class RedCloth3 < String atts end - STYLES_RE = /^(color|width|height|border|background|padding|margin|font|text|float)(-[a-z]+)*:\s*((\d+%?|\d+px|\d+(\.\d+)?em|#[0-9a-f]+|[a-z]+)\s*)+$/i + STYLES_RE = /^(color|(min-|max-)?+(width|height)|border|background|padding|margin|font|text|float)(-[a-z]+)*:\s*((\d+%?|\d+px|\d+(\.\d+)?em|#[0-9a-f]+|[a-z]+)\s*)+$/i def sanitize_styles(str) styles = str.split(";").map(&:strip) diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 76c954b4b..e0a8f7339 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -80,6 +80,8 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase 'p{border-right:1px}. text' => '

text

', 'p{border-top:1px}. text' => '

text

', 'p{border-bottom:1px}. text' => '

text

', + 'p{max-width:100px}. text' => '

text

', + 'p{width:50px}. text' => '

text

', }, false) # multiple styles -- 2.39.5