Module: Markita::Markdown::List
- Defined in:
- lib/markita/markdown/list.rb
Overview
Module to isolate from Markdown
Constant Summary collapse
- RGX =
rubocop:disable Lint/MixedRegexpCaptureTypes
/^(?<spaces>\s{0,3}) (?<bullet>[*]|(\d+\.)|(-\s\[(\s|x)\])) \s(?<text>\S.*)$/x
Class Method Summary collapse
-
.level_bullet_text(line) ⇒ Object
rubocop:enable Lint/MixedRegexpCaptureTypes.
-
.style(check) ⇒ Object
:reek:ControlParameter.
- .type(bullet) ⇒ Object
Class Method Details
.level_bullet_text(line) ⇒ Object
rubocop:enable Lint/MixedRegexpCaptureTypes
16 17 18 19 |
# File 'lib/markita/markdown/list.rb', line 16 def self.level_bullet_text(line) mdt = RGX.match(line) [mdt[:spaces].length, mdt[:bullet], mdt[:text]] if mdt end |
.style(check) ⇒ Object
:reek:ControlParameter
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/markita/markdown/list.rb', line 22 def self.style(check) case check when ' ' %q( style="list-style-type: '☐ '") when 'x' %q( style="list-style-type: '☑ '") else '' end end |
.type(bullet) ⇒ Object
33 34 35 |
# File 'lib/markita/markdown/list.rb', line 33 def self.type(bullet) bullet[0] =~ /\d/ ? 'ol' : 'ul' end |