Permalink
Browse files

Add body_replace feature

  • Loading branch information...
1 parent dd1ac95 commit ef043179dcc50b9485b0bf72231a63ee082982f4 @huxuan huxuan committed Jul 16, 2012
Showing with 12 additions and 1 deletion.
  1. +6 −0 config.yaml
  2. +6 −1 exitwp.py
View
6 config.yaml
@@ -30,3 +30,9 @@ taxonomies:
# Rename taxonomies when writing jekyll output format.
name_mapping: {category: categories, post_tag: tags}
+# Replace certain patterns in body
+# Simply replace the key with its value
+body_replace: {
+# '[python]': '{% codeblock lang:python%}',
+# '[/python]': '{% endcodeblock %}',
+}
View
7 exitwp.py
@@ -33,7 +33,10 @@
item_type_filter = set(config['item_type_filter'])
item_field_filter = config['item_field_filter']
date_fmt = config['date_format']
-
+body_replace = config['body_replace']
+for key in body_replace:
+ print key, body_replace[key]
+raw_input()
class ns_tracker_tree_builder(XMLTreeBuilder):
def __init__(self):
@@ -105,6 +108,8 @@ def gi(q, unicode_wrap=True):
return result
body = gi('content:encoded')
+ for key in body_replace:
+ body = body.replace(key, body_replace[key])
img_srcs = []
if body is not None:

0 comments on commit ef04317

Please sign in to comment.