lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb in adiwg-mdtranslator-1.4.0 vs lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb in adiwg-mdtranslator-2.0.0rc2
- old
+ new
@@ -1,107 +1,101 @@
# HTML writer
-# entity attribute
+# data attribute
# History:
+# Stan Smith 2017-04-05 refactored for mdTranslator 2.0
# Stan Smith 2015-03-26 original script
module ADIWG
- module Mdtranslator
- module Writers
- module Html
+ module Mdtranslator
+ module Writers
+ module Html
- class MdHtmlEntityAttribute
- def initialize(html)
- @html = html
- end
+ class Html_EntityAttribute
- def writeHtml(hAttribute)
+ def initialize(html)
+ @html = html
+ end
- # entity attribute - common name
- s = hAttribute[:attributeName]
- if !s.nil?
- @html.em('Common name: ')
- @html.text!(s)
- @html.br
- end
+ def writeHtml(hAttribute)
- # entity attribute - code name
- s = hAttribute[:attributeCode]
- if !s.nil?
- @html.em('Code name: ')
- @html.text!(s)
- @html.br
- end
+ # entity attribute - common name
+ unless hAttribute[:attributeName].nil?
+ @html.em('Name: ')
+ @html.text!(hAttribute[:attributeName])
+ @html.br
+ end
- # entity attribute - aliases
- aAliases = hAttribute[:attributeAlias]
- if !aAliases.empty?
- @html.em('Aliases: ')
- @html.text!(aAliases.to_s)
- @html.br
- end
+ # entity attribute - code name
+ unless hAttribute[:attributeCode].nil?
+ @html.em('Code: ')
+ @html.text!(hAttribute[:attributeCode])
+ @html.br
+ end
- # entity attribute - definition
- s = hAttribute[:attributeDefinition]
- if !s.nil?
- @html.em('Definition: ')
- @html.section(:class=>'block') do
- @html.text!(s)
- end
- end
+ # entity attribute - aliases
+ hAttribute[:attributeAlias].each do |otherName|
+ @html.em('Alias: ')
+ @html.text!(otherName)
+ @html.br
+ end
- # entity attribute - datatype
- s = hAttribute[:dataType]
- if !s.nil?
- @html.em('Datatype: ')
- @html.text!(s)
- @html.br
- end
+ # entity attribute - definition
+ unless hAttribute[:attributeDefinition].nil?
+ @html.em('Definition: ')
+ @html.section(:class => 'block') do
+ @html.text!(hAttribute[:attributeDefinition])
+ end
+ end
- # entity attribute - allow nulls
- b = hAttribute[:allowNull]
- if !b.nil?
- @html.em('Allow null values: ')
- @html.text!(b.to_s)
- @html.br
- end
+ # entity attribute - datatype
+ unless hAttribute[:dataType].nil?
+ @html.em('Datatype: ')
+ @html.text!(hAttribute[:dataType])
+ @html.br
+ end
- # entity attribute - unit of measure
- s = hAttribute[:unitOfMeasure]
- if !s.nil?
- @html.em('Unit of measure: ')
- @html.text!(s)
- @html.br
- end
+ # entity attribute - allow nulls {Boolean}
+ @html.em('Allow NULL Values: ')
+ @html.text!(hAttribute[:allowNull].to_s)
+ @html.br
- # entity attribute - domain ID
- s = hAttribute[:domainId]
- if !s.nil?
- @html.em('Domain ID: ')
- @html.text!(s)
- @html.br
- end
+ # entity attribute - allow many {Boolean}
+ @html.em('Allow Many Values: ')
+ @html.text!(hAttribute[:allowMany].to_s)
+ @html.br
- # entity attribute - minimum value
- s = hAttribute[:minValue]
- if !s.nil?
- @html.em('Minimum value: ')
- @html.text!(s.to_s)
- @html.br
- end
+ # entity attribute - unit of measure
+ unless hAttribute[:unitOfMeasure].nil?
+ @html.em('Unit of Measure: ')
+ @html.text!(hAttribute[:unitOfMeasure])
+ @html.br
+ end
- # entity attribute - code name
- s = hAttribute[:maxValue]
- if !s.nil?
- @html.em('Maximum value: ')
- @html.text!(s.to_s)
- @html.br
- end
+ # entity attribute - domain ID
+ unless hAttribute[:domainId].nil?
+ @html.em('Domain ID: ')
+ @html.text!(hAttribute[:domainId])
+ @html.br
+ end
- end # writeHtml
+ # entity attribute - minimum value
+ unless hAttribute[:minValue].nil?
+ @html.em('Minimum Value: ')
+ @html.text!(hAttribute[:minValue].to_s)
+ @html.br
+ end
- end # class
+ # entity attribute - code name
+ unless hAttribute[:maxValue].nil?
+ @html.em('Maximum Value: ')
+ @html.text!(hAttribute[:maxValue].to_s)
+ @html.br
+ end
- end
- end
- end
+ end # writeHtml
+ end # Html_EntityAttribute
+
+ end
+ end
+ end
end