Sha256: 87125a84a733dc04535077c9ceddfbf4fd31ddd3fae58e87773a488d7a2fbdc2

Contents?: true

Size: 574 Bytes

Versions: 13

Compression:

Stored size: 574 Bytes

Contents

module BibTeX
  begin
    original_verbosity = $VERBOSE
    $VERBOSE = nil

    require 'iconv'

    @iconv = Iconv.new('ascii//translit//ignore', 'utf-8')

    def self.transliterate(str)
      @iconv.iconv(str)
    end
  rescue LoadError
    @iconv_replacements = Hash['ä', 'ae', 'ö', 'oe', 'ü', 'ue', 'Ä', 'Ae', 'Ö', 'Oe', 'Ü', 'Ue', 'ß', 'ss']

    # Returns +str+ transliterated containing only ASCII characters.
    def self.transliterate(str)
      str.gsub(/[äöüÄÖÜß]/, @iconv_replacements)
    end
  ensure
    $VERBOSE = original_verbosity
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
bibtex-ruby-6.1.0 lib/bibtex/compatibility.rb
bibtex-ruby-6.0.0 lib/bibtex/compatibility.rb
bibtex-ruby-5.1.6 lib/bibtex/compatibility.rb
bibtex-ruby-5.1.5 lib/bibtex/compatibility.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/bibtex-ruby-5.1.4/lib/bibtex/compatibility.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/bibtex-ruby-5.1.4/lib/bibtex/compatibility.rb
bibtex-ruby-5.1.4 lib/bibtex/compatibility.rb
bibtex-ruby-5.1.3 lib/bibtex/compatibility.rb
bibtex-ruby-5.1.2 lib/bibtex/compatibility.rb
bibtex-ruby-5.1.1 lib/bibtex/compatibility.rb
bibtex-ruby-5.1.0 lib/bibtex/compatibility.rb
bibtex-ruby-5.0.1 lib/bibtex/compatibility.rb
bibtex-ruby-5.0.0 lib/bibtex/compatibility.rb