lib/adiwg/mdtranslator/writers/html/sections/html_resourceGeneral.rb in adiwg-mdtranslator-1.2.1 vs lib/adiwg/mdtranslator/writers/html/sections/html_resourceGeneral.rb in adiwg-mdtranslator-1.3.0

- old
+ new

@@ -1,16 +1,18 @@ # HTML writer # general resource information # History: # Stan Smith 2015-03-24 original script +# Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS +# Stan Smith 2015-07-30 added support for locale -require 'html_citation' -require 'html_timePeriod' -require 'html_browseGraphic' -require 'html_resourceFormat' -require 'html_resourceUsage' +require_relative 'html_citation' +require_relative 'html_timePeriod' +require_relative 'html_browseGraphic' +require_relative 'html_resourceFormat' +require_relative 'html_resourceUsage' module ADIWG module Mdtranslator module Writers module Html @@ -21,15 +23,15 @@ end def writeHtml(resourceInfo) # classes used - htmlCitation = $HtmlNS::MdHtmlCitation.new(@html) - htmlTimeP = $HtmlNS::MdHtmlTimePeriod.new(@html) - htmlBGraph = $HtmlNS::MdHtmlBrowseGraphic.new(@html) - htmlResForm = $HtmlNS::MdHtmlResourceFormat.new(@html) - htmlResUse = $HtmlNS::MdHtmlResourceUsage.new(@html) + htmlCitation = MdHtmlCitation.new(@html) + htmlTimeP = MdHtmlTimePeriod.new(@html) + htmlBGraph = MdHtmlBrowseGraphic.new(@html) + htmlResForm = MdHtmlResourceFormat.new(@html) + htmlResUse = MdHtmlResourceUsage.new(@html) # general - title - taken from citation @html.em('Title: ') @html.text!(resourceInfo[:citation][:citTitle]) @html.br @@ -77,10 +79,22 @@ @html.em('Resource character sets: ') @html.text!(aCharSets.to_s) @html.br end + # resource locale + aLocale = resourceInfo[:resourceLocales] + aLocale.each do |hLocale| + @html.em('Metadata language: ') + @html.text!(hLocale[:languageCode]) + @html.em(' country: ') + @html.text!(hLocale[:countryCode]) + @html.em(' characterSet encoding: ') + @html.text!(hLocale[:characterEncoding]) + @html.br + end + # general - citation @html.details do @html.summary('Citation', {'id'=>'resourceGen-citation', 'class'=>'h4'}) @html.section(:class=>'block') do htmlCitation.writeHtml(resourceInfo[:citation]) @@ -88,13 +102,10 @@ end # general - abstract - required @html.details do @html.summary('Abstract', {'id'=>'resourceGen-abstract', 'class'=>'h4'}) - @html.section(:class=>'block') do - @html.text!(resourceInfo[:abstract]) - end - @html.br + @html.tag!("section",resourceInfo[:abstract], :class=>'block pre-line') end # general - purpose s = resourceInfo[:purpose] if !s.nil?