Sha256: e8226293cba0704a86abcc5a88681bdfd206968f4d48c35ab61b0b9986e83e92
Contents?: true
Size: 1.23 KB
Versions: 7
Compression:
Stored size: 1.23 KB
Contents
# encoding=utf-8 module Polytexnic module Postprocessor module Polytex # Removes references to the hypertarget package. # TODO: Support hypertarget # This isn't a priority, as you get most of what you need # with hyperref. def remove_hypertarget @source.gsub!(/\\hypertarget.*$/, '') end # Fixes a kramdown verbatim bug. # When converting code, kramdown outputs # "\begin{verbatim}foo" instead of # "\begin{verbatim}\nfoo". def fix_verbatim_bug @source.gsub!(/\\begin\{verbatim\}/) { |s| s + "\n" } end # Writes the PolyTeX code environments based on the code cache. # I.e., code that looks like # {lang="ruby"} # def foo # "bar" # end # becomes # %= lang:ruby # \begin{code} # def foo # "bar" # end # \end{code} # which reduces syntax highlighting to a previously solved problem. def write_polytex_code code_cache.each do |key, (code, lang, in_codelisting, options)| latex = "%= lang:#{lang}#{options}\n" + "\\begin{code}\n#{code}\n\\end{code}" @source.gsub!(key, latex) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems