diff --git a/Gemfile.lock b/Gemfile.lock index 071d441ee..f2110490e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - adiwg-mdtranslator (2.19.2) + adiwg-mdtranslator (2.20.0) adiwg-mdcodes (= 2.9.0) adiwg-mdjson_schemas (= 2.8.2) builder (~> 3.2) diff --git a/lib/adiwg/mdtranslator/version.rb b/lib/adiwg/mdtranslator/version.rb index 5a4cab3c0..2544673ee 100644 --- a/lib/adiwg/mdtranslator/version.rb +++ b/lib/adiwg/mdtranslator/version.rb @@ -109,7 +109,7 @@ module ADIWG module Mdtranslator # current mdtranslator version - VERSION = "2.19.2" + VERSION = "2.20.0" end end diff --git a/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb b/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb similarity index 96% rename from lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb rename to lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb index 0e9f498af..8bd081912 100644 --- a/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb +++ b/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb @@ -12,7 +12,7 @@ module Mdtranslator module Writers module Fgdc - class Quality + class DataQuality def initialize(xml, hResponseObj) @xml = xml @@ -71,7 +71,7 @@ def writeXML(intObj) horizontal_positional_accuracy_report = hDataQuality[:report].find do |report| report[:type] == 'DQ_AbsoluteExternalPositionalAccuracy' && - report.dig(:qualityMeasure, :name).any? { |name| + report.dig(:qualityMeasure, :nameOfMeasure)&.any? { |name| name == 'Horizontal Positional Accuracy Report' } end @@ -81,7 +81,7 @@ def writeXML(intObj) vertical_positional_accuracy_report = hDataQuality[:report].find do |report| report[:type] == 'DQ_AbsoluteExternalPositionalAccuracy' && - report.dig(:qualityMeasure, :name).any? { |name| + report.dig(:qualityMeasure, :nameOfMeasure)&.any? { |name| name == 'Vertical Positional Accuracy Report' } end diff --git a/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb b/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb index 6713251d6..a8c3d9748 100644 --- a/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +++ b/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb @@ -5,7 +5,7 @@ # Stan Smith 2017-11-16 original script require_relative 'class_identification' -require_relative 'class_quality' +require_relative 'class_dataQuality' require_relative 'class_spatialOrganization' require_relative 'class_spatialReference' require_relative 'class_dictionary' @@ -33,7 +33,7 @@ def writeXML(intObj) # classes used idClass = Identification.new(@xml, @hResponseObj) - qualityClass = Quality.new(@xml, @hResponseObj) + dataQualityClass = DataQuality.new(@xml, @hResponseObj) spaceOrgClass = SpatialOrganization.new(@xml, @hResponseObj) spaceRefClass = SpatialReference.new(@xml, @hResponseObj) dictionaryClass = DataDictionary.new(@xml, @hResponseObj) @@ -62,7 +62,7 @@ def writeXML(intObj) # currently only lineage is implemented unless intObj[:metadata][:lineageInfo].empty? @xml.tag!('dataqual') do - qualityClass.writeXML(intObj) + dataQualityClass.writeXML(intObj) end end if intObj[:metadata][:lineageInfo].empty? && @hResponseObj[:writerShowTags] diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb index 2b66667dc..3b2d14747 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb @@ -67,37 +67,25 @@ def writeHtml(version, intObj) @html.div('id' => 'sideNav') do # add section buttons - @html.a(' Top', {'href' => '#', 'class' => 'btn'}) @html.a(' Contacts', {'href' => '#body-contacts', 'class' => 'btn navBtn', 'id' => 'contactButton'}) @html.a(' Metadata', {'href' => '#body-metadataInfo', 'class' => 'btn navBtn', 'id' => 'metadataButton'}) @html.a(' Resource', {'href' => '#body-resourceInfo', 'class' => 'btn navBtn', 'id' => 'resourceButton'}) @html.a(' Lineage', {'href' => '#body-lineage', 'class' => 'btn navBtn', 'id' => 'lineageButton'}) @html.a(' Distribution', {'href' => '#body-distribution', 'class' => 'btn navBtn', 'id' => 'distributionButton'}) + @html.br @html.a(' Associated', {'href' => '#body-associatedResource', 'class' => 'btn navBtn', 'id' => 'associatedButton'}) @html.a(' Additional', {'href' => '#body-additionalDocument', 'class' => 'btn navBtn', 'id' => 'additionalButton'}) @html.a(' Dictionary', {'href' => '#body-dataDictionary', 'class' => 'btn navBtn', 'id' => 'dictionaryButton'}) @html.a(' Funding', {'href' => '#body-funding', 'class' => 'btn navBtn', 'id' => 'fundingButton'}) @html.a(' Repository', {'href' => '#body-repository', 'class' => 'btn navBtn', 'id' => 'repositoryButton'}) - # add open and close buttons - @html.span(' Open', {'class' => 'btn icon-caret-down', 'id' => 'openAllButton'}) - @html.span(' Close', {'class' => 'btn icon-caret-right', 'id' => 'closeAllButton'}) - end # main header @html.h2('id' => 'mainHeader') do # added blank to span tag to force builder to create closing tag - @html.span('', 'id' => 'logo') - @html.span('Metadata Record') - @html.span('HTML5', 'class' => 'version') end - # report title - # aShortVersion = version.split('.') - # shortVersion = aShortVersion[0].to_s + '.' + aShortVersion[1].to_s - @html.h1('mdTranslator ' + version + ' HTML Metadata Record', 'id' => 'mdtranslator-metadata-report') - # resource citation title unless hResourceInfo.empty? unless hResourceInfo[:citation].empty? @@ -110,7 +98,7 @@ def writeHtml(version, intObj) # report date @html.div(:class => 'block') do @html.em('Report Generated:') - @html.text!(Time.new.inspect) + @html.text!(Time.new.strftime('%Y-%m-%d %H:%M:%S')) end # metadata source @@ -137,6 +125,7 @@ def writeHtml(version, intObj) end end @html.hr + @html.br end end end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb index 1bd127ef8..c1483e1d2 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb @@ -70,7 +70,7 @@ def writeHtml(hContact) # contact - address hContact[:addresses].each do |hAddress| @html.div do - @html.h5('Address', {'class' => 'h5'}) + @html.h5('Address', {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do # address - delivery points @@ -119,7 +119,7 @@ def writeHtml(hContact) # contact - phones hContact[:phones].each do |hPhone| @html.div do - @html.h5('Phone', {'class' => 'h5'}) + @html.h5('Phone', {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do # phone - name @@ -159,7 +159,7 @@ def writeHtml(hContact) # contact - online resource [] hContact[:onlineResources].each do |hOnline| @html.div do - @html.h5('Online Resource', {'class' => 'h5'}) + @html.h5('Online Resource', {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do onlineClass.writeHtml(hOnline) end @@ -169,7 +169,7 @@ def writeHtml(hContact) # contact - logos [] hContact[:logos].each do |hLogo| @html.div do - @html.h5('Logo Graphic', {'class' => 'h5'}) + @html.h5('Logo Graphic', {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do graphicClass.writeHtml(hLogo) end @@ -194,7 +194,7 @@ def writeHtml(hContact) if hContact.key?(:externalIdentifier) && !hContact[:externalIdentifier].empty? hContact[:externalIdentifier].each do |identifier| @html.div do - @html.h5("External Identifier", {'class' => 'h5'}) + @html.h5("External Identifier", {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do @html.em('Identifier: ') @html.text!(identifier[:identifier]) diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb index a15a6c916..61cd4844d 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb @@ -32,20 +32,7 @@ def writeHtml(hKeyword) end @html.h5(type, {'class' => 'h5'}) @html.div(:class => 'block') do - - # keywords - @html.ul do - hKeyword[:keywords].each do |hKeyword| - unless hKeyword[:keyword].nil? - keyword = hKeyword[:keyword] - unless hKeyword[:keywordId].nil? - keyword += ' (ID: ' + hKeyword[:keywordId].to_s + ')' - end - @html.li(keyword) - end - end - end - + # thesaurus unless hKeyword[:thesaurus].empty? @html.div do @@ -56,6 +43,17 @@ def writeHtml(hKeyword) end end + # keywords + hKeyword[:keywords].each do |hKeyword| + unless hKeyword[:keyword].nil? + keyword = hKeyword[:keyword] + unless hKeyword[:keywordId].nil? + keyword += ' (ID: ' + hKeyword[:keywordId].to_s + ')' + end + @html.div('Keyword:' + keyword) + end + end + end end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb index 513914817..307867338 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb @@ -50,7 +50,7 @@ def writeHtml(hMetaInfo) # metadataInfo - metadata identifier {identifier} unless hMetaInfo[:metadataIdentifier].empty? @html.div do - @html.h3('Metadata Identifier', {'id' => 'metadataInfo-identifier', 'class' => 'h3'}) + @html.h3('Metadata Identifier', {'id' => 'metadataInfo-identifier', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do identifierClass.writeHtml(hMetaInfo[:metadataIdentifier]) end @@ -60,7 +60,7 @@ def writeHtml(hMetaInfo) # metadataInfo - parent metadata {citation} unless hMetaInfo[:parentMetadata].empty? @html.div do - @html.h3('Parent Metadata', {'id' => 'metadataInfo-parent', 'class' => 'h3'}) + @html.h3('Parent Metadata', {'id' => 'metadataInfo-parent', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do citationClass.writeHtml(hMetaInfo[:parentMetadata]) end @@ -70,7 +70,7 @@ def writeHtml(hMetaInfo) # metadataInfo - metadata locales unless hMetaInfo[:defaultMetadataLocale].empty? && hMetaInfo[:otherMetadataLocales].empty? @html.div do - @html.h3('Metadata Locales', {'id' => 'metadataInfo-locale', 'class' => 'h3'}) + @html.h3('Metadata Locales', {'id' => 'metadataInfo-locale', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do # default metadata locales {locale} @@ -100,7 +100,7 @@ def writeHtml(hMetaInfo) # metadataInfo - contacts [] {responsibility} unless hMetaInfo[:metadataContacts].empty? @html.div do - @html.h3('Metadata Contacts', {'id' => 'metadataInfo-contacts', 'class' => 'h3'}) + @html.h3('Metadata Contacts', {'id' => 'metadataInfo-contacts', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:metadataContacts].each do |hResponsibility| @html.div do @@ -117,7 +117,7 @@ def writeHtml(hMetaInfo) # metadataInfo - dates [] {date} unless hMetaInfo[:metadataDates].empty? @html.div do - @html.h3('Metadata Dates', {'id' => 'metadataInfo-dates', 'class' => 'h3'}) + @html.h3('Metadata Dates', {'id' => 'metadataInfo-dates', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:metadataDates].each do |hDate| @html.em('Date: ') @@ -131,7 +131,7 @@ def writeHtml(hMetaInfo) # metadataInfo - linkages [] {onlineResource} unless hMetaInfo[:metadataLinkages].empty? @html.div do - @html.h3('Metadata Online Resource', {'id' => 'metadataInfo-links', 'class' => 'h3'}) + @html.h3('Metadata Online Resource', {'id' => 'metadataInfo-links', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:metadataLinkages].each do |hOnline| @html.div do @@ -148,7 +148,7 @@ def writeHtml(hMetaInfo) # metadataInfo - constraints [] {constraint} unless hMetaInfo[:metadataConstraints].empty? @html.div do - @html.h3('Metadata Constraints', {'id' => 'metadataInfo-constraint', 'class' => 'h3'}) + @html.h3('Metadata Constraints', {'id' => 'metadataInfo-constraint', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:metadataConstraints].each do |hConstraint| @html.div do @@ -165,7 +165,7 @@ def writeHtml(hMetaInfo) # metadataInfo - maintenance {maintenance} unless hMetaInfo[:metadataMaintenance].empty? @html.div do - @html.h3('Metadata Maintenance', {'id' => 'metadataInfo-maintenance', 'class' => 'h3'}) + @html.h3('Metadata Maintenance', {'id' => 'metadataInfo-maintenance', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do maintClass.writeHtml(hMetaInfo[:metadataMaintenance]) end @@ -175,13 +175,14 @@ def writeHtml(hMetaInfo) # metadataInfo - alternate metadata references [] {citation} unless hMetaInfo[:alternateMetadataReferences].empty? @html.div do - @html.h3('Alternate Metadata Citations', {'id' => 'metadataInfo-alternate', 'class' => 'h3'}) + @html.h3('Alternate Metadata Citations', {'id' => 'metadataInfo-alternate', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:alternateMetadataReferences].each do |hCitation| @html.div do @html.div(hCitation[:title], 'class' => 'h5') @html.div(:class => 'block') do citationClass.writeHtml(hCitation) + @html.br end end end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb index 566d6fbbd..94804a12f 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb @@ -64,9 +64,7 @@ def writeHtml(hPeriod) # time period - description unless hPeriod[:description].nil? @html.em('Description: ') - @html.div(:class => 'block') do - @html.text!(hPeriod[:description]) - end + @html.text!(hPeriod[:description]) end # time period - start geologic age {geologic age} diff --git a/test/readers/fgdc/tc_fgdc_quality.rb b/test/readers/fgdc/tc_fgdc_quality.rb index d2c16aa2d..8430079f4 100644 --- a/test/readers/fgdc/tc_fgdc_quality.rb +++ b/test/readers/fgdc/tc_fgdc_quality.rb @@ -1,5 +1,5 @@ # MdTranslator - minitest of -# readers / fgdc / module_quality +# readers / fgdc / module_dataQuality # History: # Stan Smith 2017-08-31 original script