1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-25 01:20:30 +00:00

Merge pull request #2275 from Marxsal/patch-9

ENEX import - Apply modified (updated) dates
This commit is contained in:
Jeremy Ruston 2016-02-16 16:24:45 +00:00
commit 7ea3ef7062

View File

@ -38,11 +38,19 @@ exports["application/enex+xml"] = function(text,fields) {
title: getTextContent(noteNode,"title"), title: getTextContent(noteNode,"title"),
type: "text/html", type: "text/html",
tags: [], tags: [],
text: getTextContent(noteNode,"content") text: getTextContent(noteNode,"content"),
modified: getTextContent(noteNode,"created").replace("T","").replace("Z",""),
created: getTextContent(noteNode,"created").replace("T","").replace("Z","")
}; };
$tw.utils.each(noteNode.querySelectorAll("tag"),function(tagNode) { $tw.utils.each(noteNode.querySelectorAll("tag"),function(tagNode) {
result.tags.push(tagNode.textContent); result.tags.push(tagNode.textContent);
}); });
// If there's an update date, set modifiy date accordingly
$tw.utils.each(noteNode.querySelectorAll("updated"),function(modifiedNode) {
result["modified"] = modifiedNode.textContent.replace("T","").replace("Z","") + "000" ;
});
$tw.utils.each(noteNode.querySelectorAll("note-attributes"),function(attrNode) { $tw.utils.each(noteNode.querySelectorAll("note-attributes"),function(attrNode) {
result[attrNode.tagName] = attrNode.textContent; result[attrNode.tagName] = attrNode.textContent;
}); });