view · edit · sidebar · attach · print · history

20120713-debug-fachinfo-importer-exporter

<< | Index | >>


Summary

  • Update text info plugin about table handling.
  • Debugged updater jobs.

Commits

Index


Debug fachinfo importer

table in pre format.

in src/plugin/text_info.rb

    def import_fulltext terms, agent=init_agent
      @search_term = terms.to_a.join ', '
      terms.to_a.each do |term|
        @current_search = [:search_fulltext, term]
        page = search_fulltext term, agent
        import_products page, agent
      end 
    end 

How check this table.

ch.oddb> TextInfoPlugin.new(self, {:reparse => true}).parse_fachinfo('/home/yasuhiro/Downloads/keppra.htm')
-> #<ODDB::FachinfoDocument2001:0x0000000c00d938>
ch.oddb> TextInfoPlugin.new(self, {:reparse => true}).import_fulltext(['keppra'])
-> ["keppra"]
experiment

in ext/fiparse/src/textinfo_hpricot.rb

       ...
       when 'td', 'th'
          ## the new format uses td-borders as "row-separators"
          p child.classes
          if(child.classes.include?("rowSepBelow"))
            ptr.target << preformatted_text(child)
       ...

Some td tag dose not have expected class attribute.

[]
[]
[]
[]
["rowSepBelow"]
[]
["rowSepBelow"]
[]
...

I tried to use attributes of table tag.
created Table detection.
and improved pre-style table format.

  def detect_table?(elem)
    found = true
    if elem.attributes['border'] == '0' 
      classes = []
      (elem/:thead/:tr/:th).each do |th|
        classes << true if th.attributes['class'] == 'rowSepBelow'
      end 
      (elem/:tbody/:tr/:td).each do |td|
        classes << true if td.attributes['class'] == 'rowSepBelow'
      end 
      unless classes.empty? # as pre-format style paragraph
        found = false
      end 
    end 
    found
  end

Refs

commits
update(via Job)
$ jobs/update_company_textinfos 'UCB Pharma'
bin/admin(force option)
ch.oddb> TextInfoPlugin.new(self, {:reparse => true}).import_company ['UCB Pharma']
ch.oddb> TextInfoPlugin.new(self, {:reparse => true}).import_fulltext ['Xyzal']

Create user logo upload


Get company logo

I found logo of Company.

I tried to get Compyn.logo via yus by user.

  if @session.user.is_a?(ODDB::YusUser)
    name = @session.user.name
    company = @session.app.yus_model(name)
    priv = company.pointer.to_yus_privilege
    ...
  end
view · edit · sidebar · attach · print · history
Page last modified on July 13, 2012, at 03:48 PM