Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_MetadataInfo

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

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_MetadataInfo



27
28
29
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb', line 27

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hMetaInfo) ⇒ Object



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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb', line 31

def writeHtml(hMetaInfo)

   # classes used
   identifierClass = Html_Identifier.new(@html)
   citationClass = Html_Citation.new(@html)
   localeClass = Html_Locale.new(@html)
   responsibilityClass = Html_Responsibility.new(@html)
   dateClass = Html_Date.new(@html)
   onlineClass = Html_OnlineResource.new(@html)
   constraintClass = Html_Constraint.new(@html)
   maintClass = Html_Maintenance.new(@html)

   # metadataInfo - metadata status
   unless hMetaInfo[:metadataStatus].nil?
      @html.em('Metadata Status: ')
      @html.text!(hMetaInfo[:metadataStatus])
      @html.br
   end

   # metadataInfo - metadata identifier {identifier}
   unless hMetaInfo[:metadataIdentifier].empty?
      @html.div do
         @html.div('Metadata Identifier', {'id' => 'metadataInfo-identifier', 'class' => 'h3'})
         @html.div(:class => 'block') do
            identifierClass.writeHtml(hMetaInfo[:metadataIdentifier])
         end
      end
   end

   # metadataInfo - parent metadata {citation}
   unless hMetaInfo[:parentMetadata].empty?
      @html.div do
         @html.div('Parent Metadata', {'id' => 'metadataInfo-parent', 'class' => 'h3'})
         @html.div(:class => 'block') do
            citationClass.writeHtml(hMetaInfo[:parentMetadata])
         end
      end
   end

   # metadataInfo - metadata locales
   unless hMetaInfo[:defaultMetadataLocale].empty? && hMetaInfo[:otherMetadataLocales].empty?
      @html.div do
         @html.div('Metadata Locales', {'id' => 'metadataInfo-locale', 'class' => 'h3'})
         @html.div(:class => 'block') do

            # default metadata locales {locale}
            unless hMetaInfo[:defaultMetadataLocale].empty?
               @html.div do
                  @html.div('Default Locale', {'class' => 'h5'})
                  @html.div(:class => 'block') do
                     localeClass.writeHtml(hMetaInfo[:defaultMetadataLocale])
                  end
               end
            end

            # other metadata locales [] {locale}
            hMetaInfo[:otherMetadataLocales].each do |hLocale|
               @html.div do
                  @html.div('Other Locale', {'class' => 'h5'})
                  @html.div(:class => 'block') do
                     localeClass.writeHtml(hLocale)
                  end
               end
            end

         end
      end
   end

   # metadataInfo - contacts [] {responsibility}
   unless hMetaInfo[:metadataContacts].empty?
      @html.div do
         @html.div('Metadata Contacts', {'id' => 'metadataInfo-contacts', 'class' => 'h3'})
         @html.div(:class => 'block') do
            hMetaInfo[:metadataContacts].each do |hResponsibility|
               @html.div do
                  @html.div(hResponsibility[:roleName], 'class' => 'h5')
                  @html.div(:class => 'block') do
                     responsibilityClass.writeHtml(hResponsibility)
                  end
               end
            end
         end
      end
   end

   # metadataInfo - dates [] {date}
   unless hMetaInfo[:metadataDates].empty?
      @html.div do
         @html.div('Metadata Dates', {'id' => 'metadataInfo-dates', 'class' => 'h3'})
         @html.div(:class => 'block') do
            hMetaInfo[:metadataDates].each do |hDate|
               @html.em('Date: ')
               dateClass.writeHtml(hDate)
               @html.br
            end
         end
      end
   end

   # metadataInfo - linkages [] {onlineResource}
   unless hMetaInfo[:metadataLinkages].empty?
      @html.div do
         @html.div('Metadata Online Resource', {'id' => 'metadataInfo-links', 'class' => 'h3'})
         @html.div(:class => 'block') do
            hMetaInfo[:metadataLinkages].each do |hOnline|
               @html.div do
                  @html.div('Online Resource', {'class' => 'h5'})
                  @html.div(:class => 'block') do
                     onlineClass.writeHtml(hOnline)
                  end
               end
            end
         end
      end
   end

   # metadataInfo - constraints [] {constraint}
   unless hMetaInfo[:metadataConstraints].empty?
      @html.div do
         @html.div('Metadata Constraints', {'id' => 'metadataInfo-constraint', 'class' => 'h3'})
         @html.div(:class => 'block') do
            hMetaInfo[:metadataConstraints].each do |hConstraint|
               @html.div do
                  @html.div(hConstraint[:type].capitalize+' Constraint', {'class' => 'h5'})
                  @html.div(:class => 'block') do
                     constraintClass.writeHtml(hConstraint)
                  end
               end
            end
         end
      end
   end

   # metadataInfo - maintenance {maintenance}
   unless hMetaInfo[:metadataMaintenance].empty?
      @html.div do
         @html.div('Metadata Maintenance', {'id' => 'metadataInfo-maintenance', 'class' => 'h3'})
         @html.div(:class => 'block') do
            maintClass.writeHtml(hMetaInfo[:metadataMaintenance])
         end
      end
   end

   # metadataInfo - alternate metadata references [] {citation}
   unless hMetaInfo[:alternateMetadataReferences].empty?
      @html.div do
         @html.div('Alternate Metadata Citations', {'id' => 'metadataInfo-alternate', 'class' => 'h3'})
         @html.div(:class => 'block') do
            hMetaInfo[:alternateMetadataReferences].each do |hCitation|
               @html.div do
                  @html.div(hCitation[:title], 'class' => 'h5')
                  @html.div(:class => 'block') do
                     citationClass.writeHtml(hCitation)
                  end
               end
            end
         end
      end
   end

end