diff --git a/tekuti/post.scm b/tekuti/post.scm index dd54f93..d280ac2 100644 --- a/tekuti/post.scm +++ b/tekuti/post.scm @@ -164,8 +164,8 @@ 5) key #t)))) -(define space-to-dash (s///g " " "-")) -(define remove-extraneous (s///g "[^a-z-]+" "")) +(define space-to-dash (s///g "[ .]" "-")) +(define remove-extraneous (s///g "[^a-z0-9-]+" "")) (define collapse (s///g "-+" "-")) (define (title->name title) diff --git a/wordpress-xmlrpc-to-dir.py b/wordpress-xmlrpc-to-dir.py index 46831f3..f7458c3 100644 --- a/wordpress-xmlrpc-to-dir.py +++ b/wordpress-xmlrpc-to-dir.py @@ -148,7 +148,7 @@ def get_post_images(post, url, imgdir): def write_post(post, categories, comments, images_url, new_images_url): print "writing post %s" % unescape(post["title"]) - def make_metadata(): + def make_metadata(key): out = "" keys = {"postid" : "id", "wp_author_display_name" : "author", @@ -163,6 +163,7 @@ def write_post(post, categories, comments, images_url, new_images_url): else: value = "closed" out += "%s: %s\n" % (keys[k], value) + out += "name: %s\n" % key out += "tags: %s\n" % ", ".join(categories) out += "timestamp: %s\n" % int(time.mktime(post["dateCreated"].timetuple())) 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 = analyze_media(content) write_file(d + "content", content) - write_file(d + "metadata", make_metadata()) + write_file(d + "metadata", make_metadata(key)) if comments: c = make_dir(d + "comments") for comment in comments: