diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-11-24 04:40:17 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-11-24 04:40:17 -0500 |
commit | c46222fd2c1e02f695b544576f8605676be4d502 (patch) | |
tree | 29893a84cbc8d06c138306ddad63eecabda0d50c /index.rb | |
parent | fee8f8267106650d24b5047ee7e0abfa905f5760 (diff) |
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.
Diffstat (limited to 'index.rb')
-rwxr-xr-x | index.rb | 20 |
1 files changed, 5 insertions, 15 deletions
@@ -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="<a href=\"#{license_url}\">#{license}</a>" - -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 |