Permalink
Browse files

added permalinks

  • Loading branch information...
potch committed Feb 21, 2012
1 parent d99acb1 commit 8c70bd1367e890226b78965851c19269d13a8d34
Showing with 26 additions and 31 deletions.
  1. +6 −2 qdblog/renderer.py
  2. +20 −29 rendered/index.html
View
@@ -39,15 +39,19 @@ def write_post(file, content):
def render_index(num_posts=5):
path = './posts'
posts = []
+ posts_dict = []
for file in os.listdir(path):
post = pq(read_post(file))
date = post('.meta .posted').text()
posts.append((file, date))
print posts
posts = sorted(posts, cmp=lambda a, b: cmp(b[1], a[1]))[:10]
- posts = [{'html': read_post(post)} for post, ctime in posts]
+ for post, ctime in posts:
+ doc = pq(read_post(post))
+ doc('.meta').append(' <a href="/blog/%s">#</a>' % (post))
+ posts_dict.append({ 'html': doc.outerHtml() })
template = env.get_template('index.html')
- output = unicode(template.render({ 'posts': posts }))
+ output = unicode(template.render({ 'posts': posts_dict }))
write_post('index.html', output)
View
@@ -17,12 +17,11 @@ <h1>potch.me</h1>
</header>
- <article>
- <h1>One More Time, With Feeling</h1>
+ <article><h1>One More Time, With Feeling</h1>
<p>I'm Back!
- <p>Maybe.
- <p>Probably.
- <p>
+ </p><p>Maybe.
+ </p><p>Probably.
+ </p><p>
Honestly, "back" implies that I ever really
took a crack at this blogging thing with any seriousness at all before,
which is dubious. But I am going to, yet again, try to make a serious
@@ -32,8 +31,7 @@ <h1>One More Time, With Feeling</h1>
The <a href="http://potch.me/">ol' ball and chain</a>'s been pretty
busted the past few days. Why? As with anyone who wants to get back into
the habit of writing, you must first re-build your blogging system from
- the ground-up. Obviously. <a
- href="http://github.com/potch/potch.me/">This time</a>, of course, will
+ the ground-up. Obviously. <a href="http://github.com/potch/potch.me/">This time</a>, of course, will
be different. Armed
with my current favorite crop of technologies (which I will detail
below), I'm writing a set of tools let me build static pages (or, in my
@@ -53,29 +51,25 @@ <h2>(I start nerding out right about here.)</h2>
</p>
<p>
To aid me in this process, I've called in support from some technologies
- I've fallen in love with in the line of duty working on my <a
- href="http://github.com/mozilla/zamboni/">current project</a> at Mozilla:
+ I've fallen in love with in the line of duty working on my <a href="http://github.com/mozilla/zamboni/">current project</a> at Mozilla:
</p>
- <ul>
- <li>
+ <ul><li>
<b>Python</b>: While I'd love to do this whole project in node.js, The
package and file-interaction capabilities are just better in Python
right now. I may migrate later, but getting up to speed quickly was my
initial goal, and Python's got my back.
- <li>
+ </li><li>
<b>Jinja</b>: We replace Django's templating engine in our projects at
Mozilla with <a href="http://jinja.pocoo.org/">Jinja</a>. The "block"
pattern and template inheritance change the way you build markup
template to more closely match the object oriented way you (hopefully)
program. Fantastic stuff.
- <li>
+ </li><li>
<b>PyQuery</b>: jQuery-style DOM manipulation in Python. Yes please.
- <li>
- <b>LESS</b>: Once you try <a href="http://lesscss.org/">LESS</a> or <a
- href="http://sass-lang.com/">Sass</a>, you'll wonder how you ever wrote
+ </li><li>
+ <b>LESS</b>: Once you try <a href="http://lesscss.org/">LESS</a> or <a href="http://sass-lang.com/">Sass</a>, you'll wonder how you ever wrote
or maintained CSS before.
- </ul>
- <p>
+ </li></ul><p>
I've got the code to the point where I decided to write this post, including a local server that watches files for changes. I'll be adding features and such (and writing about them here!), but this is my "Hello World".
</p>
<h2>Hello, World!</h2>
@@ -84,41 +78,38 @@ <h2>Hello, World!</h2>
<p class="meta">
posted <span class="posted">2012-02-20</span>
- </p>
+ <a href="/blog/one-more-time-with-feeling.html">#</a></p>
</article>
<article>
<h1>He</h1>
<p>
- <img src="http://people.mozilla.org/~mclaypotch/he.jpg" alt="Gary Kovacs, CEO of Mozilla, in his traditional launch day headdress" />
+ <img src="http://people.mozilla.org/~mclaypotch/he.jpg" alt="Gary Kovacs, CEO of Mozilla, in his traditional launch day headdress">
</p>
<h2>is <em>actually</em> the CEO of <del>Firefox</del> Mozilla.</h2>
<p>
(<a href="http://verydemotivational.memebase.com/2011/02/25/demotivational-posters-he/">see the original</a>)
</p>
- <p class="meta">posted on <span class="posted">2011-04-01</span></p>
+ <p class="meta">posted on <span class="posted">2011-04-01</span> <a href="/blog/he.html">#</a></p>
</article>
- <article>
- <h1>Dumbo.</h1>
+ <article><h1>Dumbo.</h1>
<p>
<a href="http://www.flickr.com/photos/thepotch/5066659663/">
- <img alt="" src="http://farm5.static.flickr.com/4090/5066659663_0f2fb51cf5.jpg">
- </a>
+ <img alt="" src="http://farm5.static.flickr.com/4090/5066659663_0f2fb51cf5.jpg"></a>
</p>
<p class="meta">
posted on <span class="posted">2010-10-10</span>
- </p>
+ <a href="/blog/dumbo.html">#</a></p>
</article>
<article>
<h1>Cheap Eats- Tomato Sauce!</h1>
<p>
- When I'm not embarking on various food adventures with my <a
- href="http://twoguysonekitchen.com/" title="Two Guys, One Kitchen">
+ When I'm not embarking on various food adventures with my <a href="http://twoguysonekitchen.com/" title="Two Guys, One Kitchen">
culinary partners in crime</a>, I'm a fairly frugal at-home
cook. One of my favorite things to make is my own tomato sauce. It's easy
to make a bunch at once, it's turbo-versatile, and it freezes well.
@@ -178,7 +169,7 @@ <h1>Cheap Eats- Tomato Sauce!</h1>
<p class="meta">
posted <span class="posted">2010-04-17</span>
- </p>
+ <a href="/blog/cheap-eats-pasta-sauce.html">#</a></p>
</article>

0 comments on commit 8c70bd1

Please sign in to comment.