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

Inherits:
Abstract
  • Object
show all
Defined in:
mod/core/chunk/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 and

 blocks
and within HTML tags.

Constant Summary collapse

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

Instance Attribute Summary

Attributes inherited from Abstract

#process_chunk, #text

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

#as_json, #burn_after_reading, #burn_read, #card, context_ok?, #format, full_match, #initialize, #inspect, #reference_code, #result, #to_s

Constructor Details

This class inherits a constructor from Card::Content::Chunk::Abstract

Class Method Details

.full_re(prefix) ⇒ Object



17
18
19
# File 'mod/core/chunk/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 'mod/core/chunk/literal.rb', line 21

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