lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb in adiwg-mdtranslator-1.4.0 vs lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb in adiwg-mdtranslator-2.0.0rc2
- old
+ new
@@ -1,81 +1,72 @@
# HTML writer
-# data dictionary domain
+# domain
# History:
+# 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
-# Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS
-require_relative 'html_domainMember'
+require_relative 'html_domainItem'
module ADIWG
- module Mdtranslator
- module Writers
- module Html
+ module Mdtranslator
+ module Writers
+ module Html
- class MdHtmlDictionaryDomain
- def initialize(html)
- @html = html
- end
+ class Html_Domain
- def writeHtml(hDomain)
+ def initialize(html)
+ @html = html
+ end
- # classes used
- htmlDomMem = MdHtmlDomainMember.new(@html)
+ def writeHtml(hDomain)
- # domain - user assigned domain id
- s = hDomain[:domainId]
- if !s.nil?
- @html.em('Domain ID: ')
- @html.text!(s)
- @html.br
- end
+ # classes used
+ itemClass = Html_DomainItem.new(@html)
- # domain - domain name
- s = hDomain[:domainName]
- if !s.nil?
- @html.em('Domain name: ')
- @html.text!(s)
- @html.br
- end
+ # domain - id
+ unless hDomain[:domainId].nil?
+ @html.em('ID: ')
+ @html.text!(hDomain[:domainId])
+ @html.br
+ end
- # domain - domain code
- s = hDomain[:domainCode]
- if !s.nil?
- @html.em('Domain code: ')
- @html.text!(s)
- @html.br
- end
+ # domain - name
+ unless hDomain[:domainName].nil?
+ @html.em('Name: ')
+ @html.text!(hDomain[:domainName])
+ @html.br
+ end
- # domain - user assigned domain id
- s = hDomain[:domainDescription]
- if !s.nil?
- @html.em('Description: ')
- @html.section(:class=>'block') do
- @html.text!(s)
- end
- end
+ # domain - code
+ unless hDomain[:domainCode].nil?
+ @html.em('Code: ')
+ @html.text!(hDomain[:domainCode])
+ @html.br
+ end
- # domain - domain members
- aMembers = hDomain[:domainItems]
- if !aMembers.empty?
- @html.em('Domain members: ')
- aMembers.each do |hDItem|
- @html.section(:class=>'block') do
- @html.details do
- @html.summary(hDItem[:itemValue], {'class'=>'h5'})
- @html.section(:class=>'block') do
- htmlDomMem.writeHtml(hDItem)
- end
- end
- end
- end
+ # 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.section(:class => 'block') do
+ itemClass.writeHtml(hItem)
end
+ end
+ end
- end # writeHtml
+ end # writeHtml
+ end # Html_Domain
- end # class
-
- end
- end
- end
+ end
+ end
+ end
end