Skip to content

Instantly share code, notes, and snippets.

@drscream
Created December 13, 2013 23:25
Show Gist options
  • Select an option

  • Save drscream/7953358 to your computer and use it in GitHub Desktop.

Select an option

Save drscream/7953358 to your computer and use it in GitHub Desktop.
diff --git a/config.yaml b/config.yaml
index aa03275..7bc0e5b 100644
--- a/config.yaml
+++ b/config.yaml
@@ -5,7 +5,7 @@ wp_exports: wordpress-xml
build_dir: build
# Output format: primary choices are html or markdown.
-target_format: markdown
+target_format: html
# The date format of the wikipedia export file.
# I'm not sure if this ever differs depending on wordpress localization.
@@ -28,7 +28,7 @@ taxonomies:
# Filter taxonomies entries.
entry_filter: {category: Uncategorized}
# Rename taxonomies when writing jekyll output format.
- name_mapping: {category: categories, post_tag: tags}
+ name_mapping: {category: Categories, post_tag: Tags}
# Replace certain patterns in body
# Simply replace the key with its value
diff --git a/exitwp.py b/exitwp.py
index a09491f..df5d306 100755
--- a/exitwp.py
+++ b/exitwp.py
@@ -280,13 +280,13 @@ def write_jekyll(data, target_format):
sys.stdout.flush()
out = None
yaml_header = {
- 'title': i['title'],
- 'author': i['author'],
- 'date': datetime.strptime(
- i['date'], '%Y-%m-%d %H:%M:%S').replace(tzinfo=UTC()),
- 'slug': i['slug'],
- 'wordpress_id': int(i['wp_id']),
- 'comments': i['comments'],
+ 'Title': i['title'],
+ 'Author': i['author'],
+ 'Date': datetime.strptime(
+ i['date'], '%Y-%m-%d %H:%M:%S'), # .replace(tzinfo=UTC()),
+ 'Slug': i['slug'],
+ 'Wordpress_id': int(i['wp_id']),
+ 'Comments': i['comments'],
}
if i['status'] != u'publish':
yaml_header['published'] = False
@@ -295,7 +295,7 @@ def write_jekyll(data, target_format):
i['uid'] = get_item_uid(i, date_prefix=True)
fn = get_item_path(i, dir='_posts')
out = open_file(fn)
- yaml_header['layout'] = 'post'
+ yaml_header['Layout'] = 'post'
elif i['type'] == 'page':
i['uid'] = get_item_uid(i)
# Chase down parent path, if any
@@ -310,7 +310,7 @@ def write_jekyll(data, target_format):
break
fn = get_item_path(i, parentpath)
out = open_file(fn)
- yaml_header['layout'] = 'page'
+ yaml_header['Layout'] = 'page'
elif i['type'] in item_type_filter:
pass
else:
@@ -341,13 +341,19 @@ def write_jekyll(data, target_format):
continue
tax_out[t_name].append(tvalue)
- out.write('---\n')
+ tax_out_tmp = {}
+ for t in tax_out:
+ tax_out_tmp[t] = ",".join(tax_out[t])
+
+ tax_out = tax_out_tmp
+
+ #out.write('---\n')
if len(yaml_header) > 0:
out.write(toyaml(yaml_header))
if len(tax_out) > 0:
out.write(toyaml(tax_out))
- out.write('---\n\n')
+ out.write('\n\n')
try:
out.write(html2fmt(i['body'], target_format))
except:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment