lib/adiwg/mdtranslator/writers/html/sections/html_extent.rb in adiwg-mdtranslator-1.4.0 vs lib/adiwg/mdtranslator/writers/html/sections/html_extent.rb in adiwg-mdtranslator-2.0.0rc2

- old
+ new

@@ -1,108 +1,75 @@ # HTML writer # extents (geographic, temporal, vertical) # History: +# Stan Smith 2017-04-06 refactor for mdTranslator 2.0 +# Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS # Stan Smith 2015-03-31 original script -# Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS -require_relative 'html_geographicElement' -require_relative 'html_temporalElement' -require_relative 'html_verticalElement' +require_relative 'html_geographicExtent' +require_relative 'html_temporalExtent' +require_relative 'html_verticalExtent' module ADIWG - module Mdtranslator - module Writers - module Html + module Mdtranslator + module Writers + module Html - class MdHtmlExtent - def initialize(html) - @html = html - end + class Html_Extent - def writeHtml(hExtent, extNum) + def initialize(html) + @html = html + end - # classes used - htmlGeoEle = MdHtmlGeographicElement.new(@html) - htmlTempEle = MdHtmlTemporalElement.new(@html) - htmlVertEle = MdHtmlVerticalElement.new(@html) + def writeHtml(hExtent) - aGeoEle = hExtent[:extGeoElements] - aTempEle = hExtent[:extTempElements] - aVertEle = hExtent[:extVertElements] + # classes used + geographicClass = Html_GeographicExtent.new(@html) + temporalClass = Html_TemporalExtent.new(@html) + verticalClass = Html_VerticalExtent.new(@html) - # extent - description - s = hExtent[:extDesc] - if !s.nil? - @html.em('Extent description: ') - @html.section(:class=>'block') do - @html.text!(s) - end - end + # extent - description + unless hExtent[:description].nil? + @html.em('Description: ') + @html.section(:class => 'block') do + @html.text!(hExtent[:description]) + end + end - # extent - geographic elements - if !aGeoEle.empty? - # extent - map - @html.details do - @html.summary('Map', {'class'=>'h4 map-header'}) - @html.div('class'=>'map') do - end - end - - @html.details do - @html.summary('Geographic Elements', {'class'=>'h4'}) - geoNum = 0 - aGeoEle.each do |hGeoEle| - @html.section(:class=>'block') do - @html.details do - eleNum = extNum.to_s + '.' + geoNum.to_s - @html.summary('Element ' + eleNum, {'class'=>'h5 element'}) - @html.section(:class=>'block') do - htmlGeoEle.writeHtml(hGeoEle, eleNum) - geoNum += 1 - end - end - end - end - end + # extent - geographic extents + hExtent[:geographicExtents].each do |hGeographic| + @html.details do + @html.summary('Geographic Extent', {'class' => 'h5'}) + @html.section(:class => 'block extent-geographic') do + geographicClass.writeHtml(hGeographic) end + end + end - # extent - vertical elements - if !aVertEle.empty? - @html.details do - @html.summary('Vertical Elements', {'class'=>'h4'}) - vertNum = 0 - aVertEle.each do |hVertEle| - @html.section(:class=>'block') do - @html.details do - eleNum = extNum.to_s + '.' + vertNum.to_s - @html.summary('Element ' + eleNum, {'class'=>'h5'}) - @html.section(:class=>'block') do - htmlVertEle.writeHtml(hVertEle) - vertNum += 1 - end - end - end - end - end + # extent - temporal extents + hExtent[:temporalExtents].each do |hTemporal| + @html.details do + @html.summary('Temporal Extent', {'class' => 'h5'}) + @html.section(:class => 'block') do + temporalClass.writeHtml(hTemporal) end + end + end - # extent - temporal elements - if !aTempEle.empty? - @html.details do - @html.summary('Temporal Elements', {'class'=>'h4'}) - aTempEle.each do |hTempEle| - @html.section(:class=>'block') do - htmlTempEle.writeHtml(hTempEle) - end - end - end + # extent - vertical extents + hExtent[:verticalExtents].each do |hVertical| + @html.details do + @html.summary('Vertical Extent', {'class' => 'h5'}) + @html.section(:class => 'block') do + verticalClass.writeHtml(hVertical) end + end + end - end # writeHtml + end # writeHtml + end # Html_Extent - end # class - - end - end - end + end + end + end end