Sha256: 859e4849210f313201c847b061c4f583165112164a78ff69381e49bc7b974e17

Contents?: true

Size: 1.34 KB

Versions: 12

Compression:

Stored size: 1.34 KB

Contents

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

module LaTeX
  module Decode

    class Punctuation < Decoder

      @macros = Hash[*%w{
        textendash         –
        textemdash         —
        textquoteleft      ‘
        textquoteright     ’
        quotesinglbase     ‚
        textquotedblleft   “
        textquotedblright  ”
        quotedblbase       „
        dag                †
        ddag               ‡
        textbullet         •
        dots               …
        textperthousand    ‰
        textpertenthousand ‱
        guilsinglleft      ‹
        guilsinglright     ›
        textreferencemark  ※
        textinterrobang    ‽
        textoverline       ‾
        langle             ⟨
        rangle             ⟩
        textasciicircum    ^
        textbackslash      \\
        textasciitilde     ~
        textquotesingle    '
      }].freeze

      @symbols = Hash[*%w[
        -     -
        --    –
        ---   —
        ``    “
        `     ‘
        ''    ”
        '     ’
      ]].freeze

      @map = @macros.merge(@symbols).freeze

      @patterns = [
        /\\(#{ @macros.keys.map { |k| Regexp.escape(k) }.compact.join('|') })(?:\{\}|\s+|\b|$)/ou,
        /(-+|`{1,2}|'{1,2})/,
        /()\\([$%;#_&])(\{\})?/,
        /()\\(~)\{\}/,
        /()\\( )/
      ].freeze

    end

  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

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