lib/wparser/inline/deleted.rb in wparser-0.0.2 vs lib/wparser/inline/deleted.rb in wparser-0.1.0
- old
+ new
@@ -1,9 +1,13 @@
-module Deleted
- def parse line
- parse_line = line.sub(/-\b(\w*)\b-/){|s| "<S>#$1</S>"}
- return line if parse_line == nil
- parse_line
- end
+require 'wparser/parse'
- module_function :parse
+module Inlines
+ class Deleted < Parse
+ def self.parse line
+ @result = line.gsub!(/(?:(?!\\-)(^|.)-)(.+?)(?:(?!\\-)(.)-)/){|s|
+ "#$1<S>#$2#$3</S>"
+ }
+ @result = line.gsub!(/\\-/, '-')
+ super
+ end
+ end
end