lib/adiwg/mdtranslator/writers/html/sections/html_head.rb in adiwg-mdtranslator-1.4.0 vs lib/adiwg/mdtranslator/writers/html/sections/html_head.rb in adiwg-mdtranslator-2.0.0rc2
- old
+ new
@@ -1,68 +1,55 @@
# HTML writer
# html head
# History:
-# Stan Smith 2015-03-23 original script
-# Stan Smith 2015-04-07 added metadata tag to head
-# Stan Smith 2015-07-17 added support for user supplied css
+# Stan Smith 2017-03-22 refactored for mdTranslator 2.0
# Stan Smith 2015-07-20 moved mdTranslator logo to html_inlineCss.css
+# Stan Smith 2015-07-17 added support for user supplied css
+# Stan Smith 2015-04-07 added metadata tag to head
+# Stan Smith 2015-03-23 original script
module ADIWG
- module Mdtranslator
- module Writers
- module Html
+ module Mdtranslator
+ module Writers
+ module Html
- class MdHtmlHead
- def initialize(html, paramsObj)
- @html = html
- @paramsObj = paramsObj
- end
+ class Html_Head
+ def initialize(html)
+ @html = html
+ end
- def writeHtml()
- @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'=>'constructed using ADIwg mdTranslator tools 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')
- @html.comment!('metadata record generated ' + Time.now.to_s)
+ def writeHtml(version, cssLink)
- # 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.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)
- @html.style do
- @html.text!(css)
- end
+ # 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
- # append user supplied css
- if @paramsObj[:cssLink]
- @html.link('rel'=>'stylesheet', 'href'=> @paramsObj[:cssLink])
- end
- if @paramsObj[:css]
- @html.style(@paramsObj[:css])
- end
+ @html.style do
+ @html.text!(css)
+ end
- # add inline javascript
- # read javascript from file
- path = File.join(File.dirname(__FILE__), 'html_headScript.js')
- file = File.open(path, 'r')
- js = file.read
- file.close
+ # append user supplied css
+ if cssLink
+ @html.link('rel' => 'stylesheet', 'href' => cssLink)
+ end
- @html.script('type'=>'text/javascript') do
- @html << js
- end
+ end
- end
- end
+ end # writeHtml
+ end # Html_Head
- end
-
- end
- end
- end
+ end
+ end
+ end
end