Sha256: 8b264f37ec2b3013af1aa00488ae6106663a55c95daaa159121d4fe580779c1a

Contents?: true

Size: 872 Bytes

Versions: 6

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

6 entries across 6 versions & 1 rubygems

Version Path
card-1.18.6 mod/01_core/chunk/literal.rb
card-1.18.5 mod/01_core/chunk/literal.rb
card-1.18.4 mod/01_core/chunk/literal.rb
card-1.18.3 mod/01_core/chunk/literal.rb
card-1.18.2 mod/01_core/chunk/literal.rb
card-1.18.1 mod/01_core/chunk/literal.rb