Skip to content

Commit

Permalink
Feature/acquisition simple html writer (#385)
Browse files Browse the repository at this point in the history
* Add acquisiton class to body. Create Acquisition class.

* Add operation and plan classes to html writer.

* Add objective and requirement classes to html writer.

* Add event class to html writer. Fix objective class.

* Add pass class to html writer. fix event class typos and requires

* Add instrument and platform classes.

* Add environment, instrumentationEvent, instrumentationEventList, requestedDate classes. fix platform class.

* Add Revision class. fix html_requirement file name.

* Fixes to requestedDate, requirement, acquisition, and plan. fix key to retrieve acquisition array.

* Bugfixes to html writer for acquisitions section

* fix revision datetime in revision class for mdJson reader

* HTML formatting to fit standard of rest of page

* Add acquisition button to sidebar within body

* Add acquisition class. Update body class to include acquisition class.

* Add remaining classes used for acquisition.

* fix access to acquisition within metadata
  • Loading branch information
J-Oliveros authored Jun 17, 2024
1 parent 1587fa6 commit a925c26
Show file tree
Hide file tree
Showing 15 changed files with 1,504 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
require_relative 'html_scope'
require_relative 'html_plan'
require_relative 'html_requirement'
require_relative 'html_objective'
require_relative 'html_platform'
require_relative 'html_instrument'
require_relative 'html_operation'
require_relative 'html_event'
require_relative 'html_pass'
require_relative 'html_environment'

module ADIWG
module Mdtranslator
module Writers
module Simple_html
class Html_Acquisition
def initialize(html)
@html = html
end

def writeHtml(hAcquisition)
scopeClass = Html_Scope.new(@html)
planClass = Html_Plan.new(@html)
requirementClass = Html_Requirement.new(@html)
objectiveClass = Html_Objective.new(@html)
platformClass = Html_Platform.new(@html)
instrumentClass = Html_Instrument.new(@html)
operationClass = Html_Operation.new(@html)
eventClass = Html_Event.new(@html)
passClass = Html_Pass.new(@html)
environmentClass = Html_Environment.new(@html)

# scope
unless hAcquisition[:scope].empty?
@html.div do
@html.h5('Scope', {'class' => 'h5'})
@html.div(:class => 'block') do
scopeClass.writeHtml(hDataQuality[:scope])
end
end
end

# plan
unless hAcquisition[:plans].empty?
@html.div(:class =>'block') do
@html.div do
@html.h4('Plans', {'class' => 'h4'})
hAcquisition[:plans].each do |plan|
@html.div(:class =>'block') do
@html.div do
@html.h5('Plan', {'class' => 'h5'})
planClass.writeHtml(plan)
end
end
end
end
end
end

# requirement
unless hAcquisition[:requirements].empty?
@html.div(:class =>'block') do
@html.div do
@html.h4('Requirements', {'class' => 'h4'})
hAcquisition[:requirements].each do |requirement|
@html.div(:class =>'block') do
@html.div do
@html.h5('Requirement', {'class' => 'h5'})
requirementClass.writeHtml(requirement)
end
end
end
end
end
end

# objective
unless hAcquisition[:objectives].empty?
@html.div(:class =>'block') do
@html.div do
@html.h4('Objectives', {'class' => 'h4'})
hAcquisition[:objectives].each do |objective|
@html.div(:class =>'block') do
@html.div do
@html.h5('Objective', {'class' => 'h5'})
objectiveClass.writeHtml(objective)
end
end
end
end
end
end


# platform
unless hAcquisition[:platforms].empty?
@html.div(:class =>'block') do
@html.div do
@html.h4('Platforms', {'class' => 'h4'})
hAcquisition[:platforms].each do |platform|
@html.div(:class =>'block') do
@html.div do
@html.h5('Platform', {'class' => 'h5'})
platformClass.writeHtml(platform)
end
end
end
end
end
end

# Instrument
unless hAcquisition[:instruments].empty?
@html.div(:class =>'block') do
@html.div do
@html.h4('Instrument', {'class' => 'h4'})
hAcquisition[:instruments].each do |instrument|
@html.div(:class =>'block') do
@html.div do
@html.h5('Instrument', {'class' => 'h5'})
instrumentClass.writeHtml(instrument)
end
end
end
end
end
end

# operation
unless hAcquisition[:operations].empty?
@html.div(:class =>'block') do
@html.div do
@html.h4('Operations', {'class' => 'h4'})
hAcquisition[:operations].each do |operations|
@html.div(:class =>'block') do
@html.div do
@html.h5('Operation', {'class' => 'h5'})
operationClass.writeHtml(operations)
end
end
end
end
end
end

# Event
unless hAcquisition[:events].empty?
@html.div(:class =>'block') do
@html.div do
@html.h4('Events', {'class' => 'h4'})
hAcquisition[:events].each do |event|
@html.div(:class =>'block') do
@html.div do
@html.h5('Event', {'class' => 'h5'})
eventClass.writeHtml(event)
end
end
end
end
end
end

# Pass
unless hAcquisition[:passes].empty?
@html.div(:class =>'block') do
@html.div do
@html.h4('Passes', {'class' => 'h4'})
hAcquisition[:passes].each do |pass|
@html.div(:class =>'block') do
@html.div do
@html.h5('Pass', {'class' => 'h5'})
passClass.writeHtml(pass)
end
end
end
end
end
end

# Environment
unless hAcquisition[:environment].empty?
@html.div do
@html.h5('Scope', {'class' => 'h5'})
@html.div(:class => 'block') do
environmentClass.writeHtml(hAcquisition[:environment])
end
end
end

end
end
end
end
end
end
16 changes: 16 additions & 0 deletions lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
require_relative 'html_funding'
require_relative 'html_dataDictionary'
require_relative 'html_metadataRepository'
require_relative 'html_acquisition'

module ADIWG
module Mdtranslator
Expand Down Expand Up @@ -47,6 +48,7 @@ def writeHtml(version, intObj)
fundingClass = Html_Funding.new(@html)
dictionaryClass = Html_DataDictionary.new(@html)
repositoryClass = Html_Repository.new(@html)
aquisitionClass = Html_Acquisition.new(@html)

# make sections of the internal data store convenient
hSchema = intObj[:schema]
Expand All @@ -61,6 +63,7 @@ def writeHtml(version, intObj)
aFunding = intObj[:metadata][:funding]
aDictionaries = intObj[:dataDictionaries]
aRepositories = intObj[:metadataRepositories]
aAcquisitions = intObj[:metadata][:acquisitions]

# set page title and logo
# side navigation
Expand All @@ -78,6 +81,7 @@ def writeHtml(version, intObj)
@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'})
@html.a(' Acquisition', {'href' => '#body-acquisition', 'class' => 'btn navBtn', 'id' => 'acquisitionButton'})

end

Expand Down Expand Up @@ -298,6 +302,18 @@ def writeHtml(version, intObj)
end
end

unless aAcquisitions.nil? || aAcquisitions.empty?
@html.div do
@html.h2('Acquisitions', {'id' => 'body-acquisition', 'class' => 'h2'})
@html.span('', {'style' => 'mso-bookmark:body-acquisition'})
aAcquisitions.each do |hAcquisition|
@html.div(:class => 'block') do
aquisitionClass.writeHtml(hAcquisition)
end
end
end
end

end # body
end # writeHtml
end # Html_Body
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
module ADIWG
module Mdtranslator
module Writers
module Simple_html
class Html_Environment
def initialize(html)
@html = html
end

def writeHtml(hEnvironment)
# averageAirTemperature
unless hEnvironment[:averageAirTemperature].nil?
@html.em('Average Air Temperature: ')
@html.text!(hEnvironment[:averageAirTemperature].to_s)
@html.br
end

# maxRelativeHumidity
unless hEnvironment[:maxRelativeHumidity].nil?
@html.em('Maximum Relative Humidity: ')
@html.text!(hEnvironment[:maxRelativeHumidity].to_s)
@html.br
end

# maxAltitude
unless hEnvironment[:maxAltitude].nil?
@html.em('Maximum Altitude: ')
@html.text!(hEnvironment[:maxAltitude].to_s)
@html.br
end

# meteorologicalConditions
unless hEnvironment[:meteorologicalConditions].nil?
@html.em('Meteorological Conditions: ')
@html.text!(hEnvironment[:meteorologicalConditions])
@html.br
end

# solarAzimuth
unless hEnvironment[:solarAzimuth].nil?
@html.em('Solar Azimuth: ')
@html.text!(hEnvironment[:solarAzimuth].to_s)
@html.br
end

# solarElevation
unless hEnvironment[:solarElevation].nil?
@html.em('Solar Elevation: ')
@html.text!(hEnvironment[:solarElevation].to_s)
@html.br
end

end
end
end
end
end
end
Loading

0 comments on commit a925c26

Please sign in to comment.