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=author]text
- [quote="author"]text
- [quote author=username]text
- [quote="username, post:2, topic:456"]text (Discourse format)
Attribution semantics are Discourse's: post: is the post's
number within its topic and topic: is the topic id. Beware
when feeding other dialects through this handler — XenForo
attributions ("name, post: 12345, member: 678") also match the
post: pattern, but there the value is a database post id, not
a post number.
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.
22 23 24 |
# File 'lib/markbridge/parsers/bbcode/handlers/quote_handler.rb', line 22 def initialize @element_class = AST::Quote end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
32 33 34 |
# File 'lib/markbridge/parsers/bbcode/handlers/quote_handler.rb', line 32 def element_class @element_class end |
Instance Method Details
#on_open(token:, context:, registry:, tokens: nil) ⇒ Object
26 27 28 29 30 |
# File 'lib/markbridge/parsers/bbcode/handlers/quote_handler.rb', line 26 def on_open(token:, context:, registry:, tokens: nil) attrs = extract_quote_attrs(token) element = AST::Quote.new(**attrs) context.push(element, token:) end |