Sha256: a373208d878fcf8cb485e37585d524a68626a09bf21c7ceb7169a90acb03bb2c

Contents?: true

Size: 883 Bytes

Versions: 8

Compression:

Stored size: 883 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 = { "[" => /\A\\\[\[[^\]]*\]\]/,
                    "{" => /\A\\\{\{[^\}]*\}\}/ }.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(/^\\(.)/, format.escape_literal('\1'))
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
card-mod-content-0.11.4 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.11.3 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.11.2 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.11.1 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.11.0 lib/card/content/chunk/escaped_literal.rb
card-1.100.0 mod/core/chunk/escaped_literal.rb
card-1.99.6 mod/core/chunk/escaped_literal.rb
card-1.99.5 mod/core/chunk/escaped_literal.rb