Skip to content

Commit

Permalink
Correcting parser bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaben committed May 26, 2009
1 parent 21b3f05 commit e22ec93
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/parser.rb
Expand Up @@ -75,7 +75,7 @@ def parse_text(doc,ret)

tit.each do |a|
s=Section.new
tmp=doc.between(a.first.xpath,a.last.nil? ? nil : a.last.xpath).to_html
tmp=doc.between(a.first.xpath,a.last.nil? ? nil : a.last.xpath).collect{|r| r.to_original_html}.join
tmp.sub!(a.first.to_original_html,'')
s.content =[Text.new(tmp)]
#buggy with entities
Expand Down Expand Up @@ -106,11 +106,12 @@ def parse_rec(el,conf)

tit.each do |a|
s=Section.new
tmp=doc.between(a.first.xpath,a.last.nil? ? nil : a.last.xpath).to_html
s.content = [Text.new(tmp)]
tmp=doc.between(a.first.xpath,a.last.nil? ? nil : a.last.xpath).collect{|r| r.to_original_html}

s.content = [Text.new(tmp.join)]
s.title = extract_text(a.first)
el.content.push s
l.content.sub!(tmp,'')
tmp.each{|t|l.content.sub!(t,'')}
l.content.sub!(a.first.to_original_html,'')
end

Expand Down

0 comments on commit e22ec93

Please sign in to comment.