Sha256: f57f7b657abe3277e006aaecce7ca7835d0e5d65efe94c6e929e47e5ebc8c8d2

Contents?: true

Size: 925 Bytes

Versions: 14

Compression:

Stored size: 925 Bytes

Contents

# -*- coding: utf-8 -*-
#
#--
# Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
#
# This file is part of kramdown which is licensed under the MIT.
#++
#

module Kramdown::Converter::MathEngine

  # Uses the Itex2MML library for converting math formulas to MathML.
  module Itex2MML

    begin
      require 'itextomml'

      # Itex2MML is available if this constant is +true+.
      AVAILABLE = true
    rescue LoadError
      AVAILABLE = false  # :nodoc:
    end

    def self.call(converter, el, opts)
      type = el.options[:category]
      parser = ::Itex2MML::Parser.new
      result = (type == :block ? parser.block_filter(el.value) : parser.inline_filter(el.value))

      attr = el.attr.dup
      attr.delete('xmlns')
      attr.delete('display')
      result.insert("<math".length, converter.html_attributes(attr))

      (type == :block ? "#{' '*opts[:indent]}#{result}\n" : result)
    end

  end

end

Version data entries

14 entries across 13 versions & 5 rubygems

Version Path
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/kramdown-1.8.0/lib/kramdown/converter/math_engine/itex2mml.rb
kramdown-1.10.0 lib/kramdown/converter/math_engine/itex2mml.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/kramdown-1.8.0/lib/kramdown/converter/math_engine/itex2mml.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/kramdown-1.8.0/lib/kramdown/converter/math_engine/itex2mml.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/kramdown-1.8.0/lib/kramdown/converter/math_engine/itex2mml.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/kramdown-1.9.0/lib/kramdown/converter/math_engine/itex2mml.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/logstash-codec-json-2.0.3/vendor/gems/kramdown-1.9.0/lib/kramdown/converter/math_engine/itex2mml.rb
logstash-codec-json-2.0.3 vendor/gems/kramdown-1.9.0/lib/kramdown/converter/math_engine/itex2mml.rb
logstash-input-beats-0.9.2 vendor/jruby/1.9/gems/kramdown-1.9.0/lib/kramdown/converter/math_engine/itex2mml.rb
logstash-input-beats-0.9.1 vendor/jruby/1.9/gems/kramdown-1.9.0/lib/kramdown/converter/math_engine/itex2mml.rb
kramdown-1.9.0 lib/kramdown/converter/math_engine/itex2mml.rb
kramdown-1.8.0 lib/kramdown/converter/math_engine/itex2mml.rb
kramdown-1.7.0 lib/kramdown/converter/math_engine/itex2mml.rb
kramdown-1.6.0 lib/kramdown/converter/math_engine/itex2mml.rb