Browse files

Prevent 'xaa' getting picked up by the external link extension.

This fix is a bit of a hack, it would be better if we could require
a matching closing symbol, but we'd need to review all existing content
before doing that.
  • Loading branch information...
1 parent 3b36a43 commit 0b817a21cad247891e428566e7f99fc4c4445520 @heathd heathd committed Mar 22, 2012
Showing with 12 additions and 3 deletions.
  1. +2 −2 lib/govspeak.rb
  2. +1 −1 lib/govspeak/version.rb
  3. +9 −0 test/govspeak_test.rb
View
4 lib/govspeak.rb
@@ -87,8 +87,8 @@ def insert_strong_inside_p(body, parser=Kramdown::Document)
#{Kramdown::Document.new(body.strip).to_html}</div>\n}
}
- extension('external', surrounded_by("x")) { |body|
- Kramdown::Document.new("#{body.strip}{:rel='external'}").to_html
+ extension('external', surrounded_by("x[", "x")) { |body|
+ Kramdown::Document.new("[#{body.strip}{:rel='external'}").to_html
}
extension('informational', surrounded_by("^")) { |body|
View
2 lib/govspeak/version.rb
@@ -1,3 +1,3 @@
module Govspeak
- VERSION = "0.8.10"
+ VERSION = "0.8.11"
end
View
9 test/govspeak_test.rb
@@ -183,6 +183,15 @@ class GovspeakTest < Test::Unit::TestCase
assert_text_output "a link"
end
+ # Regression test - the surrounded_by helper doesn't require the closing x
+ # so 'xaa' was getting picked up by the external link helper above
+ # TODO: review whether we should require closing symbols for these extensions
+ # need to check all existing content.
+ test_given_govspeak "xaa" do
+ assert_html_output '<p>xaa</p>'
+ assert_text_output "xaa"
+ end
+
test_given_govspeak "
$!
rainbow

0 comments on commit 0b817a2

Please sign in to comment.