1
0
Fork 0

do not remove numbers and s/./-/ in post keys

This commit is contained in:
Aleix Conchillo Flaque 2011-01-14 10:25:47 +01:00 committed by Andy Wingo
parent fce14fbddf
commit 800e7d9a05
2 changed files with 5 additions and 4 deletions

View file

@ -164,8 +164,8 @@
5) 5)
key #t)))) key #t))))
(define space-to-dash (s///g " " "-")) (define space-to-dash (s///g "[ .]" "-"))
(define remove-extraneous (s///g "[^a-z-]+" "")) (define remove-extraneous (s///g "[^a-z0-9-]+" ""))
(define collapse (s///g "-+" "-")) (define collapse (s///g "-+" "-"))
(define (title->name title) (define (title->name title)

View file

@ -148,7 +148,7 @@ def get_post_images(post, url, imgdir):
def write_post(post, categories, comments, images_url, new_images_url): def write_post(post, categories, comments, images_url, new_images_url):
print "writing post %s" % unescape(post["title"]) print "writing post %s" % unescape(post["title"])
def make_metadata(): def make_metadata(key):
out = "" out = ""
keys = {"postid" : "id", keys = {"postid" : "id",
"wp_author_display_name" : "author", "wp_author_display_name" : "author",
@ -163,6 +163,7 @@ def write_post(post, categories, comments, images_url, new_images_url):
else: else:
value = "closed" value = "closed"
out += "%s: %s\n" % (keys[k], value) out += "%s: %s\n" % (keys[k], value)
out += "name: %s\n" % key
out += "tags: %s\n" % ", ".join(categories) out += "tags: %s\n" % ", ".join(categories)
out += "timestamp: %s\n" % int(time.mktime(post["dateCreated"].timetuple())) out += "timestamp: %s\n" % int(time.mktime(post["dateCreated"].timetuple()))
return unicode(out) return unicode(out)
@ -172,7 +173,7 @@ def write_post(post, categories, comments, images_url, new_images_url):
content = string.replace(post["description"], images_url, new_images_url) content = string.replace(post["description"], images_url, new_images_url)
content = analyze_media(content) content = analyze_media(content)
write_file(d + "content", content) write_file(d + "content", content)
write_file(d + "metadata", make_metadata()) write_file(d + "metadata", make_metadata(key))
if comments: if comments:
c = make_dir(d + "comments") c = make_dir(d + "comments")
for comment in comments: for comment in comments: