Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_AssociatedResource

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

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_AssociatedResource

Returns a new instance of Html_AssociatedResource.



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

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hResource) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_associatedResource.rb', line 22

def writeHtml(hResource)

   # classes used
   typeClass = Html_ResourceType.new(@html)
   citationClass = Html_Citation.new(@html)

   # associated resource - resource type
   hResource[:resourceTypes].each do |hType|
      typeClass.writeHtml(hType)
   end

   # associated resource - association type {associationTypeCode}
   unless hResource[:associationType].nil?
      @html.em('Association type: ')
      @html.text!(hResource[:associationType])
      @html.br
   end

   # associated resource - initiative type {initiativeTypeCode}
   unless hResource[:initiativeType].nil?
      @html.em('Initiative type: ')
      @html.text!(hResource[:initiativeType])
      @html.br
   end

   # associated resource - resource citation {citation}
   unless hResource[:resourceCitation].empty?
      @html.div do
         @html.div('Resource citation', {'class' => 'h5'})
         @html.div(:class => 'block') do
            citationClass.writeHtml(hResource[:resourceCitation])
         end
      end
   end

   # associated resource - metadata citation
   unless hResource[:metadataCitation].empty?
      @html.div do
         @html.div('Metadata citation', {'class' => 'h5'})
         @html.div(:class => 'block') do
            citationClass.writeHtml(hResource[:metadataCitation])
         end
      end
   end

end