Sha256: a732311cfe9e8922c4d8a4ce80c750212eceb8a3c48bef52c9d148a1cd9c2a07

Contents?: true

Size: 677 Bytes

Versions: 41

Compression:

Stored size: 677 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

41 entries across 41 versions & 2 rubygems

Version Path
card-1.16.6 mod/01_core/chunk/literal.rb
card-1.16.5 mod/01_core/chunk/literal.rb
card-1.16.4 mod/01_core/chunk/literal.rb
card-1.16.3 mod/01_core/chunk/literal.rb
card-1.16.2 mod/01_core/chunk/literal.rb
card-1.16.1 mod/01_core/chunk/literal.rb
card-1.16.0 mod/01_core/chunk/literal.rb
card-1.15.7 mod/01_core/chunk/literal.rb
card-1.15.6 mod/01_core/chunk/literal.rb
card-1.15.5 mod/01_core/chunk/literal.rb
card-1.15.4 mod/01_core/chunk/literal.rb
card-1.15.3 mod/01_core/chunk/literal.rb
card-1.15.2 mod/01_core/chunk/literal.rb
card-1.15.1 mod/01_core/chunk/literal.rb
card-1.15.0 mod/01_core/chunk/literal.rb
card-1.15.pre2 mod/01_core/chunk/literal.rb
card-1.15.pre mod/01_core/chunk/literal.rb
wagn-1.14.9 mod/01_core/chunk/literal.rb
wagn-1.14.8 mod/01_core/chunk/literal.rb
wagn-1.14.7 mod/01_core/chunk/literal.rb