Permalink
Browse files

allow tags inside inside headers

  • Loading branch information...
1 parent 3e809ae commit dc615e739e98f89900a36684b02c35872ccef604 @zevarito zevarito committed Nov 18, 2009
Showing with 9 additions and 1 deletion.
  1. +1 −1 lib/undress/greencloth.rb
  2. +8 −0 test/test_greencloth.rb
@@ -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"
View
@@ -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.