summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoreliseo papa <elipapa@alum.mit.edu> 2012-10-26 14:53:24 +0100
committereliseo papa <elipapa@alum.mit.edu> 2012-10-26 14:53:24 +0100
commit4f9ff8fe47b346a8886ba098b8cd0d81237fb9a8 (patch)
treecf1e6bef180818f360e722c232bb16db053fcdf6
parent81d94cb0991b70c9a8ce6ff2815b747f6842f25c (diff)
using rake+jekyll instead of a stupid script
-rw-r--r--Rakefile9
-rwxr-xr-xmd2pdf.py49
2 files changed, 9 insertions, 49 deletions
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..dc1ce9e
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,9 @@
+task :pdf => "_site/index.html" do
+ sh "wkhtmltopdf _site/index.html cv_eliseo_papa.pdf"
+end
+
+file "_site/index.html" do
+ sh "jekyll"
+end
+
+task :default => ["html"] \ No newline at end of file
diff --git a/md2pdf.py b/md2pdf.py
deleted file mode 100755
index 1e31e1f..0000000
--- a/md2pdf.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
-md2pdf
-converts markdown file to PDF using a given CSS style sheet
-
-usage:
-Outputs a PDF file, using the given CSS style sheet
-> md2pdf input.md --css input.css
-"""
-
-import markdown
-import codecs
-from subprocess import call
-
-import argparse
-parser = argparse.ArgumentParser(description='converts markdown file to PDF using a given CSS style sheet')
-
-parser.add_argument('mdsource')
-parser.add_argument('--css', dest="css")
-
-args = parser.parse_args()
-filename = args.mdsource.split('.')[0]
-
-
-if args.css:
- head = """<!doctype html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link href="%s" type="text/css" rel="stylesheet">
-</head>
-""" % args.css
-else:
- head = """<!doctype html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-</head>
-"""
-
-# convert the markdown file to html
-mdsourcef = codecs.open(args.mdsource, mode="r", encoding="utf8")
-body = markdown.markdown(mdsourcef.read(),['def_list'])
-html = ''.join([head, body])
-
-output_file = codecs.open("%s.html" % filename, "w", encoding="utf8")
-output_file.write(html)
-print ">>> first writing out %s.html" % filename
-print ">>> calling wkthmltopdf"
-call(["wkhtmltopdf", "%s.html" % filename, "%s.pdf" % filename])