summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-10-13 14:16:13 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-10-13 14:16:13 -0400
commit02c7decdb222f3edf6c054266813441b5b5cd531 (patch)
tree87d51b58f62ed41209f2fad8c5ed336bc3d38e35
parent8aa76ebdabbe6d65d1d520948b3e4ad598f46003 (diff)
index: generate the page as markdown
-rwxr-xr-xindex.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/index.rb b/index.rb
index 60aa54b..f3ef5b0 100755
--- a/index.rb
+++ b/index.rb
@@ -1,5 +1,6 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
+require 'rdiscount'
require 'erb'
@title = "Web log entries"
@@ -8,13 +9,13 @@ license = "CC BY-SA-3.0"
license_url = 'https://creativecommons.org/licenses/by-sa/3.0/'
@license="<a href=\"#{license_url}\">#{license}</a>"
-@content = "<h1>#{@title}</h1>\n<ul>\n"
+markdown = "# #{@title}\n\n"
for filename in ARGV do
title = File.read(filename).split("\n",2).first
slug = filename.sub(/^public\//,'').sub(/\.md$/,'')
- @content += "<li><tt><a href='./#{slug}.html'>#{slug}</a></tt> — #{title}</a></li>\n"
+ markdown += " * [`#{slug}`](./#{slug}.html) — #{title}\n"
end
-@content += "</ul>\n"
+@content = RDiscount.new(markdown).to_html
template = 'template.erb'
erb = ERB.new(File.read(template));