class ADIWG::Mdtranslator::Writers::Html::Html_Usage

Public Class Methods

new(html) click to toggle source
# File lib/adiwg/mdtranslator/writers/html/sections/html_usage.rb, line 20
def initialize(html)
   @html = html
end

Public Instance Methods

writeHtml(hUsage) click to toggle source
# File lib/adiwg/mdtranslator/writers/html/sections/html_usage.rb, line 24
def writeHtml(hUsage)

   # classes used
   temporalClass = Html_TemporalExtent.new(@html)
   citationClass = Html_Citation.new(@html)
   responsibilityClass = Html_Responsibility.new(@html)

   # resource usage - use
   @html.em('Usage: ')
   @html.section(:class => 'block') do
      @html.text!(hUsage[:specificUsage])
   end

   # resource usage - temporal extent
   unless hUsage[:temporalExtents].empty?
      @html.details do
         @html.summary('Times and Periods of Usage', 'class' => 'h5')
         @html.section(:class => 'block') do
            hUsage[:temporalExtents].each do |hTemporal|
               temporalClass.writeHtml(hTemporal)
            end
         end
      end
   end

   # resource usage - limitation
   unless hUsage[:userLimitation].nil? && hUsage[:limitationResponses].empty?
      @html.details do
         @html.summary('User Defined Limitations', 'class' => 'h5')
         @html.section(:class => 'block') do

            # user limitation
            unless hUsage[:userLimitation].nil?
               @html.em('Description')
               @html.section(:class => 'block') do
                  @html.text!(hUsage[:userLimitation])
               end
            end

            # limitation responses []
            hUsage[:limitationResponses].each do |response|
               @html.em('Response')
               @html.section(:class => 'block') do
                  @html.text!(response)
               end
            end

         end
      end
   end

   # resource usage - documented issue
   unless hUsage[:identifiedIssue].empty?
      @html.details do
         @html.summary('Cited Issue', 'class' => 'h5')
         @html.section(:class => 'block') do
            citationClass.writeHtml(hUsage[:identifiedIssue])
         end
      end
   end

   # resource usage - additional documentation
   hUsage[:additionalDocumentation].each do |hCitation|
      @html.details do
         @html.summary('Additional Documentation', 'class' => 'h5')
         @html.section(:class => 'block') do
            citationClass.writeHtml(hCitation)
         end
      end
   end

   # resource usage - user contacts
   unless hUsage[:userContacts].empty?
      @html.details do
         @html.summary('Usage and Limitation Contacts', {'class' => 'h5'})
         @html.section(:class => 'block') do
            hUsage[:userContacts].each do |hContact|
               @html.details do
                  @html.summary(hContact[:roleName], 'class' => 'h5')
                  @html.section(:class => 'block') do
                     responsibilityClass.writeHtml(hContact)
                  end
               end
            end
         end
      end
   end

end