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)


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

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

Instance Method Details

#applyprops(block) ⇒ Object



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

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))


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

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