Module: ODDB::FiParse

Defined in:
ext/fiparse/src/minifi.rb,
ext/fiparse/src/fiparse.rb,
ext/fiparse/src/fiwriter.rb,
ext/fiparse/src/indications.rb,
ext/fiparse/src/fachinfo_doc.rb,
ext/fiparse/src/fachinfo_pdf.rb,
ext/fiparse/src/fachinfo_writer.rb,
ext/fiparse/src/patinfo_hpricot.rb,
ext/fiparse/src/fachinfo_hpricot.rb,
ext/fiparse/src/textinfo_hpricot.rb,
ext/fiparse/test/indications_test.rb,
ext/fiparse/test/test_patinfo_hpricot.rb,
ext/fiparse/test/test_fachinfo_hpricot.rb

Defined Under Namespace

Modules: FachinfoWriterMethods, Indications, MiniFi Classes: FachinfoDocWriter, FachinfoHpricot, FachinfoPDFWriter, FachinfoSubDocumentHandler, FachinfoTableHandler, FachinfoTextHandler, FachinfoWriter, PatinfoHpricot, TestFachinfoHpricot, TestFachinfoHpricotAlcaCDe, TestFachinfoHpricotPonstanDe, TestIndicationsHandler, TestPatinfoHpricot, TestPatinfoHpricotCimifeminDe, TestPatinfoHpricotCimifeminFr, TestPatinfoHpricotInderalDe, TestPatinfoHpricotNasivinDe, TestPatinfoHpricotPonstanDe, TextinfoHpricot, Writer

Class Method Summary collapse

Class Method Details

.extract_indications(path) ⇒ Object



27
28
29
# File 'ext/fiparse/src/fiparse.rb', line 27

def FiParse.extract_indications(path)
  Indications.extract(path)
end

.extract_minifi(path) ⇒ Object



30
31
32
# File 'ext/fiparse/src/fiparse.rb', line 30

def FiParse.extract_minifi(path)
  MiniFi.extract(path)
end

.parse_fachinfo_doc(src) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'ext/fiparse/src/fiparse.rb', line 33

def parse_fachinfo_doc(src)
	parser = Rwv2.create_parser_from_content(src)
	handler = FachinfoTextHandler.new
	parser.set_text_handler(handler)
    parser.set_table_handler(handler.table_handler)
	parser.parse
    if(handler.writers.empty?)
      ## Product-Name was not written large enough - retry with whatever was 
      #  the largest fontsize
      handler.cutoff_fontsize = handler.max_fontsize
      parser.parse
    end
	handler.writers.collect { |wt| wt.to_fachinfo }.compact.first
end

.parse_fachinfo_html(src) ⇒ Object



47
48
49
50
51
52
53
# File 'ext/fiparse/src/fiparse.rb', line 47

def parse_fachinfo_html(src)
  if File.exist?(src)
    src = File.read src
  end
  writer = FachinfoHpricot.new
  writer.extract(Hpricot(src))
end

.parse_fachinfo_pdf(src) ⇒ Object



54
55
56
57
58
59
# File 'ext/fiparse/src/fiparse.rb', line 54

def parse_fachinfo_pdf(src)
	writer = FachinfoPDFWriter.new
	parser = Rpdf2txt::Parser.new(src, 'UTF-8')
	parser.extract_text(writer)
	writer.to_fachinfo
end

.parse_patinfo_html(src) ⇒ Object



60
61
62
63
64
65
66
# File 'ext/fiparse/src/fiparse.rb', line 60

def parse_patinfo_html(src)
    if File.exist?(src)
      src = File.read src
    end
	writer = PatinfoHpricot.new
    writer.extract(Hpricot(src))
end

.storage=(storage) ⇒ Object



24
25
26
# File 'ext/fiparse/src/fiparse.rb', line 24

def storage=(storage)
	ODBA.storage = storage
end