Sha256: 7d2fae39644418e0cb6dd0df114b8ced5f51b529b45892772e1e836557d17045
Contents?: true
Size: 750 Bytes
Versions: 2
Compression:
Stored size: 750 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('\\', '\\\\\\'). gsub("\\'", '\\\\' + "'"). gsub('\\\\\\', '\\\\\\'). gsub('\\\\ ', '\\\\ ') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
polytexnic-1.10.8 | lib/polytexnic/postprocessors/latex.rb |
polytexnic-1.10.7 | lib/polytexnic/postprocessors/latex.rb |