Sha256: d9aa0492ea507a2f8c48761cda2d9b9e50948614f1b79b63ff93d51bd0c7e769

Contents?: true

Size: 1.99 KB

Versions: 12

Compression:

Stored size: 1.99 KB

Contents

# HTML writer
# keywords

# History:
#  Stan Smith 2017-03-29 refactored for mdTranslator 2.0
#  Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS
# 	Stan Smith 2015-03-23 original script

require_relative 'html_citation'

module ADIWG
   module Mdtranslator
      module Writers
         module Simple_html

            class Html_Keyword

               def initialize(html)
                  @html = html
               end

               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.h5(type, {'class' => 'h5'})
                     @html.div(:class => 'block') do
                        
                        # thesaurus
                        unless hKeyword[:thesaurus].empty?
                           @html.div do
                              @html.h5('Thesaurus', {'class' => 'h5'})
                              @html.div(:class => 'block') do
                                 citationClass.writeHtml(hKeyword[:thesaurus])
                              end
                           end
                        end

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

                     end
                  end

               end # writeHtml
            end # Html_Keyword

         end
      end
   end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.19.0.pre.beta.31 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.30 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.29 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.28 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.27 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.26 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.13 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.12 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.11 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.10 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.9 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
adiwg-mdtranslator-2.19.0.pre.beta.8 lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb