Trim everything

This commit is contained in:
Will Boyd
2019-12-18 16:36:43 -05:00
parent e0f7764554
commit b3bd05211e
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -8,8 +8,10 @@ const translator = require('./translator');
async function parseFilePromise(config) {
const content = fs.readFileSync(config.input, 'utf8');
const processors = { tagNameProcessors: [xml2js.processors.stripPrefix] };
const data = await xml2js.parseStringPromise(content, processors);
const data = await xml2js.parseStringPromise(content, {
trim: true,
tagNameProcessors: [xml2js.processors.stripPrefix]
});
let images = collectImages(data, config);
let posts = collectPosts(data);
@@ -106,7 +108,7 @@ function getPostSlug(post) {
}
function getPostTitle(post) {
return post.title[0].trim().replace(/"/g, '\\"');
return post.title[0].replace(/"/g, '\\"');
}
function getPostDate(post) {
+1 -1
View File
@@ -56,7 +56,7 @@ function initTurndownService() {
}
function getPostContent(post, turndownService, config) {
let content = post.encoded[0].trim();
let content = post.encoded[0];
// insert an empty div element between double line breaks
// this nifty trick causes turndown to keep adjacent paragraphs separated