Sha256: 399742b98626ac0e418cce783dc2eab659de070c96c4e6a7aa7d00f2fb2a5b80

Contents?: true

Size: 881 Bytes

Versions: 24

Compression:

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

24 entries across 24 versions & 1 rubygems

Version Path
card-mod-content-0.18.1 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.18.0 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.17.0 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.16.0 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.15.6 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.15.5 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.15.4 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.15.3 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.15.2.pre1 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.15.1.1 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.15.1 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.15.0 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.14.2 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.14.1 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.14.0 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.13.4 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.13.3 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.13.2 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.13.1 lib/card/content/chunk/escaped_literal.rb
card-mod-content-0.13.0 lib/card/content/chunk/escaped_literal.rb