lib/review/latexutils.rb in review-5.0.0 vs lib/review/latexutils.rb in review-5.1.0

- old
+ new

@@ -57,11 +57,11 @@ char_jisx0208 = NKF.nkf('-WwX', char) @metachars[char] = "\\aj半角{#{char_jisx0208}}" end end - @metachars_re = /[#{Regexp.escape(@metachars.keys.join(''))}]/u + @metachars_re = /[#{Regexp.escape(@metachars.keys.join(''))}]/u # rubocop:disable Style/RedundantArgument @metachars_invert = @metachars.invert end def escape(str) @@ -77,9 +77,17 @@ alias_method :unescape_latex, :unescape # backward compatibility def escape_index(str) str.gsub(/[@!|"]/) { |s| '"' + s } + end + + def escape_mendex_key(str) + str.gsub('"|', '|').tr('{', '{').tr('}', '}') + end + + def escape_mendex_display(str) + str.gsub('\{', '\reviewleftcurlybrace{}').gsub('\}', '\reviewrightcurlybrace{}') end def escape_url(str) str.gsub(/[\#%]/) { |s| '\\' + s } end