Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Usage

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

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_Usage

Returns a new instance of Html_Usage.



20
21
22
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_usage.rb', line 20

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hUsage) ⇒ Object



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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_usage.rb', line 24

def writeHtml(hUsage)

   # classes used
   temporalClass = Html_TemporalExtent.new(@html)
   citationClass = Html_Citation.new(@html)
   responsibilityClass = Html_Responsibility.new(@html)

   # resource usage - use
   @html.em('Usage: ')
   @html.div(:class => 'block') do
      @html.text!(hUsage[:specificUsage])
   end

   # resource usage - temporal extent
   unless hUsage[:temporalExtents].empty?
      @html.div do
         @html.div('Times and Periods of Usage', 'class' => 'h5')
         @html.div(:class => 'block') do
            hUsage[:temporalExtents].each do |hTemporal|
               temporalClass.writeHtml(hTemporal)
            end
         end
      end
   end

   # resource usage - limitation
   unless hUsage[:userLimitation].nil? && hUsage[:limitationResponses].empty?
      @html.div do
         @html.div('User Defined Limitations', 'class' => 'h5')
         @html.div(:class => 'block') do

            # user limitation
            unless hUsage[:userLimitation].nil?
               @html.em('Description')
               @html.div(:class => 'block') do
                  @html.text!(hUsage[:userLimitation])
               end
            end

            # limitation responses []
            hUsage[:limitationResponses].each do |response|
               @html.em('Response')
               @html.div(:class => 'block') do
                  @html.text!(response)
               end
            end

         end
      end
   end

   # resource usage - documented issue
   unless hUsage[:identifiedIssue].empty?
      @html.div do
         @html.div('Cited Issue', 'class' => 'h5')
         @html.div(:class => 'block') do
            citationClass.writeHtml(hUsage[:identifiedIssue])
         end
      end
   end

   # resource usage - additional documentation
   hUsage[:additionalDocumentation].each do |hCitation|
      @html.div do
         @html.div('Additional Documentation', 'class' => 'h5')
         @html.div(:class => 'block') do
            citationClass.writeHtml(hCitation)
         end
      end
   end

   # resource usage - user contacts
   unless hUsage[:userContacts].empty?
      @html.div do
         @html.div('Usage and Limitation Contacts', {'class' => 'h5'})
         @html.div(:class => 'block') do
            hUsage[:userContacts].each do |hContact|
               @html.div do
                  @html.div(hContact[:roleName], 'class' => 'h5')
                  @html.div(:class => 'block') do
                     responsibilityClass.writeHtml(hContact)
                  end
               end
            end
         end
      end
   end

end