added print generator

This commit is contained in:
Sanj 2012-01-27 22:01:00 +05:30
parent 302e0490a8
commit 616fb90745
3 changed files with 73 additions and 0 deletions

28
print/css/print.css Normal file
View File

@ -0,0 +1,28 @@
body {
font-family: "Courier New";
font-size: 14px;
}
.sub {
margin-top: 6px;
margin-bottom: 6px;
}
.inpoint {
font-style: italic;
font-size: 12px;
}
.title {
font-size: 18px;
margin: 0;
margin-bottom: 4px;
}
.datetime {
font-weight: bold;
}
.fileWrapper {
margin-bottom: 16px;
}

16
print/make_html.py Normal file
View File

@ -0,0 +1,16 @@
from jinja2 import Template
from os.path import join
import json
import codecs
def do():
data = json.load(open("chronoPrint.json"))
i = 1
for d in data:
d['serial'] = i
i += 1
t = Template(open("template.html").read())
s = t.render({'files': data})
out = codecs.open("out.html", "w", encoding="utf-8")
out.write(s)
out.close()

29
print/template.html Normal file
View File

@ -0,0 +1,29 @@
<!doctype html>
<head>
<link rel="stylesheet" href="css/print.css" type="text/css" />
</head>
<body>
{% for f in files %}
<div class="fileWrapper">
<h3 class="title"><span class="counter">{{ f.serial }}. </span>{{ f.title }}</h3>
<div class="datetime">
<span class="date">{{ f.date }}</span>
<span class="time">{{ f.time }}</span>
</div>
<div class="subs">
{% for s in f.subs %}
<div class="sub">
<div class="inpoint">{{ s.in }}</div>
<div class="subText">{{ s.text }}</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</body>
</html>