Class: Card::Content::Chunk::EscapedLiteral

Inherits:
Abstract
  • Object
show all
Defined in:
lib/card/content/chunk/escaped_literal.rb

Overview

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.

Constant Summary collapse

FULL_RE =
{ "[" => /\A\\\[\[[^\]]*\]\]/,
"{" => /\A\\\{\{[^}]*\}\}/ }.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.full_re(prefix) ⇒ Object



17
18
19
# File 'lib/card/content/chunk/escaped_literal.rb', line 17

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

Instance Method Details

#interpret(match, _content) ⇒ Object



21
22
23
# File 'lib/card/content/chunk/escaped_literal.rb', line 21

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