Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Head

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/simple_html/sections/html_head.rb

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_Head

Returns a new instance of Html_Head.



17
18
19
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_head.rb', line 17

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(version, cssLink) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_head.rb', line 21

def writeHtml(version, cssLink)

   @html.head do
      @html.meta({'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8'})
      @html.title('HTML Metadata report')
      @html.meta('name' => 'generator', 'content' => 'HTML output generated by ADIwg mdTranslator ToolKit ' + version + ' available at https://github.com/adiwg ')
      @html.meta('name' => 'description', 'content' => 'mdTranslator software is an open-source project of the Alaska Data Integration working group (ADIwg).  Alaska Data Integration working group is not responsible for the content of this metadata record')
      @html.meta('name' => 'keywords', 'content' => 'metadata, ADIwg, mdTranslator, ISO19115')
      @html.comment!('metadata record generated ' + Time.now.to_s)

      # add inline css
      # read css from file
      path = File.join(File.dirname(__FILE__), 'html_inlineCss.css')
      file = File.open(path, 'r')
      css = file.read
      file.close

      @html.style do
         @html.text!(css)
      end

      # append user supplied css
      if cssLink
         @html.link('rel' => 'stylesheet', 'href' => cssLink)
      end

   end

end