Sha256: bb24e7b093c52b9204fbc0bd5bd6aba372409a079f8d1524aa991f1b5bbb6ce1

Contents?: true

Size: 926 Bytes

Versions: 28

Compression:

Stored size: 926 Bytes

Contents

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

module LaTeX
  module Decode
    
    class Diacritics < Decoder
      @macros = Hash[*%W{
        r \u030A
        H \u030B
        u \u0306
        v \u030C
        G \u030F
        M \u0322
        d \u0323
        c \u0327
        k \u0328
        b \u0331
        B \u0335
        t \u0361
      }.map { |s| LaTeX.to_unicode(s) }].freeze

      @map = @macros.merge(Hash[*%w{
        l  ł
        L  Ł
        o  ø
        O  Ø
        AA Å
        aa å
        AE Æ
        ae æ
      }]).freeze
      
      @patterns = [
        ruby_18 {
          /\\(#{ @macros.keys.map { |k| Regexp.escape(k) }.join('|') })\{([[:alpha:]]?)([[:alpha:]]*)\}/ou          
        } ||
        ruby_19 {
          /\\(#{ @macros.keys.map { |k| Regexp.escape(k) }.join('|') })\{(\p{L}\p{M}*)([[:alpha:]]*)\}/ou
        },
        /\\(o|O|l|L|aa|AA|ae|AE)\b/,
      ].freeze
      
    end
    
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
latex-decode-0.4.0 lib/latex/decode/diacritics.rb
latex-decode-0.3.2 lib/latex/decode/diacritics.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/latex-decode-0.3.1/lib/latex/decode/diacritics.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/latex-decode-0.3.1/lib/latex/decode/diacritics.rb
latex-decode-0.3.1 lib/latex/decode/diacritics.rb
latex-decode-0.3.0 lib/latex/decode/diacritics.rb
bibtex_to_scrapbox-0.2.0 gems/gems/latex-decode-0.2.2/lib/latex/decode/diacritics.rb
bibtex_to_scrapbox-0.1.0 gems/gems/latex-decode-0.2.2/lib/latex/decode/diacritics.rb
latex-decode-0.2.2-java lib/latex/decode/diacritics.rb
latex-decode-0.2.2 lib/latex/decode/diacritics.rb
latex-decode-0.2.1-java lib/latex/decode/diacritics.rb
latex-decode-0.2.1 lib/latex/decode/diacritics.rb
latex-decode-0.2.0-java lib/latex/decode/diacritics.rb
latex-decode-0.2.0 lib/latex/decode/diacritics.rb
latex-decode-0.1.1-java lib/latex/decode/diacritics.rb
latex-decode-0.1.1 lib/latex/decode/diacritics.rb
latex-decode-0.1.0-java lib/latex/decode/diacritics.rb
latex-decode-0.1.0 lib/latex/decode/diacritics.rb
latex-decode-0.0.12-java lib/latex/decode/diacritics.rb
latex-decode-0.0.12 lib/latex/decode/diacritics.rb