Class: TaxonWorks::Vendor::Serrano::CrossRefLaTeX

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/vendor/serrano.rb

Instance Method Summary collapse

Instance Method Details

#apply(value) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/vendor/serrano.rb', line 16

def apply(value)
  if value.is_a? String
    value = value.gsub(/\$\\less\$\/?\w+\$\\greater\$/,
      '$\less$i$\greater$' => '<i>', '$\less$/i$\greater$' => '</i>',
      '$\less$em$\greater$' => '<i>', '$\less$/em$\greater$' => '</i>' # Some times <em> is used for scientific names, making sense to translate to TW-supported <i>
    )
  end
  ::LaTeX.decode(value)
end