Sha256: 0ced32385b1df051bd9e58b24360d2c9904f4880dee10b04a6030d8dcd02e2d0

Contents?: true

Size: 1.83 KB

Versions: 6

Compression:

Stored size: 1.83 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 Html

            class Html_Keyword

               def initialize(html)
                  @html = html
               end

               def writeHtml(hKeyword)

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

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

                        # keywords
                        @html.ul do
                           hKeyword[:keywords].each do |hKeyword|
                              unless hKeyword[:keyword].nil?
                                 @html.li(hKeyword[:keyword])
                              end
                           end
                        end

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

                     end
                  end

               end # writeHtml
            end # Html_Keyword

         end
      end
   end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb
adiwg-mdtranslator-2.6.0 lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb
adiwg-mdtranslator-2.5.0 lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb
adiwg-mdtranslator-2.4.0 lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb
adiwg-mdtranslator-2.3.5 lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb