lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb in adiwg-mdtranslator-2.4.0 vs lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb in adiwg-mdtranslator-2.5.0

- old
+ new

@@ -1,14 +1,16 @@ # HTML writer # domain # History: +# Stan Smith 2017-11-03 added domainReference # Stan Smith 2017-04-05 refactored for mdTranslator 2.0 # Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS # Stan Smith 2015-03-26 original script require_relative 'html_domainItem' +require_relative 'html_citation' module ADIWG module Mdtranslator module Writers module Html @@ -17,53 +19,87 @@ def initialize(html) @html = html end - def writeHtml(hDomain) + def writeHtml(aDomains) - # classes used - itemClass = Html_DomainItem.new(@html) + aDomains.each do |hDomain| - # domain - id - unless hDomain[:domainId].nil? - @html.em('ID: ') - @html.text!(hDomain[:domainId]) - @html.br - end + # classes used + itemClass = Html_DomainItem.new(@html) + citationClass = Html_Citation.new(@html) - # domain - name - unless hDomain[:domainName].nil? - @html.em('Name: ') - @html.text!(hDomain[:domainName]) - @html.br - end + dName = 'domain' + dName = hDomain[:domainCode] unless hDomain[:domainCode].nil? + dName = hDomain[:domainName] unless hDomain[:domainName].nil? - # domain - code - unless hDomain[:domainCode].nil? - @html.em('Code: ') - @html.text!(hDomain[:domainCode]) - @html.br - end + type = 'UNREPRESENTABLE' + type = 'CODESET' unless hDomain[:domainReference].empty? + type = 'ENUMERATED' unless hDomain[:domainItems].empty? - # domain - description - unless hDomain[:domainDescription].nil? - @html.em('Description: ') - @html.section(:class => 'block') do - @html.text!(hDomain[:domainDescription]) - end - end - - # domain - domain items [] {domainItem} - hDomain[:domainItems].each do |hItem| @html.details do - @html.summary(hItem[:itemValue], {'class' => 'h5'}) + @html.summary(dName, {'class' => 'h5'}) @html.section(:class => 'block') do - itemClass.writeHtml(hItem) + + # 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 + end # aDomain end # writeHtml end # Html_Domain end end