lib/wparser/block/block.rb in wparser-0.0.2 vs lib/wparser/block/block.rb in wparser-0.1.0

- old
+ new

@@ -1,17 +1,37 @@ -require 'wparser/block/blocks' +require 'wparser/block/pre' +require 'wparser/block/blockquote' require 'wparser/block/list_number' require 'wparser/block/list_nonumber' module Block include Blocks - include List_number - include List_nonumber def parse text - parse_text = Blocks.parse(text) - parse_text = List_number.parse(parse_text) - parse_text = List_nonumber.parse(parse_text) + @protected_preTag = nil + parse_text = text.collect{|line| parse_line line} end - module_function :parse + private + def parse_line line + parse_line = line + parse_line = Pre.parse parse_line + + if parse_line =~ /^<pre.*>/ + @protected_preTag = true + elsif parse_line =~ /<\/pre>/ + @protected_preTag = nil + end + + #puts @protected_preTag + + if @protected_preTag == nil + parse_line = Blockquote.parse parse_line + parse_line = List_number.parse parse_line + parse_line = List_nonumber.parse parse_line + else + parse_line + end + end + + module_function :parse, :parse_line end