lib/card/content/clean.rb in card-1.93.13 vs lib/card/content/clean.rb in card-1.94.0
- old
+ new
@@ -8,18 +8,20 @@
div h1 h2 h3 h4 h5 h6 span table tr td th tbody thead tfoot
).each { |tag| allowed_tags[tag] = [] }
# allowed attributes
allowed_tags.merge!(
- "a" => %w(href title target),
- "img" => %w(src alt title),
+ "a" => %w[href title target],
+ "img" => %w[src alt title],
"code" => ["lang"],
"blockquote" => ["cite"]
)
if Card.config.allow_inline_styles
- allowed_tags["table"] += %w(cellpadding align border cellspacing)
+ allowed_tags["table"] += %w[cellpadding align border cellspacing data-mce-style]
+ allowed_tags["td"] += %w[scope data-mce-style]
+ allowed_tags["th"] += %w[scope data-mce-style]
end
allowed_tags.each_key do |k|
allowed_tags[k] << "class"
allowed_tags[k] << "style" if Card.config.allow_inline_styles
@@ -59,10 +61,10 @@
def process_attribute attrib, all_attributes
return ['"', nil] unless all_attributes =~ /\b#{attrib}\s*=\s*(?=(.))/i
q = '"'
rest_value = $'
- if (idx = %w(' ").index Regexp.last_match(1))
+ if (idx = %w[' "].index Regexp.last_match(1))
q = Regexp.last_match(1)
end
reg_exp = ATTR_VALUE_RE[idx || 2]
rest_value = process_attribute_match rest_value, reg_exp, attrib
[q, rest_value]