Class: Ecrire::Markdown::Parsers::Word

Inherits:
Base
  • Object
show all
Defined in:
lib/ecrire/markdown/parsers/word.rb

Constant Summary collapse

RULE =
/((\*{1,2})([^\*]+)(\*{1,2}))/i

Instance Method Summary collapse

Methods inherited from Base

#initialize, parse!

Constructor Details

This class inherits a constructor from Ecrire::Markdown::Parsers::Base

Instance Method Details

#parse!Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/ecrire/markdown/parsers/word.rb', line 5

def parse!
  while match = RULE.match(@node.content) do
    if match[2].length == 1
      @node.content.gsub! match[0], "<em>#{match[3]}</em>"
    elsif match[2].length == 2
      @node.content.gsub! match[0], "<strong>#{match[3]}</strong>"
    end
  end
  return @node
end