Class: PointBlank::Parsing::FencedCodeBlock

Inherits:
NullParser
  • Object
show all
Defined in:
lib/mmmd/blankshell.rb

Overview

Fenced code block

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NullParser

#close, #initialize, #parsed_content

Constructor Details

This class inherits a constructor from PointBlank::Parsing::NullParser

Class Method Details

.begin?(line) ⇒ Boolean

Returns:

  • (Boolean)


728
729
730
# File 'lib/mmmd/blankshell.rb', line 728

def self.begin?(line)
  line.start_with?(/\A {0,3}(?:`{3,}[^`]+$|~{3,}[^~]+$)/)
end

Instance Method Details

#applyprops(block) ⇒ Object



733
734
735
# File 'lib/mmmd/blankshell.rb', line 733

def applyprops(block)
  block.properties["infoline"] = @infoline
end

#consume(line, _parent = nil, **_hargs) ⇒ Array(String, Boolean)

Consume line markers

Parameters:

  • line (String)

Returns:

  • (Array(String, Boolean))


738
739
740
741
742
743
744
745
# File 'lib/mmmd/blankshell.rb', line 738

def consume(line, _parent = nil, **_hargs)
  return [nil, false] if @closed

  try_close(line)
  push(line.gsub(/^ {0,#{@space}}/, '')) if @open && !@closed
  self.open(line)
  ["", false]
end