/usr/lib/ruby/vendor_ruby/maruku/output/s5/to_s5.rb is in ruby-maruku 0.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | require 'maruku/output/to_html'
module MaRuKu
class MDDocument
def s5_theme
xtext(self.attributes[:slide_theme] || "default")
end
# Render as an HTML fragment (no head, just the content of BODY). (returns a string)
def to_s5(context={})
content_only = context[:content_only] != false
print_slides = context[:print_slides]
if content_only
body = xelem('div', doc)
else
html = xelem('html')
html['xmlns'] = 'http://www.w3.org/1999/xhtml'
html['xmlns:svg'] = "http://www.w3.org/2000/svg"
html['xml:lang'] = self.attributes[:lang] || 'en'
head = xelem('head')
html << head
me = xelem('meta')
me['http-equiv'] = 'Content-type'
me['content'] = 'text/html;charset=utf-8'
head << me
# Create title element
doc_title = self.attributes[:title] || self.attributes[:subject] || ""
begin
title_content = MaRuKu::HTMLFragment.new(doc_title).to_html
rescue
title_content = xtext(doc_title)
end
title = xelem('title') << title_content
head << title
body = xelem('body')
html << body
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 = "
<div class='layout'>
<div id='controls'> </div>
<div id='currentSlide'> </div>
<div id='header'> #{slide_header}</div>
<div id='footer'>
<h1>#{slide_footer}</h1>
<h2>#{slide_subfooter}</h2>
</div>
<div class='topleft'> #{slide_topleft}</div>
<div class='topright'> #{slide_topright}</div>
<div class='bottomleft'> #{slide_bottomleft}</div>
<div class='bottomright'> #{slide_bottomright}</div>
</div>
"
body << dummy_layout_slide
presentation = xelem('div')
presentation['class'] = 'presentation'
body << presentation
first_slide = "
<div class='slide'>
<h1> #{self.attributes[:title] ||context[:title]}</h1>
<h2> #{self.attributes[:subtitle] ||context[:subtitle]}</h2>
<h3> #{self.attributes[:author] ||context[:author]}</h3>
<h4> #{self.attributes[:company] ||context[:company]}</h4>
</div>
"
presentation << first_slide
slide_num = 0
self.toc.section_children.each do |slide|
slide_num += 1
@doc.attributes[:doc_prefix] = "s#{slide_num}"
div = xelem('div')
presentation << div
div['class'] = 'slide'
h1 = xelem('h1')
puts "Slide #{slide_num}: #{slide.header_element.children_to_html.join}" if print_slides
slide.header_element.children_to_html.inject(h1, &:<<)
div << h1
array_to_html(slide.immediate_children).inject(div, &:<<)
# render footnotes
unless @doc.footnotes_order.empty?
div << render_footnotes
@doc.footnotes_order = []
end
end
if content_only
xml = body.to_html
else
head << S5_external
add_css_to(head)
xml = html.to_html
Xhtml11_mathml2_svg11 + xml
end
end
end
end
|