Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_TaxonomyClass

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomyClass.rb

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_TaxonomyClass



17
18
19
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomyClass.rb', line 17

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hTaxon) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomyClass.rb', line 21

def writeHtml(hTaxon)

   # classes used
   subClass = Html_TaxonomyClass.new(@html)

   # taxonomic classification - id
   unless hTaxon[:taxonId].nil?
      @html.em('Taxonomic ID: ')
      @html.text!(hTaxon[:taxonId])
      @html.br
   end

   # taxonomic classification - level
   unless hTaxon[:taxonRank].nil?
      @html.em('Taxonomic Level: ')
      @html.text!(hTaxon[:taxonRank])
      @html.br
   end

   # taxonomic classification - name
   unless hTaxon[:taxonValue].nil?
      @html.em('Taxonomic Name: ')
      @html.text!(hTaxon[:taxonValue])
      @html.br
   end

   # taxonomic classification - common names []
   unless hTaxon[:commonNames].empty?
      @html.em('Common Names:')
      @html.ul do
         hTaxon[:commonNames].each do |common|
            @html.li(common)
         end
      end
   end

   # taxonomic classification - sub-classification
   unless hTaxon[:subClasses].empty?
      hTaxon[:subClasses].each do |hSubClass|
         @html.div do
            @html.div('Sub-Classification', {'class' => 'h5'})
            @html.div(:class => 'block') do
               subClass.writeHtml(hSubClass)
            end
         end
      end
   end

end