Skip to content

Commit

Permalink
use node.at instead of node.search when checking existence
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Jun 15, 2010
1 parent 49a8d8f commit 52ebb6a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/ronn/roff.rb
Expand Up @@ -50,7 +50,6 @@ def title_heading(name, section, tagline, manual, version, date)
def remove_extraneous_elements!(doc)
doc.traverse_all_element do |node|
if node.comment? || node.procins? || node.doctype? || node.xmldecl?
warn 'removing: %p' % [node]
node.parent.children.delete(node)
end
end
Expand Down Expand Up @@ -138,7 +137,7 @@ def block_filter(node)
inline_filter(node.children)
write "\n"
when 'dd'
if node.search('p').any?
if node.at('p')
block_filter(node.children)
else
inline_filter(node.children)
Expand All @@ -155,7 +154,7 @@ def block_filter(node)
when 'ul'
macro "IP", %w["\(bu" 4]
end
if node.search('p|ol|ul|dl|div').any?
if node.at('p|ol|ul|dl|div')
block_filter(node.children)
else
inline_filter(node.children)
Expand All @@ -178,7 +177,6 @@ def inline_filter(node)
node.each { |ch| inline_filter(ch) }

elsif node.text?
prev = previous(node)
text = node.to_html.dup
write escape(text)

Expand Down

0 comments on commit 52ebb6a

Please sign in to comment.