Class: Jekyll::JekyllTexEqn::RenderTexTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll-tex-eqn.rb

Overview

Liquid tag for inline equations

Constant Summary collapse

TAGNAME =
"ieqn"

Instance Method Summary collapse

Constructor Details

#initialize(tagname, text, tokens) ⇒ RenderTexTag

Returns a new instance of RenderTexTag.



252
253
254
255
256
# File 'lib/jekyll-tex-eqn.rb', line 252

def initialize(tagname, text, tokens)
  super
  @content = text
  @content.chomp
end

Instance Method Details

#render(context) ⇒ Object



258
259
260
261
262
# File 'lib/jekyll-tex-eqn.rb', line 258

def render(context)
  svg = Generate.do_render(context, @content, Util.get_option(Util::INLINE_SCALE_KEY, Util::DEFAULT_INLINE_SCALE).to_f, "$", "$")

  "<span class='#{Util.get_option(Util::INLINE_CLASS_KEY, "")}'><img width='#{svg[:width]}px' height='#{svg[:height]}px' src='/#{svg[:file]}'/></span>"
end