Method: Lcms::Engine::EmbedEquations.call
- Defined in:
- app/services/lcms/engine/embed_equations.rb
.call(content) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/services/lcms/engine/embed_equations.rb', line 10 def call(content) frag = Nokogiri::HTML.fragment(content) frag.css('img').each do |img| tex = fetch_tex img[:src] html = tex_to_html tex next unless (equation_node = Nokogiri::HTML.fragment(html).at_css('span')) img.replace(equation_node) end frag.to_s end |