From c46222fd2c1e02f695b544576f8605676be4d502 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 24 Nov 2013 04:40:17 -0500 Subject: Switch from rdiscount to Pandoc. But, I am still using ERB for the templating; I wrote my own Ruby Pandoc bindings because pandoc-ruby sucks; it has more code but does less. This was slightly painful, as I had to switch all of the articles from my hacked-on metadata format to Pandoc's format. --- index.rb | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'index.rb') diff --git a/index.rb b/index.rb index f3ef5b0..9511c28 100755 --- a/index.rb +++ b/index.rb @@ -1,23 +1,13 @@ #!/usr/bin/env ruby # -*- coding: utf-8 -*- -require 'rdiscount' +load 'pandoc.rb' 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" +markdown = "Web log entries\n=====\n\n" for filename in ARGV do - title = File.read(filename).split("\n",2).first + input = File.read(filename) + title = Pandoc::load('markdown',input)["title"] || input.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() +puts markdown -- cgit v1.2.3