Sha256: 1664af3b1da1e4b9f19bcaff1bcac6bc06ec01a4262f2437388c74ae7e5ae213

Contents?: true

Size: 523 Bytes

Versions: 4

Compression:

Stored size: 523 Bytes

Contents

require 'wparser/parser'

module Blocks
  class List_nonumber < Parse
    def self.parse line
      rex = /^\*\s*(\w*)/
      @result = if line =~ rex and @list_flag == nil
                  @list_flag = true
                  line.sub(rex, "<ul>\n<li>#$1</li>")
                elsif line =~ rex
                  line.sub(rex, "<li>#$1</li>")
                elsif line !~ rex and @list_flag == true
                  @list_flag = nil
                  "</ul>#{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_nonumber.rb
wparser-0.1.2 lib/wparser/block/list_nonumber.rb
wparser-0.1.1 lib/wparser/block/list_nonumber.rb
wparser-0.1.0 lib/wparser/block/list_nonumber.rb