Support svg:foreignObject
Fixes to the html5lib sanitizer and maruku to support the SVG <foreignObject> element. Also update to the latest REXML.
This commit is contained in:
parent
15640ca7a3
commit
5dd0507acc
6 changed files with 28 additions and 23 deletions
14
vendor/plugins/HTML5lib/lib/html5/sanitizer.rb
vendored
14
vendor/plugins/HTML5lib/lib/html5/sanitizer.rb
vendored
|
@ -27,13 +27,13 @@ module HTML5
|
|||
ul var]
|
||||
|
||||
MATHML_ELEMENTS = %w[annotation annotation-xml maction math merror mfrac
|
||||
mi mmultiscripts mn mo mover mpadded mphantom mprescripts mroot mrow
|
||||
mfenced mi mmultiscripts mn mo mover mpadded mphantom mprescripts mroot mrow
|
||||
mspace msqrt mstyle msub msubsup msup mtable mtd mtext mtr munder
|
||||
munderover none semantics]
|
||||
|
||||
SVG_ELEMENTS = %w[a animate animateColor animateMotion animateTransform
|
||||
circle defs desc ellipse font-face font-face-name font-face-src g
|
||||
glyph hkern linearGradient line marker metadata missing-glyph
|
||||
circle defs desc ellipse font-face font-face-name font-face-src foreignObject
|
||||
g glyph hkern linearGradient line marker metadata missing-glyph
|
||||
mpath path polygon polyline radialGradient rect set stop svg switch
|
||||
text title tspan use]
|
||||
|
||||
|
@ -46,13 +46,13 @@ module HTML5
|
|||
selected shape size span src start style summary tabindex target title
|
||||
type usemap valign value vspace width xml:lang]
|
||||
|
||||
MATHML_ATTRIBUTES = %w[actiontype align columnalign columnalign
|
||||
MATHML_ATTRIBUTES = %w[actiontype align close columnalign columnalign
|
||||
columnalign columnlines columnspacing columnspan depth display
|
||||
displaystyle encoding equalcolumns equalrows fence fontstyle fontweight
|
||||
frame height linethickness lspace mathbackground mathcolor mathvariant
|
||||
mathvariant maxsize minsize other rowalign rowalign rowalign rowlines
|
||||
rowspacing rowspan rspace scriptlevel selection separator stretchy
|
||||
width width xlink:href xlink:show xlink:type xmlns xmlns:xlink]
|
||||
mathvariant maxsize minsize open other rowalign rowalign rowalign rowlines
|
||||
rowspacing rowspan rspace scriptlevel selection separator separators
|
||||
stretchy width width xlink:href xlink:show xlink:type xmlns xmlns:xlink]
|
||||
|
||||
SVG_ATTRIBUTES = %w[accent-height accumulate additive alphabetic
|
||||
arabic-form ascent attributeName attributeType baseProfile bbox begin
|
||||
|
|
|
@ -103,7 +103,8 @@ module MaRuKu; module Out; module HTML
|
|||
|
||||
if mathml
|
||||
add_class_to(mathml, 'maruku-mathml')
|
||||
span << mathml
|
||||
return mathml
|
||||
# span << mathml
|
||||
end
|
||||
|
||||
if png
|
||||
|
|
4
vendor/plugins/rexml/lib/rexml/element.rb
vendored
4
vendor/plugins/rexml/lib/rexml/element.rb
vendored
|
@ -990,7 +990,9 @@ module REXML
|
|||
end
|
||||
|
||||
def to_a
|
||||
values.flatten
|
||||
attributes = []
|
||||
each_attribute {|attr| attributes << attr}
|
||||
attributes
|
||||
end
|
||||
|
||||
# Returns the number of attributes the owning Element contains.
|
||||
|
|
|
@ -63,7 +63,7 @@ module REXML
|
|||
def write_element( node, output )
|
||||
output << "<#{node.expanded_name}"
|
||||
|
||||
node.attributes.to_a.sort_by {|attr| attr.name}.each do |attr|
|
||||
node.attributes.to_a.sort_by {|attr| attr.expanded_name}.each do |attr|
|
||||
output << " "
|
||||
attr.write( output )
|
||||
end unless node.attributes.empty?
|
||||
|
|
|
@ -128,7 +128,9 @@ module REXML
|
|||
def wrap(string, width)
|
||||
# Recursivly wrap string at width.
|
||||
return string if string.length <= width
|
||||
place = string.rindex(' ', width) # Position in string with last ' ' before cutoff
|
||||
place = string.rindex(/\s/, width) # Position in string with last ' ' before cutoff
|
||||
place = string.index(/\s/) if place.nil? # Otherwise first space
|
||||
return string if place.nil? # otherwise, whole string
|
||||
return string[0,place] + "\n" + wrap(string[place+1..-1], width)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue