Class: Markdownlyze::Elements::Ol

Inherits:
Base
  • Object
show all
Defined in:
lib/markdownlyze/elements/ol.rb

Instance Attribute Summary

Attributes inherited from Base

#skip_until

Instance Method Summary collapse

Methods inherited from Base

#initialize, #options

Constructor Details

This class inherits a constructor from Markdownlyze::Elements::Base

Instance Method Details

#valueObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/markdownlyze/elements/ol.rb', line 4

def value
  @lines[@index..-1].each_with_index do |subline, subindex|
    if !subline.match?(/^\d+\. .*/)
      @skip_until = @index + subindex
      break
    end
  end

  @skip_until = @lines.size if @skip_until.nil?

  @lines[@index..(@skip_until - 1)].map { |line| to_html(line.gsub(/^\d+\. /, '')) }
end