Sha256: 3e6e9783a352d64f8310ff6a7f52f47f7398216f82c8713d61ac65f8fb9cc3cf

Contents?: true

Size: 849 Bytes

Versions: 9

Compression:

Stored size: 849 Bytes

Contents

# -*- coding: utf-8 -*-

module LaTeX
  module Decode
    
    class Accents < Decoder
      @map = Hash[*%W{
        `  \u0300
        '  \u0301
        ^  \u0302
        ~  \u0303
        =  \u0304
        .  \u0307
        '' \u0308
        "  \u0308  
      }.map { |s| LaTeX.to_unicode(s) }].freeze

      @patterns = [
        ruby_18 {
          /\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })\{([[:alpha:]]*)\}/ou          
        } ||
        ruby_19 {
          /\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })\{(\p{L}\p{M}*)\}/ou
        },
        ruby_18 {
          /\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })([[:alpha:]])/ou          
        } ||
        ruby_19 {
          /\\(#{ map.keys.map { |k| Regexp.escape(k) }.join('|') })(\p{L}\p{M}*)/ou
        }
      ].freeze
      
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
latex-decode-0.0.10 lib/latex/decode/accents.rb
latex-decode-0.0.9 lib/latex/decode/accents.rb
latex-decode-0.0.8 lib/latex/decode/accents.rb
latex-decode-0.0.7 lib/latex/decode/accents.rb
latex-decode-0.0.6 lib/latex/decode/accents.rb
latex-decode-0.0.5 lib/latex/decode/accents.rb
latex-decode-0.0.4 lib/latex/decode/accents.rb
latex-decode-0.0.3 lib/latex/decode/accents.rb
latex-decode-0.0.2 lib/latex/decode/accents.rb