Class: Markbridge::Parsers::HTML::Handlers::QuoteHandler

Inherits:
BaseHandler
  • Object
show all
Defined in:
lib/markbridge/parsers/html/handlers/quote_handler.rb

Overview

Handler for <blockquote> tags

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQuoteHandler

Returns a new instance of QuoteHandler.



9
10
11
# File 'lib/markbridge/parsers/html/handlers/quote_handler.rb', line 9

def initialize
  @element_class = AST::Quote
end

Instance Attribute Details

#element_classObject (readonly)

Returns the value of attribute element_class.



23
24
25
# File 'lib/markbridge/parsers/html/handlers/quote_handler.rb', line 23

def element_class
  @element_class
end

Instance Method Details

#process(element:, parent:) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/markbridge/parsers/html/handlers/quote_handler.rb', line 13

def process(element:, parent:)
  # Extract optional author from cite attribute
  author = element["cite"]
  ast_element = AST::Quote.new(author:)
  parent << ast_element

  # Return element to signal: process children into this element
  ast_element
end