1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Add evernote's additional resources as tiddlers

Relates to Issue #2268

Based in the [example XML][1] attachments are listed in the <resources>
node. Since in TiddlyWiki these would be media tiddlers I add then one
by one as separate tiddlers.

There are some things that still need to happen. There should be a mime
type check so we don't attempt to import media tha TiddlyWiki doesn't
support. Also the example suggests the data is base64 encoded so I
blindly use that for the text attribute. Should there be a
`data:mediatyp;base64,…` prefix?

[1]: https://gist.github.com/evernotegists/6116886
This commit is contained in:
Devin Weaver 2016-02-04 18:37:45 -05:00
parent 1d35087f29
commit 4b70257aca

View File

@ -43,6 +43,15 @@ exports["application/enex+xml"] = function(text,fields) {
result[attrNode.tagName] = attrNode.textContent;
});
results.push(result);
$tw.utils.each(noteNode.querySelectorAll("resources"),function(resourceNode) {
results.push({
title: resourceNode.querySelector("resource-attributes>file-name").textContent,
type: resourceNode.querySelector("mime").textContent,
width: resourceNode.querySelector("width").textContent,
height: resourceNode.querySelector("height").textContent,
text: resourceNode.querySelector("data").textContent
});
});
});
// Return the output tiddlers
return results;