# This module groups all functions related to HTML export. module MaRuKu class MDDocument def s5_theme html_escape(self.attributes[:slide_theme] || "default") end def html_escape(string) string.gsub( /&/, "&" ). gsub( /, "<" ). gsub( />/, ">" ). gsub( /'/, "'" ). gsub( /"/, """ ) end # Render as an HTML fragment (no head, just the content of BODY). (returns a string) def to_s5(context={}) indent = context[:indent] || -1 ie_hack = !context[:ie_hack].kind_of?(FalseClass) content_only = !context[:content_only].kind_of?(FalseClass) doc = Document.new(nil,{:respect_whitespace =>:all}) if content_only body = Element.new('div', doc) else html = Element.new('html', doc) html.add_namespace('http://www.w3.org/1999/xhtml') html.add_namespace('svg', "http://www.w3.org/2000/svg" ) head = Element.new('head', html) me = Element.new 'meta', head me.attributes['http-equiv'] = 'Content-type' me.attributes['content'] = 'text/html;charset=utf-8' # Create title element doc_title = self.attributes[:title] || self.attributes[:subject] || "" title = Element.new 'title', head title << Text.new(doc_title) body = Element.new('body', html) end slide_header = self.attributes[:slide_header] slide_footer = self.attributes[:slide_footer] slide_subfooter = self.attributes[:slide_subfooter] slide_topleft = self.attributes[:slide_topleft] slide_topright = self.attributes[:slide_topright] slide_bottomleft = self.attributes[:slide_bottomleft] slide_bottomright = self.attributes[:slide_bottomright] dummy_layout_slide = "