Navigation Menu

Skip to content

Commit

Permalink
Templates for Statics and PDFs
Browse files Browse the repository at this point in the history
* fixing positioning of a slide when using the onepage.css
  • Loading branch information
grundprinzip committed Nov 13, 2011
1 parent 04dd4eb commit ce08379
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
20 changes: 15 additions & 5 deletions lib/showoff.rb
Expand Up @@ -190,26 +190,36 @@ def process_markdown(name, content, static=false, pdf=false)
md += " class=\"slide\" data-transition=\"#{transition}\">"


template = "###CONTENT###"
# Template handling
if options.pres_template
# We allow specifying a new template even when default is
# not given.
if options.pres_template.include?(slide.tpl) and
File.exists?(options.pres_template[slide.tpl])
md += File.open(options.pres_template[slide.tpl], "r").read()
template = File.open(options.pres_template[slide.tpl], "r").read()
end
end


# Extract the content of the slide
content = ""

if seq
md += "<div class=\"#{content_classes.join(' ')}\" ref=\"#{name}/#{seq.to_s}\">\n"
content += "<div class=\"#{content_classes.join(' ')}\" ref=\"#{name}/#{seq.to_s}\">\n"
seq += 1
else
md += "<div class=\"#{content_classes.join(' ')}\" ref=\"#{name}\">\n"
content += "<div class=\"#{content_classes.join(' ')}\" ref=\"#{name}\">\n"
end
sl = Markdown.new(slide.text).to_html
sl = update_image_paths(name, sl, static, pdf)
md += sl
md += "</div>\n"
content += sl
content += "</div>\n"

# Apply the template to the slide and replace the key with
# content of the slide
md += template.gsub(/###CONTENT###/, content)

md += "</div>\n"
final += update_commandline_code(md)
final = update_p_classes(final)
Expand Down
1 change: 1 addition & 0 deletions public/css/onepage.css
Expand Up @@ -9,6 +9,7 @@
margin-left:auto;
margin-right:auto;
overflow:hidden;
position: relative;
border: 1px solid #333;
page-break-after: always
}
Expand Down
3 changes: 1 addition & 2 deletions public/js/onepage.js
@@ -1,5 +1,4 @@
function setupOnePage() {
sh_highlightDocument('/js/sh_lang/', '.min.js')

centerSlides($("#slides > .slide"))
}
}
2 changes: 0 additions & 2 deletions views/onepage.erb
Expand Up @@ -25,10 +25,8 @@
</head>

<body>

<div id="slides">
<%= @slides %>
</div>

</body>
</html>

0 comments on commit ce08379

Please sign in to comment.