|
|
|
@ -30,7 +30,11 @@ const nodeChildrenToString = (nodeChildren) => { |
|
|
|
|
string += nodeChildren[i].toString(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return string; |
|
|
|
|
|
|
|
|
|
// Replace <tt> with <code>
|
|
|
|
|
return string |
|
|
|
|
.replaceAll('<tt>', '<code>') |
|
|
|
|
.replaceAll('</tt>', '</code>') |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const parseXML = (XML) => { |
|
|
|
@ -45,13 +49,13 @@ const parseXML = (XML) => { |
|
|
|
|
const contentNodes = newsItem.childNodes(); |
|
|
|
|
const content = converterShowdown.makeMarkdown( |
|
|
|
|
nodeChildrenToString(contentNodes) |
|
|
|
|
); |
|
|
|
|
).trim(); |
|
|
|
|
|
|
|
|
|
const md = `---
|
|
|
|
|
author: "${author.replace(/"/g, '\\"')}" |
|
|
|
|
date: "${date.replace(/"/g, '\\"')}" |
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
${content}`;
|
|
|
|
|
const mdTitle = `${date}-${author}`; |
|
|
|
|
fs.mkdirSync( |
|
|
|
|