Skip to content

Commit 7f4d03c

Browse files
committed
Markdown'd whole tutorial.
1 parent 63692ee commit 7f4d03c

File tree

4 files changed

+1103
-297
lines changed

4 files changed

+1103
-297
lines changed

body.tmpl

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta http-equiv="content-type" content="text/html; charset=utf-8">
5+
<script src="http://yandex.st/highlightjs/6.0/highlight.min.js"></script>
6+
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.0/styles/github.min.css">
7+
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700|Droid+Serif:400,400italic|Inconsolata' rel='stylesheet'>
8+
<script>hljs.initHighlightingOnLoad();</script>
9+
<title>Gevent Tutorial</title>
10+
</head>
11+
<style>
12+
body {
13+
font: 13px/20px "Droid Sans",Arial,"Helvetica Neue","Lucida Grande",sans-serif;
14+
15+
color: #4C4C4C;
16+
background-color: #c9dbb2;
17+
margin-left: 0px;
18+
margin-top: 5px;
19+
}
20+
21+
.toc {
22+
left: 0px;
23+
top: 5px;
24+
position: fixed;
25+
float: left;
26+
width: 150px;
27+
28+
background-color: #FAFBFC;
29+
border: 1px solid #FAFBFC;
30+
31+
-webkit-border-top-right-radius: 10px;
32+
-webkit-border-bottom-right-radius: 10px;
33+
-moz-border-radius-topright: 10px;
34+
-moz-border-radius-bottomright: 10px;
35+
36+
border-top-right-radius: 10px;
37+
border-bottom-right-radius: 10px;
38+
39+
padding-left: 5px;
40+
height: 100%;
41+
}
42+
43+
.toc ul {
44+
margin: 0px;
45+
padding: 0px;
46+
list-style-type: none;
47+
}
48+
49+
.toc ul ul {
50+
font-size: 80%;
51+
padding-left: 5px;
52+
}
53+
54+
#content {
55+
max-width: 960px;
56+
margin-left: 160px;
57+
padding: 10px;
58+
border: 1px solid #FAFBFC;
59+
60+
background-color: #FAFBFC;
61+
62+
-webkit-border-radius: 10px;
63+
-moz-border-radius: 10px;
64+
border-radius: 10px;
65+
66+
-webkit-box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.5);
67+
-moz-box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.5);
68+
box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.5);
69+
}
70+
71+
a {
72+
color: inherit;
73+
}
74+
75+
pre {
76+
border: 1px solid #ccc;
77+
background-color: ghostWhite;
78+
font: 15px/19px Inconsolata,"Lucida Console",Terminal,"Courier New",Courier;
79+
80+
-webkit-border-radius: 10px;
81+
-moz-border-radius: 10px;
82+
border-radius: 10px;
83+
padding: 5px;
84+
}
85+
86+
p code {
87+
font-family: monospace;
88+
border-bottom: 1px dashed #ccc;
89+
90+
}
91+
92+
.label {
93+
display: block;
94+
margin-bottom: 0px;
95+
padding: 0px;
96+
font-family: sans;
97+
font-weight: bold;
98+
width: 200px;
99+
padding: 0.5em;
100+
}
101+
102+
.author {
103+
text-align: center;
104+
}
105+
106+
.email {
107+
text-align: center;
108+
font-size: 10pt;
109+
}
110+
111+
112+
h1 {
113+
text-align: center;
114+
padding-bottom: 5px;
115+
}
116+
117+
h2 {
118+
padding-bottom: 10px;
119+
}
120+
121+
.green {
122+
color: #7c9a5e;
123+
}
124+
</style>
125+
<body>
126+
<div id="content">
127+
128+
<header>
129+
<h1><span class="green">gevent</span> For the Working Python Developer</h1>
130+
<h3 class="author">
131+
<a href="http://www.stephendiehl.com">Stephen Diehl</a>
132+
</h3>
133+
</header>
134+
135+
<blockquote>
136+
gevent is a concurrency library based around libev. It provides a clean API for a variety of concurrency and network related tasks.
137+
</blockquote>
138+
139+
{{ body }}
140+
</div>
141+
</body>
142+
</html>

build

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python
2+
3+
import os
4+
import sys
5+
import codecs
6+
import markdown
7+
from jinja2 import Template
8+
9+
from jinja2 import Environment, FileSystemLoader
10+
11+
OUTPUT = 'index.html'
12+
13+
loader = FileSystemLoader(os.getcwd())
14+
env = Environment(loader=loader)
15+
16+
template = env.get_template('body.tmpl')
17+
18+
input_file = codecs.open("tutorial.md", mode="r", encoding="utf-8")
19+
text = input_file.read()
20+
body = markdown.markdown(text, extensions=['toc'])
21+
22+
with open(OUTPUT, 'w+') as f:
23+
f.write(template.render(body=body))
24+
print 'Wrote', OUTPUT

0 commit comments

Comments
 (0)