Sha256: b696ca2be0224ca2605770c8fe0673a49a2cc36f3f6b85df0bab7c7cb2e94f0a

Contents?: true

Size: 671 Bytes

Versions: 14

Compression:

Stored size: 671 Bytes

Contents

# -*- encoding : utf-8 -*-

# These are basic chunks that have a pattern and can be protected.
# They are used by rendering process to prevent wiki rendering
# occuring within literal areas such as <code> and <pre> blocks
# and within HTML tags.
module Card::Chunk
  class EscapedLiteral < Abstract
    FULL_RE = { '[' => /^\\\[\[[^\]]*\]\]/, '{' => /^\\\{\{[^\}]*\}\}/ }
    Card::Chunk.register_class self, {
      prefix_re: '\\\\(?:\\[\\[|\\{\\{)',
      idx_char:  '\\'
    }

    def self.full_re prefix
      re = FULL_RE[ prefix[1,1] ]
    end

    def interpret match, content
      @process_chunk = match[0].sub(/^\\(.)/, "<span>\\1</span>")
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
card-1.17.4 mod/01_core/chunk/literal.rb
card-1.17.3 mod/01_core/chunk/literal.rb
card-1.17.2 mod/01_core/chunk/literal.rb
card-1.17.1 mod/01_core/chunk/literal.rb
card-1.17.0 mod/01_core/chunk/literal.rb
card-1.16.15 mod/01_core/chunk/literal.rb
card-1.16.14 mod/01_core/chunk/literal.rb
card-1.16.13 mod/01_core/chunk/literal.rb
card-1.16.12 mod/01_core/chunk/literal.rb
card-1.16.11 mod/01_core/chunk/literal.rb
card-1.16.10 mod/01_core/chunk/literal.rb
card-1.16.9 mod/01_core/chunk/literal.rb
card-1.16.8 mod/01_core/chunk/literal.rb
card-1.16.7 mod/01_core/chunk/literal.rb