Skip to content

Commit

Permalink
Feature/simple html (#345)
Browse files Browse the repository at this point in the history
* add geographicExtent to simple_html writer (#338)

* add geographicExtent to simple_html writer

* Fix Data Quality

Fixed checks for nil and empty.
Fixed tags.
Fixed structures.

* Fix Data Quality

* Remove bodyScript and other js

* Fix Typo referenceDocument -> referenceDocuments

---------

Co-authored-by: Johnathan Aspinwall <[email protected]>

* add bookmark span tags to headers (#340)

Co-authored-by: Johnathan Aspinwall <[email protected]>

* Increment Patch Version

* Increment Minor Version

* Bugfixes for Simple HTML (#343)

* change divs to headers (#337)

* change divs to headers

* fix key within qualityMeasure. change to header tags

* Simple HTML Enhancements (#339)

* add geographicExtent to simple_html writer (#338)

* add geographicExtent to simple_html writer

* Fix Data Quality

Fixed checks for nil and empty.
Fixed tags.
Fixed structures.

* Fix Data Quality

* Remove bodyScript and other js

* Fix Typo referenceDocument -> referenceDocuments

---------

Co-authored-by: Johnathan Aspinwall <[email protected]>

* add bookmark span tags to headers (#340)

Co-authored-by: Johnathan Aspinwall <[email protected]>

* Increment Patch Version

* Increment Minor Version

---------

Co-authored-by: J-Oliveros <[email protected]>

---------

Co-authored-by: J-Oliveros <[email protected]>

* Increment Patch Version

* Fix Data Quality

* Increment Patch Version

* simple_html output formatting (#344)

---------

Co-authored-by: J-Oliveros <[email protected]>
  • Loading branch information
jwaspin and J-Oliveros authored Feb 12, 2024
1 parent 271bfe9 commit e9965a0
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/adiwg/mdtranslator/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
module ADIWG
module Mdtranslator
# current mdtranslator version
VERSION = "2.19.2"
VERSION = "2.20.0"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Mdtranslator
module Writers
module Fgdc

class Quality
class DataQuality

def initialize(xml, hResponseObj)
@xml = xml
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down
17 changes: 3 additions & 14 deletions lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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
Expand All @@ -137,6 +125,7 @@ def writeHtml(version, intObj)
end
end
@html.hr
@html.br
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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])
Expand Down
26 changes: 12 additions & 14 deletions lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}
Expand Down Expand Up @@ -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
Expand All @@ -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: ')
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion test/readers/fgdc/tc_fgdc_quality.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# MdTranslator - minitest of
# readers / fgdc / module_quality
# readers / fgdc / module_dataQuality

# History:
# Stan Smith 2017-08-31 original script
Expand Down

0 comments on commit e9965a0

Please sign in to comment.