Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

Commit

Permalink
allow tags inside inside headers
Browse files Browse the repository at this point in the history
  • Loading branch information
zevarito committed Nov 18, 2009
1 parent 3e809ae commit dc615e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/undress/greencloth.rb
Expand Up @@ -65,7 +65,7 @@ class GreenCloth < Textile
def process_headings(h)
h.children.each {|e|
next if e.class == Hpricot::Text
e.parent.replace_child(e, "") if e.name != "a" || e.has_attribute?("href") && e["href"] !~ /^\/|(https?|s?ftp):\/\//
e.parent.replace_child(e, "") if e.has_attribute?("href") && e["href"] !~ /^\/|(https?|s?ftp):\/\//
}
case h.name
when "h1"
Expand Down
8 changes: 8 additions & 0 deletions test/test_greencloth.rb
Expand Up @@ -424,4 +424,12 @@ def assert_not_renders_greencloth(greencloth, html)
assert_renders_greencloth greencloth, html
end
end

context "troubles with headings" do
test "with h1" do
html = "<h1 class='first'><a name='this-is-h1-text---this-is-h1-text'></a><span class='caps'>THIS</span> IS H1 <span class='caps'>TEXT</span> - this is h1 text<a class='anchor' href='#this-is-h1-text---this-is-h1-text'>¶</a></h1>"
greencloth = "THIS IS H1 TEXT - this is h1 text\n=================================\n"
assert_renders_greencloth greencloth, html
end
end
end

0 comments on commit dc615e7

Please sign in to comment.