Class: Markbridge::Parsers::HTML::Handlers::UrlHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::HTML::Handlers::UrlHandler
- Defined in:
- lib/markbridge/parsers/html/handlers/url_handler.rb
Overview
Handler for <a> tags
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
-
#initialize ⇒ UrlHandler
constructor
A new instance of UrlHandler.
- #process(element:, parent:) ⇒ Object
Constructor Details
#initialize ⇒ UrlHandler
Returns a new instance of UrlHandler.
9 10 11 |
# File 'lib/markbridge/parsers/html/handlers/url_handler.rb', line 9 def initialize @element_class = AST::Url end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
22 23 24 |
# File 'lib/markbridge/parsers/html/handlers/url_handler.rb', line 22 def element_class @element_class end |
Instance Method Details
#process(element:, parent:) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/markbridge/parsers/html/handlers/url_handler.rb', line 13 def process(element:, parent:) href = element["href"] ast_element = AST::Url.new(href:) parent << ast_element # Return element to signal: process children into this element (link text) ast_element end |