class ADIWG::Mdtranslator::Writers::Html::Html_Domain

Public Class Methods

new(html) click to toggle source
# File lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb, line 20
def initialize(html)
   @html = html
end

Public Instance Methods

writeHtml(aDomains) click to toggle source
# File lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb, line 24
def writeHtml(aDomains)

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

   aDomains.each do |hDomain|

      dName = 'domain'
      dName = hDomain[:domainCode] unless hDomain[:domainCode].nil?
      dName = hDomain[:domainName] unless hDomain[:domainName].nil?

      type = 'UNREPRESENTABLE'
      type = 'CODESET' unless hDomain[:domainReference].empty?
      type = 'ENUMERATED' unless hDomain[:domainItems].empty?

      @html.details do
         @html.summary(dName, {'class' => 'h5'})
         @html.section(:class => 'block') do

            # domain - type
            @html.em('Domain Type: ')
            @html.text!(type)
            @html.br

            # domain - id
            unless hDomain[:domainId].nil?
               @html.em('ID: ')
               @html.text!(hDomain[:domainId])
               @html.br
            end

            # domain - name
            unless hDomain[:domainName].nil?
               @html.em('Name: ')
               @html.text!(hDomain[:domainName])
               @html.br
            end

            # domain - code
            unless hDomain[:domainCode].nil?
               @html.em('Code: ')
               @html.text!(hDomain[:domainCode])
               @html.br
            end

            # domain - description
            unless hDomain[:domainDescription].nil?
               @html.em('Description: ')
               @html.section(:class => 'block') do
                  @html.text!(hDomain[:domainDescription])
               end
            end

            # domain - domain reference {citation}
            unless hDomain[:domainReference].empty?
               @html.details do
                  @html.summary('Reference', {'class' => 'h5'})
                  @html.section(:class => 'block') do
                     citationClass.writeHtml(hDomain[:domainReference])
                  end
               end
            end

            # domain - domain items [] {domainItem}
            hDomain[:domainItems].each do |hItem|
               @html.details do
                  @html.summary(hItem[:itemValue], {'class' => 'h5'})
                  @html.section(:class => 'block') do
                     itemClass.writeHtml(hItem)
                  end
               end
            end

         end
      end

   end # aDomain
end