Skip to content

Commit

Permalink
Merge pull request #153 from stansmith907/dev
Browse files Browse the repository at this point in the history
Trap missing topology level in html writer vectorRepresentation modul…
  • Loading branch information
jlblcc authored Oct 18, 2017
2 parents 722aae3 + 6482cf4 commit c648f14
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# unpack fgdc distribution

# History:
# Stan Smith 2017-10-17 fixed problem with adding technical prerequisite to nil distribution description
# Stan Smith 2017-08-15 original script

require 'nokogiri'
Expand Down Expand Up @@ -75,7 +76,11 @@ def self.unpack(xDistribution, hResourceInfo, hResponseObj)
# -> distribution.description {+=}
techPre = xDistribution.xpath('./techpreq').text
unless techPre.empty?
hDistribution[:description] += '\n\n Technical Prerequisites: ' + techPre
if hDistribution[:description].nil?
hDistribution[:description] = techPre
else
hDistribution[:description] += '\n\n Technical Prerequisites: ' + techPre
end
end

# distribution 6.7 (availabl) - available time period {time period}
Expand Down
4 changes: 3 additions & 1 deletion lib/adiwg/mdtranslator/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# adiwg mdTranslator

# version 2 history
# 2.3.5 2017-10-17 fixed problem with adding technical prerequisite to nil distribution description
# 2.3.5 2017-10-13 trap missing topology level in html writer vectorRepresentation
# 2.3.4 2017-10-12 drop harvest set tag if repository citation is missing
# 2.3.3 2017-10-03 modify sbJson reader execution fail tests
# 2.3.2 2017-09-14 add associationType to sbJson relatedItems
Expand Down Expand Up @@ -30,7 +32,7 @@
module ADIWG
module Mdtranslator
# current mdtranslator version
VERSION = "2.3.4"
VERSION = "2.3.5"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def writeHtml(hCitation)
end

# citation - date [] {}
hCitation[:dates].each do |hDate|
hCitation[:dates].each do |hDate|
@html.em('Date: ')
dateClass.writeHtml(hDate)
@html.br
Expand Down
10 changes: 6 additions & 4 deletions lib/adiwg/mdtranslator/writers/html/sections/html_contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ def writeHtml(hContact)
graphicClass = Html_Graphic.new(@html)

@html.details do
@html.summary(hContact[:name], {'id' => 'CID_'+hContact[:contactId], 'class' => 'h3'})
@html.summary(hContact[:name], {'id' => 'CID_' + hContact[:contactId], 'class' => 'h3'})
@html.section(:class => 'block') do

# contact - contact ID
@html.em('Contact ID: ')
@html.text!(hContact[:contactId])
@html.br
unless hContact[:contactId].nil?
@html.em('Contact ID: ')
@html.text!(hContact[:contactId])
@html.br
end

# contact - isOrganization
@html.em('is Organization: ')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ def writeHtml(hGrid)
dimensionClass = Html_Dimension.new(@html)

# grid representation - number of dimensions
@html.em('Number of dimensions: ')
@html.text!(hGrid[:numberOfDimensions].to_s)
@html.br
unless hGrid[:numberOfDimensions].nil?
@html.em('Number of dimensions: ')
@html.text!(hGrid[:numberOfDimensions].to_s)
@html.br
end

# grid representation - dimension []
dimensionCount = 0
Expand All @@ -48,7 +50,7 @@ def writeHtml(hGrid)
@html.br
end

# grid representation - transformation parameters available
# grid representation - transformation parameters available {Boolean}
@html.em('Transformation parameters available: ')
@html.text!(hGrid[:transformationParameterAvailable].to_s)

Expand Down
4 changes: 3 additions & 1 deletion lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def writeHtml(hKeyword)
# keywords
@html.ul do
hKeyword[:keywords].each do |hKeyword|
@html.li(hKeyword[:keyword])
unless hKeyword[:keyword].nil?
@html.li(hKeyword[:keyword])
end
end
end

Expand Down
47 changes: 24 additions & 23 deletions lib/adiwg/mdtranslator/writers/html/sections/html_resourceFormat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,36 @@
# Stan Smith 2015-03-24 original script

module ADIWG
module Mdtranslator
module Writers
module Html
module Mdtranslator
module Writers
module Html

class MdHtmlResourceFormat
def initialize(html)
@html = html
end
class MdHtmlResourceFormat
def initialize(html)
@html = html
end

def writeHtml(hResFormat)
def writeHtml(hResFormat)

# resource format - name - required
@html.em('Resource Format: ')
@html.text!(hResFormat[:formatName])
# resource format - name - required
unless hResFormat[:formatName].nil?
@html.em('Resource Format: ')
@html.text!(hResFormat[:formatName])
end

# resource format - version
s = hResFormat[:formatVersion]
if !s.nil?
@html.em(' Version: ')
@html.text!(s)
end
# resource format - version
unless !hResFormat[:formatVersion].nil?
@html.em(' Version: ')
@html.text!(hResFormat[:formatVersion])
end

@html.br
@html.br

end # writeHtml
end # writeHtml

end # class
end # class

end
end
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ def writeHtml(hResource)
end

# full abstract
@html.em('Full Abstract:')
@html.br
@html.text!(hResource[:abstract])
unless hResource[:abstract].nil?
@html.em('Full Abstract:')
@html.br
@html.text!(hResource[:abstract])
end

end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ def initialize(html)

def writeHtml(hType)

# resource type
@html.em('Resource Type: ')
@html.text!(hType[:type])
unless hType[:name].nil?
@html.em(' Name: ')
@html.text!(hType[:name])
# resource type - (required)
unless hType[:type].nil?
@html.em('Resource Type: ')
@html.text!(hType[:type])
unless hType[:name].nil?
@html.em(' Name: ')
@html.text!(hType[:name])
end
@html.br
end
@html.br

end # writeHtml
end # Html_ResourceType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ def initialize(html)

def writeHtml(hSecCon)

# security constraint - classification code {classification}
@html.em('Classification: ')
@html.text!(hSecCon[:classCode])
@html.br

# security constraint - classification code {classification} (required)
unless hSecCon[:classCode].nil?
@html.em('Classification: ')
@html.text!(hSecCon[:classCode])
@html.br
end

# security constraint - classification system
@html.em('Classification System: ')
@html.text!(hSecCon[:classSystem])
@html.br
unless hSecCon[:classSystem].nil?
@html.em('Classification System: ')
@html.text!(hSecCon[:classSystem])
@html.br
end

# security constraint - user note
unless hSecCon[:userNote].nil?
Expand Down
66 changes: 0 additions & 66 deletions lib/adiwg/mdtranslator/writers/html/sections/html_sensorInfo.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# vector representation

# History:
# Stan Smith 2017-10-13 trap missing topology level
# Stan Smith 2017-03-28 original script

require_relative 'html_vectorObject'
Expand All @@ -23,9 +24,11 @@ def writeHtml(hVector)
objectClass = Html_VectorObject.new(@html)

# vector representation - topology level
@html.em('Topology Level: ')
@html.text!(hVector[:topologyLevel])
@html.br
unless hVector[:topologyLevel].nil?
@html.em('Topology Level: ')
@html.text!(hVector[:topologyLevel])
@html.br
end

# vector representation - vector object []
hVector[:vectorObject].each do |hObject|
Expand Down

0 comments on commit c648f14

Please sign in to comment.