#fully_qualify_urls(base_url, text) ⇒ Object

# File 'lib/awestruct/context_helper.rb', line 41deffully_qualify_urls(base_url,text)begindoc=Oga.parse_htmltextdoc.each_nodedo|elem|ifelem.is_a?(Oga::XML::Element)&&elem.html?caseelem.namewhen'a'elem.set'href',fix_url(base_url,elem.get('href'))ifelem.get('href')when'link'elem.set'href',fix_url(base_url,elem.get('href'))ifelem.get('href')when'img'elem.set'src',fix_url(base_url,elem.get('src'))ifelem.get('src')endendenddoc.to_xml.tapdo|d|d.force_encoding(text.encoding)ifd.encoding!=text.encodingendrescue=>eAwestruct::ExceptionHelper.log_errore$LOG.info%Q(If the error has to do with 'end of input' ensure none of the following tags have a closing tag:
#{Oga::XML::HTML_VOID_ELEMENTS.to_a.collect{|a|a.downcase}.uniq.join(', ')})if$LOG.info?$LOG.warn"Text being parsed:\n#{text}"if$LOG.warn?text# returning the bad text, which hopefully will help find the cause
endend