Skip to content

Commit

Permalink
Apply quote remover to document body
Browse files Browse the repository at this point in the history
This isn't particularly nice as unlike the other extensions this is
applied to the whole body rather than a matched section. Thus this is
applied outside of the extension system.
  • Loading branch information
kevindew committed Aug 5, 2016
1 parent cfcd1c7 commit 7a597b7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/govspeak.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def structured_headers
end

def preprocess(source)
source = Govspeak::BlockquoteExtraQuoteRemover.remove(source)
@@extensions.each do |title,regexp,block|
source.gsub!(regexp) {
instance_exec(*Regexp.last_match.captures, &block)
Expand Down
21 changes: 21 additions & 0 deletions test/govspeak_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,27 @@ class GovspeakTest < Minitest::Test
end
end

test "should remove quotes surrounding a blockquote" do
govspeak = %Q{
He said:
> "I'm not sure what you mean!"
Or so we thought.}

given_govspeak(govspeak) do
assert_html_output %|
<p>He said:</p>
<blockquote>
<p class="last-child">I’m not sure what you mean!</p>
</blockquote>
<p>Or so we thought.</p>
|
end
end

test "should add class to last paragraph of blockquote" do
govspeak = "
> first line
Expand Down

0 comments on commit 7a597b7

Please sign in to comment.