Sha256: 50d524479bca822f7ea3c6a78184234552afa4d83524aa25d96184183bfc44fb

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 Bytes

Contents

require 'wparser/inline/heading'
require 'wparser/inline/strong'
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.collect {|line| parse_line line}

    Http.parse parse_lines.to_s
  end

  private
  # 1行ずつ処理したいメソッド郡
  def parse_line line
    if line =~ /^<pre.*>/
      @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 = 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wparser-0.1.1 lib/wparser/inline/inline.rb
wparser-0.1.0 lib/wparser/inline/inline.rb