require 'wparser/inline/heading' require 'wparser/inline/strong' require 'wparser/inline/code' require 'wparser/inline/italic' require 'wparser/inline/underLine' require 'wparser/inline/deleted' require 'wparser/inline/http' require 'wparser/inline/paragraph' module Inline include Inlines def parse text @protected_preTag = nil parse_lines = text.inject([]) do |r, line| r << parse_line(Http.parse line) end parse_lines.join end private # 1行ずつ処理したいメソッド郡 def parse_line line if line =~ /^/ @protected_preTag = true elsif line =~ /<\/pre>/ @protected_preTag = nil end parse_line = line if @protected_preTag == nil parse_line = Heading.parse parse_line parse_line = Strong.parse parse_line parse_line = Code.parse parse_line parse_line = Italic.parse parse_line parse_line = UnderLine.parse parse_line parse_line = Deleted.parse parse_line parse_line = Paragraph.parse parse_line else parse_line end end module_function :parse, :parse_line end