Class: Qiita::Markdown::Filters::Checkbox::List
- Inherits:
-
Object
- Object
- Qiita::Markdown::Filters::Checkbox::List
- Includes:
- Mem
- Defined in:
- lib/qiita/markdown/filters/checkbox.rb
Constant Summary collapse
- CHECKBOX_CLOSE_MARK =
"[x] "
- CHECKBOX_OPEN_MARK =
"[ ] "
Instance Method Summary collapse
- #convert ⇒ Object
- #has_checkbox? ⇒ Boolean
-
#initialize(node) ⇒ List
constructor
A new instance of List.
Constructor Details
#initialize(node) ⇒ List
Returns a new instance of List.
25 26 27 |
# File 'lib/qiita/markdown/filters/checkbox.rb', line 25 def initialize(node) @node = node end |
Instance Method Details
#convert ⇒ Object
33 34 35 36 37 |
# File 'lib/qiita/markdown/filters/checkbox.rb', line 33 def convert first_text_node.content = first_text_node.content.sub(checkbox_mark, "").lstrip first_text_node.add_previous_sibling(checkbox_node) @node["class"] = "task-list-item" end |
#has_checkbox? ⇒ Boolean
29 30 31 |
# File 'lib/qiita/markdown/filters/checkbox.rb', line 29 def has_checkbox? has_open_checkbox? || has_close_checkbox? end |