#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'rdiscount' require 'erb' @title = "Web log entries" @copyright = "Luke Shumaker" license = "CC BY-SA-3.0" license_url = 'https://creativecommons.org/licenses/by-sa/3.0/' @license="#{license}" markdown = "# #{@title}\n\n" for filename in ARGV do title = File.read(filename).split("\n",2).first slug = filename.sub(/^public\//,'').sub(/\.md$/,'') markdown += " * [`#{slug}`](./#{slug}.html) — #{title}\n" end @content = RDiscount.new(markdown).to_html template = 'template.erb' erb = ERB.new(File.read(template)); erb.filename = template erb.run()