Created
January 19, 2012 09:52
-
-
Save fallenhitokiri/1639113 to your computer and use it in GitHub Desktop.
write for zenbo // test gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import io | |
def write(site): | |
""" | |
write content to disc | |
<- site object | |
""" | |
io.clean(site.output) | |
io.copy(site.template, site.output) | |
for key in site.content: | |
for obj in site.content[key]: | |
obj.url = obj.url.replace(site.url, '') | |
if len(obj.url.split('/')) > 1: | |
path = "%s/%s" % (site.output, obj.url.rsplit('/', 1)[0]) | |
io.mkdir(path) | |
name = "%s/%s" % (site.output, obj.url) | |
io.write(name, obj.rendered) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment