lib/asciidoctor/latex/chem.rb in asciidoctor-latex-1.5.0.1.dev vs lib/asciidoctor/latex/chem.rb in asciidoctor-latex-1.5.0.2.dev

- old
+ new

@@ -1,24 +1,32 @@ require 'asciidoctor' require 'asciidoctor/extensions' -# Modify the default mathJax script to run mhchem instead -# of autonumbuering of equations -- which is taken care of -# by [env.equation], [env.equationalign] -# -# See http://www.noteshare.io/section/the-chem-environment -# + module Asciidoctor::LaTeX - # Map @@DOLLAR: to $ + # Modify the default mathJax script to run mhchem instead + # of auto numbering of equations. Autonumbering is taken care of + # by [env.equation], [env.equationalign] + # + # See http://www.noteshare.io/section/the-chem-environment + # + # This is a hack. #FIXME! class Chem < Asciidoctor::Extensions::Postprocessor - def process document, output - output = output.gsub($tex_snippet, $chem_snippet) + def process(document, output) + output.gsub(TEX_SNIPPET, CHEM_SNIPPET) end end -end -$tex_snippet = 'TeX: { equationNumbers: { autoNumber: "none" } }' -$chem_snippet = 'TeX: { extensions: ["mhchem.js"] }' + + TEX_SNIPPET = 'TeX: { equationNumbers: { autoNumber: "none" } }' + # In the standard MathJax script + + + CHEM_SNIPPET = 'TeX: { extensions: ["mhchem.js"] }' + # What we want in the MathJax script + + +end