def to_html_equation
mathml = get_setting(:html_math_output_mathml) && render_mathml(:equation, self.math)
png = get_setting(:html_math_output_png) && render_png(:equation, self.math)
div = create_html_element 'div'
add_class_to(div, 'maruku-equation')
if mathml
add_class_to(mathml, 'maruku-mathml')
div << mathml
end
if png
img = adjust_png(png, use_depth=false)
add_class_to(img, 'maruku-png')
div << img
end
source_span = Element.new 'span'
add_class_to(source_span, 'maruku-eq-tex')
code = convert_to_mathml_none(:equation, self.math.strip)
code.attributes['style'] = 'display: none'
source_span << code
div << source_span
if self.label
span = Element.new 'span'
span.attributes['class'] = 'maruku-eq-number'
num = self.num
span << Text.new("(#{num})")
div << span
div.attributes['id'] = "eq:#{self.label}"
end
div
end