Sha256: 4c45979e04308d253ccbf550817bc0ef4882edaaa0025d70c1fcfae7ba25cf8e

Contents?: true

Size: 543 Bytes

Versions: 4

Compression:

Stored size: 543 Bytes

Contents

require 'wparser/parse'

module Blocks
  class List_number < Parse
    def self.parse line
      rex = /^\#\s*(\w*)/
        @result = if line =~ rex and @list_flag == nil 
                    @list_flag = true
                    line.sub(rex, "<ol>\n<li>#$1</li>")
                  elsif line =~ rex 
                    line.sub(rex, "<li>#$1</li>")
                  elsif line !~ rex and @list_flag == true
                    @list_flag = nil 
                    "</ol>#{line}\n"
                  end 
      super

    end 
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wparser-0.1.3 lib/wparser/block/list_number.rb
wparser-0.1.2 lib/wparser/block/list_number.rb
wparser-0.1.1 lib/wparser/block/list_number.rb
wparser-0.1.0 lib/wparser/block/list_number.rb