summaryrefslogtreecommitdiff
path: root/index.rb
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-11-24 04:40:17 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-11-24 04:40:17 -0500
commitc46222fd2c1e02f695b544576f8605676be4d502 (patch)
tree29893a84cbc8d06c138306ddad63eecabda0d50c /index.rb
parentfee8f8267106650d24b5047ee7e0abfa905f5760 (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-xindex.rb20
1 files changed, 5 insertions, 15 deletions
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="<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