Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Keyword

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

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_Keyword

Returns a new instance of Html_Keyword.



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

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hKeyword) ⇒ 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
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb', line 22

def writeHtml(hKeyword)

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

   # keywords - type
   @html.div do
      type = hKeyword[:keywordType]
      if type.nil?
         type = 'Unclassified'
      end
      @html.div(type, {'class' => 'h5'})
      @html.div(:class => 'block') do

         # keywords
         @html.ul do
            hKeyword[:keywords].each do |hKeyword|
               unless hKeyword[:keyword].nil?
                  keyword = hKeyword[:keyword]
                  unless hKeyword[:keywordId].nil?
                     keyword += ' (ID: ' + hKeyword[:keywordId].to_s + ')'
                  end
                  @html.li(keyword)
               end
            end
         end

         # thesaurus
         unless hKeyword[:thesaurus].empty?
            @html.div do
               @html.div('Thesaurus', {'class' => 'h5'})
               @html.div(:class => 'block') do
                  citationClass.writeHtml(hKeyword[:thesaurus])
               end
            end
         end

      end
   end

end