Class: Markbridge::Parsers::BBCode::Handlers::QuoteHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::BBCode::Handlers::QuoteHandler
- Defined in:
- lib/markbridge/parsers/bbcode/handlers/quote_handler.rb
Overview
Handler for QUOTE tags Supports:
- quote]text[/quote
- quote=author]text[/quote
- quote=“author”]text[/quote
- quote author=username]text[/quote
- quote=“username, post:123, topic:456”]text[/quote
-
(Discourse format)
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
-
#initialize ⇒ QuoteHandler
constructor
A new instance of QuoteHandler.
- #on_open(token:, context:, registry:, tokens: nil) ⇒ Object
Methods inherited from BaseHandler
Constructor Details
#initialize ⇒ QuoteHandler
Returns a new instance of QuoteHandler.
15 16 17 |
# File 'lib/markbridge/parsers/bbcode/handlers/quote_handler.rb', line 15 def initialize @element_class = AST::Quote end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
25 26 27 |
# File 'lib/markbridge/parsers/bbcode/handlers/quote_handler.rb', line 25 def element_class @element_class end |
Instance Method Details
#on_open(token:, context:, registry:, tokens: nil) ⇒ Object
19 20 21 22 23 |
# File 'lib/markbridge/parsers/bbcode/handlers/quote_handler.rb', line 19 def on_open(token:, context:, registry:, tokens: nil) attrs = extract_quote_attrs(token) element = AST::Quote.new(**attrs) context.push(element, token:) end |