Sha256: 6fa7fb43c531193780188f698a4e779252126142b5e13df013bfa0ef4bc8b146

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

# HTML writer
# html head

# History:
# 	Stan Smith 2015-03-23 original script
#   Stan Smith 2015-04-07 added metadata tag to head

module ADIWG
    module Mdtranslator
        module Writers
            module Html

                class MdHtmlHead
                    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('ADIWG mdTranslator HTML writer output')

                            # 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

                            # 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

                            @html.script('type'=>'text/javascript') do
                                @html << js
                            end

                        end
                    end

                end

            end
        end
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adiwg-mdtranslator-1.2.1 lib/adiwg/mdtranslator/writers/html/sections/html_head.rb
adiwg-mdtranslator-1.2.0 lib/adiwg/mdtranslator/writers/html/sections/html_head.rb
adiwg-mdtranslator-1.1.1 lib/adiwg/mdtranslator/writers/html/sections/html_head.rb
adiwg-mdtranslator-1.1.0 lib/adiwg/mdtranslator/writers/html/sections/html_head.rb