Permalink
Browse files

Merge pull request #27 from huxuan/body_replace

Add Body Replace Feature
  • Loading branch information...
2 parents dd1ac95 + 631ff1c commit dcbbe7912c0dd21b0c58949b55351e6ce82a9536 @thomasf committed Jul 16, 2012
Showing with 9 additions and 0 deletions.
  1. +6 −0 config.yaml
  2. +3 −0 exitwp.py
View
@@ -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
@@ -33,6 +33,7 @@
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']
class ns_tracker_tree_builder(XMLTreeBuilder):
@@ -105,6 +106,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 dcbbe79

Please sign in to comment.