135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'lib/pdf.rb', line 135
def gen_html_from_page_text(page_text,illustrations,options={})
html = ''
page_text.split("\n").each_with_index do |line,index|
if line.present?
if HeaderDetect.(line)
html += "<h2 id='#{options[:index]}_#{index}'>#{Utils.escape_html(Utils.clean_text(line))}</h2>"
else
html += "<p class='division'>#{Utils.escape_html(Utils.clean_text(line))}</p>"
end
end
end
images = illustrations.map{|image_path| "<p class='division'><img src='#{image_path}' /></p>"}.compact.join("")
"<div class='page' name='#{options[:index]}' >#{html}#{images}</div>"
end
|