Class: Markbridge::Parsers::BBCode::Handlers::SizeHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::BBCode::Handlers::SizeHandler
- Defined in:
- lib/markbridge/parsers/bbcode/handlers/size_handler.rb
Overview
Handler for SIZE tags Supports:
- size=20]text[/size
- size=large]text[/size
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
- #auto_closeable? ⇒ Boolean
-
#initialize ⇒ SizeHandler
constructor
A new instance of SizeHandler.
- #on_open(token:, context:, registry:, tokens: nil) ⇒ Object
Methods inherited from BaseHandler
Constructor Details
#initialize ⇒ SizeHandler
Returns a new instance of SizeHandler.
12 13 14 |
# File 'lib/markbridge/parsers/bbcode/handlers/size_handler.rb', line 12 def initialize @element_class = AST::Size end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
26 27 28 |
# File 'lib/markbridge/parsers/bbcode/handlers/size_handler.rb', line 26 def element_class @element_class end |
Instance Method Details
#auto_closeable? ⇒ Boolean
22 23 24 |
# File 'lib/markbridge/parsers/bbcode/handlers/size_handler.rb', line 22 def auto_closeable? true end |
#on_open(token:, context:, registry:, tokens: nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/markbridge/parsers/bbcode/handlers/size_handler.rb', line 16 def on_open(token:, context:, registry:, tokens: nil) size = token.attrs[:size] || token.attrs[:option] element = AST::Size.new(size:) context.push(element, token:) end |