Sha256: 59bf7d93ef68a17fe1d64903eb06c1fdfad32250318460431dbf75f55ee28bc2

Contents?: true

Size: 872 Bytes

Versions: 48

Compression:

Stored size: 872 Bytes

Contents

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

class Card
  class Content
    module Chunk
      # 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.
      class EscapedLiteral < Abstract
        FULL_RE = { "[" => /^\\\[\[[^\]]*\]\]/,
                    "{" => /^\\\{\{[^\}]*\}\}/ }.freeze
        Card::Content::Chunk.register_class self,
                                            prefix_re: '\\\\(?:\\[\\[|\\{\\{)',
                                            idx_char:  '\\'

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

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

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
card-1.97.0.1 mod/core/chunk/literal.rb
card-1.97.0 mod/core/chunk/literal.rb
card-1.96.8 mod/core/chunk/literal.rb
card-1.96.7 mod/core/chunk/literal.rb
card-1.96.6 mod/core/chunk/literal.rb
card-1.96.5 mod/core/chunk/literal.rb
card-1.96.4 mod/core/chunk/literal.rb
card-1.96.3 mod/core/chunk/literal.rb
card-1.96.2 mod/core/chunk/literal.rb
card-1.96.1 mod/core/chunk/literal.rb
card-1.96.0 mod/core/chunk/literal.rb
card-1.95.3 mod/core/chunk/literal.rb
card-1.95.2 mod/core/chunk/literal.rb
card-1.95.1 mod/core/chunk/literal.rb
card-1.95.0 mod/core/chunk/literal.rb
card-1.94.1 mod/core/chunk/literal.rb
card-1.94.0 mod/core/chunk/literal.rb
card-1.93.13 mod/core/chunk/literal.rb
card-1.93.12 mod/core/chunk/literal.rb
card-1.93.11 mod/core/chunk/literal.rb