Class: Card::Content::Chunk::KeepEscapedLiteral

Inherits:
Abstract
  • Object
show all
Defined in:
mod/core/chunk/keep_escaped_literal.rb

Overview

These are basic chunks that have a pattern and can be protected. This chunk is used for markdown processing to ensure that the escaping survives the markdown rendering.

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



16
17
18
# File 'mod/core/chunk/keep_escaped_literal.rb', line 16

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

Instance Method Details

#interpret(match, _content) ⇒ Object



20
21
22
# File 'mod/core/chunk/keep_escaped_literal.rb', line 20

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