Class: ADIWG::Mdtranslator::Writers::Html::Html_Entity
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Html::Html_Entity
- Defined in:
- lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb
Instance Method Summary collapse
-
#initialize(html) ⇒ Html_Entity
constructor
A new instance of Html_Entity.
- #writeHtml(aEntities) ⇒ Object
Constructor Details
#initialize(html) ⇒ Html_Entity
Returns a new instance of Html_Entity.
22 23 24 |
# File 'lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb', line 22 def initialize(html) @html = html end |
Instance Method Details
#writeHtml(aEntities) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb', line 26 def writeHtml(aEntities) # classes used indexClass = Html_EntityIndex.new(@html) attributeClass = Html_EntityAttribute.new(@html) foreignClass = Html_EntityForeignKey.new(@html) citationClass = Html_Citation.new(@html) aEntities.each do |hEntity| eName = 'entity' eName = hEntity[:entityCode] unless hEntity[:entityCode].nil? eName = hEntity[:entityName] unless hEntity[:entityName].nil? @html.details do @html.summary(eName, {'class' => 'h5'}) @html.section(:class => 'block') do # entity - entity id unless hEntity[:entityId].nil? @html.em('ID: ') @html.text!(hEntity[:entityId]) @html.br end # entity - name unless hEntity[:entityName].nil? @html.em('Name: ') @html.text!(hEntity[:entityName]) @html.br end # entity - code unless hEntity[:entityCode].nil? @html.em('Code: ') @html.text!(hEntity[:entityCode]) @html.br end # entity - alias names hEntity[:entityAlias].each do |otherName| @html.em('Alias: ') @html.section(:class => 'block') do @html.text!(otherName) end end # entity - definition unless hEntity[:entityDefinition].nil? @html.em('Definition: ') @html.section(:class => 'block') do @html.text!(hEntity[:entityDefinition]) end end # entity - primary key unless hEntity[:primaryKey].empty? @html.em('Primary Key Attribute(s):') @html.section(:class => 'block') do hEntity[:primaryKey].each do |attribute| @html.text!(attribute) @html.br end end end # entity - field separator character unless hEntity[:fieldSeparatorCharacter].nil? @html.em('Field Separator Character: ') @html.text!(hEntity[:fieldSeparatorCharacter]) @html.br end # entity - number of header lines unless hEntity[:numberOfHeaderLines].nil? @html.em('Number of Header Lines: ') @html.text!(hEntity[:numberOfHeaderLines].to_s) @html.br end # entity - quote character unless hEntity[:quoteCharacter].nil? @html.em('Quote Character: ') @html.text!(hEntity[:quoteCharacter]) @html.br end # entity - indexes [] {entityIndex} hEntity[:indexes].each do |hIndex| iName = 'index' iName = hIndex[:indexCode] unless hIndex[:indexCode].nil? iName = hIndex[:indexName] unless hIndex[:indexName].nil? @html.details do @html.summary('Index: '+iName, {'class' => 'h5'}) @html.section(:class => 'block') do indexClass.writeHtml(hIndex) end end end # entity - foreign keys [] {entityForeignKey} hEntity[:foreignKeys].each do |hForeign| @html.details do @html.summary('ForeignKey', {'class' => 'h5'}) @html.section(:class => 'block') do foreignClass.writeHtml(hForeign) end end end # entity - entity reference [] {citation} hEntity[:entityReferences].each do |hReference| @html.details do @html.summary('Reference', {'class' => 'h5'}) @html.section(:class => 'block') do citationClass.writeHtml(hReference) end end end # entity - attributes [] {entityAttribute} hEntity[:attributes].each do |hAttribute| aName = 'attribute' aName = hAttribute[:attributeCode] unless hAttribute[:attributeCode].nil? aName = hAttribute[:attributeName] unless hAttribute[:attributeName].nil? @html.details do @html.summary('Attribute: '+aName, {'class' => 'h5'}) @html.section(:class => 'block') do attributeClass.writeHtml(hAttribute) end end end end end end # aEntity end |