Sha256: d00cb99d0657f0245429d105013c79b4c041ccc7a6547ef3cdfdf900daeec890

Contents?: true

Size: 668 Bytes

Versions: 4

Compression:

Stored size: 668 Bytes

Contents

require 'polytexnic/literal'

module Polytexnic
  module Postprocessor
    module Latex

      # Restores literal environments (verbatim, code, math, etc.).
      def replace_hashes(polytex)
        puts polytex if debug?
        polytex.tap do
          literal_cache.each do |key, value|
            puts value.inspect if debug?
            polytex.gsub!(key, extra_escape(escape_backslashes(value)))
          end
        end
      end

      # Escapes backslashes even more.
      # Have I mentioned how much I hate backslashes?
      def extra_escape(string)
        string.gsub("\\'", '\\\\\\\\' + "'")
        # raise string.inspect
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
polytexnic-1.10.6 lib/polytexnic/postprocessors/latex.rb
polytexnic-1.10.5 lib/polytexnic/postprocessors/latex.rb
polytexnic-1.10.4 lib/polytexnic/postprocessors/latex.rb
polytexnic-1.10.3 lib/polytexnic/postprocessors/latex.rb