diff --git a/vendor/plugins/maruku/lib/maruku/input/parse_doc.rb b/vendor/plugins/maruku/lib/maruku/input/parse_doc.rb index 59cbbf26..53c2674a 100644 --- a/vendor/plugins/maruku/lib/maruku/input/parse_doc.rb +++ b/vendor/plugins/maruku/lib/maruku/input/parse_doc.rb @@ -21,7 +21,7 @@ require 'iconv' require 'nokogiri' - +require 'strscan' module MaRuKu; module In; module Markdown; module BlockLevelParser @@ -175,12 +175,15 @@ Disabled by default because of security concerns. reg = Regexp.new(Regexp.escape(abbrev)) self.replace_each_string do |s| # bug if many abbreviations are present (agorf) - if m = reg.match(s) - e = md_abbr(abbrev.dup, title ? title.dup : nil) - [m.pre_match, e, m.post_match] - else - s - end + p=StringScanner.new(s) + a = [] + until p.eos? + o = '' + o << p.getch until p.scan(reg) or p.eos? + a << o + a << md_abbr(abbrev.dup, title ? title.dup : nil) if p.matched =~ reg + end + a end end end diff --git a/vendor/plugins/maruku/spec/block_docs/abbreviations.md b/vendor/plugins/maruku/spec/block_docs/abbreviations.md index a0c0b5cf..cef39e2e 100644 --- a/vendor/plugins/maruku/spec/block_docs/abbreviations.md +++ b/vendor/plugins/maruku/spec/block_docs/abbreviations.md @@ -3,7 +3,7 @@ Write a comment abouth the test here. {} *** Markdown input: *** -The HTML specification is maintained by the W3C. +The HTML specification is maintained by the W3C. The W3C is headquartered in Geneva. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium @@ -20,7 +20,9 @@ md_el(:document,[ md_el(:abbr,["HTML"],{:title=>"Hyper Text Markup Language"},[]), " specification is maintained by the ", md_el(:abbr,["W3C"],{:title=>"World Wide Web Consortium"},[]), - "." + ". The ", + md_el(:abbr,["W3C"],{:title=>"World Wide Web Consortium"},[]), + " is headquartered in Geneva." ]), md_el(:abbr_def,[],{:abbr=>"HTML",:text=>"Hyper Text Markup Language"},[]), md_el(:abbr_def,[],{:abbr=>"W3C",:text=>"World Wide Web Consortium"},[]), @@ -32,16 +34,17 @@ md_el(:document,[ md_el(:abbr_def,[],{:abbr=>"Tigra Genesis",:text=>nil},[]) ],{},[]) *** Output of to_html *** -

The HTML specification is maintained by the W3C.

+

The HTML specification is maintained by the W3C. The W3C is headquartered in Geneva.

Operation Tigra Genesis is going well.

*** Output of to_latex *** -The HTML specification is maintained by the W3C. +The HTML specification is maintained by the W3C. The W3C is headquartered in Geneva. Operation Tigra Genesis is going well. *** Output of to_md *** The HTML specification is maintained by -the W3C. +the W3C. The W3C is headquartered in +Geneva. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium @@ -49,4 +52,4 @@ Operation Tigra Genesis is going well. *[Tigra Genesis]: *** Output of to_s *** -The HTML specification is maintained by the W3C.Operation Tigra Genesis is going well. +The HTML specification is maintained by the W3C. The W3C is headquartered in Geneva.Operation Tigra Genesis is going well.