diff --git a/unpack-whenwe-json.js b/unpack-whenwe-json.js index 7992ea1..b1a54ab 100644 --- a/unpack-whenwe-json.js +++ b/unpack-whenwe-json.js @@ -1,3 +1,7 @@ +/* + Reads in the Drupal node dump of WhenWe data from ./whenwe.json + Writes it converted to markdown with frontmatter, organised in subdirectories, in out/ +*/ const data = require('./whenwe.json'); const fs = require('fs'); const path = require('path'); @@ -8,7 +12,7 @@ const nhm = new NodeHtmlMarkdown({ }); function toYaml(data, body) { - const frontmatter = Object.keys(data).sort().map(key => key+': '+(data[key] ? '"'+data[key]+'"' : '')).join("\n"); + const frontmatter = Object.keys(data).sort().map(key => key+': '+(data[key] ? JSON.stringify(data[key]) : '')).join("\n"); return "---\n" + frontmatter + "\n---\n" + nhm.translate(body); }