Sha256: 1fbdec456c4426cae0e9df6d92ca6de82248645959afe264a8c90c7c459a3f40

Contents?: true

Size: 640 Bytes

Versions: 5

Compression:

Stored size: 640 Bytes

Contents

module MaRuKu
  class MDElement
    def md_inline_math(math)
      self.md_el(:inline_math, [], :math => math)
    end

    def md_equation(math, label, numerate)
      reglabel = /\\label\{(\w+)\}/
      math = math.gsub(reglabel, '') if label = math[reglabel, 1]
      num = nil
      if (label || numerate) && @doc # take number
        @doc.eqid2eq ||= {}
        num = @doc.eqid2eq.size + 1
        label = "eq#{num}" unless label # TODO do id for document
      end
      e = self.md_el(:equation, [], :math => math, :label => label, :num => num)
      @doc.eqid2eq[label] = e if label && @doc # take number
      e
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
maruku-0.7.3 lib/maruku/ext/math/elements.rb
maruku-0.7.2 lib/maruku/ext/math/elements.rb
maruku-0.7.1 lib/maruku/ext/math/elements.rb
maruku-0.7.0 lib/maruku/ext/math/elements.rb
maruku-0.7.0.beta1 lib/maruku/ext/math/elements.rb