diff options
author | 2011-01-14 10:25:47 +0100 | |
---|---|---|
committer | 2011-02-18 23:36:10 +0100 | |
commit | 800e7d9a05bb33d711ce3c39e83886ec548209c9 (patch) | |
tree | 0c248ef299040b3cd6918ad250f0c3a2e7cfcd59 | |
parent | fce14fbddf1fd20c3cba56171fd52b6465e44441 (diff) | |
download | tekuti-800e7d9a05bb33d711ce3c39e83886ec548209c9.tar.gz tekuti-800e7d9a05bb33d711ce3c39e83886ec548209c9.zip |
do not remove numbers and s/./-/ in post keys
-rw-r--r-- | tekuti/post.scm | 4 | ||||
-rw-r--r-- | wordpress-xmlrpc-to-dir.py | 5 |
2 files changed, 5 insertions, 4 deletions
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: |