lib/wparser/inline/strong.rb in wparser-0.0.2 vs lib/wparser/inline/strong.rb in wparser-0.1.0

- old
+ new

@@ -1,9 +1,13 @@ -module Strong - def parse line - parse_line = line.sub(/\*\b(\w*)\b\*/){|s| "<strong>#$1</strong>"} - return line if parse_line == nil - parse_line - end +require 'wparser/parse' - module_function :parse +module Inlines + class Strong < Parse + def self.parse line + @result = line.gsub!(/(?:(?!\\\*)(^|.)\*)(.+?)(?:(?!\\\*)(.)\*)/){|s| + "#$1<strong>#$2#$3</strong>" + } + @result = line.gsub!(/\\\*/, '*') + super + end + end end