Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

generate html directory out of markdown sources

  • Loading branch information...
commit 570d40eef228fc82a4536a5f987425c53b8b541d 1 parent 72a5fbf
@jtimberman jtimberman authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 slides/Rakefile
View
23 slides/Rakefile
@@ -21,6 +21,29 @@ task :mksection do
end
end
+desc "Generate HTML out of Markdown"
+task :md_to_html do
+ sections = showoff_sections
+ FileUtils.mkdir_p("html")
+ sections.each_with_index do |s,i|
+ fn = "html/section-#{i}-#{s}.html"
+ %x[grep -v "@@@" #{s}/01_slide.md | redcarpet > #{fn}]
+ %x[cp #{s}/*.png html 2>/dev/null]
+ File.open(File.join("html", "index.html"), "a+") do |h|
+ h.puts html_list_item s, fn
+ end
+ end
+end
+
+def html_list_item(section, filename)
+ %Q{<li><a href="../#{filename}">#{section}</a></li>}
+end
+
+def showoff_sections
+ require 'json'
+ JSON.parse(IO.read("showoff.json"))['sections']
+end
+
def section_header(section = "welcome")
lcase = %w{an of the a}
parts = section.split(/[-_]/)
Please sign in to comment.
Something went wrong with that request. Please try again.