First commit of Evernote migration plugin

Starts to address #2268
This commit is contained in:
Jermolene 2016-02-04 10:13:08 +00:00
parent 1335dff450
commit 8904a6dba6
6 changed files with 72 additions and 1 deletions

View File

@ -1835,6 +1835,7 @@ $tw.boot.startup = function(options) {
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
// Create the wiki store for the app
$tw.wiki = new $tw.Wiki();
// Install built in tiddler fields modules

View File

@ -4,7 +4,8 @@
"tiddlywiki/googleanalytics",
"tiddlywiki/nodewebkitsaver",
"tiddlywiki/browser-sniff",
"tiddlywiki/railroad"
"tiddlywiki/railroad",
"tiddlywiki/evernote"
],
"themes": [
"tiddlywiki/vanilla",

View File

@ -0,0 +1,4 @@
title: $:/plugins/tiddlywiki/evernote/docs
! Introduction

View File

@ -0,0 +1,47 @@
/*\
title: $:/plugins/tiddlywiki/evernote/modules/enex-deserializer.js
type: application/javascript
module-type: tiddlerdeserializer
ENEX file deserializer
For details see: https://blog.evernote.com/tech/2013/08/08/evernote-export-format-enex/
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
// DOMParser = require("$:/plugins/tiddlywiki/xmldom/dom-parser").DOMParser;
/*
Parse an ENEX file into tiddlers
*/
exports["application/enex+xml"] = function(text,fields) {
// Collect output tiddlers in an array
var results = [];
// Parse the XML document
var parser = new DOMParser(),
doc = parser.parseFromString(text,"application/xml");
// Output a report tiddler with information about the import
var enex = doc.querySelector("en-export");
results.push({
title: "Evernote Import Report",
text: "Evernote file imported on " + enex.getAttribute("export-date") + " from " + enex.getAttribute("application") + " (" + enex.getAttribute("version") + ")"
})
// Get all the "note" nodes
var noteNodes = doc.querySelectorAll("note");
$tw.utils.each(noteNodes,function(noteNode) {
results.push({
title: noteNode.querySelector("title").textContent,
type: "text/html",
text: noteNode.querySelector("content").textContent
});
});
// Return the output tiddlers
return results;
};
})();

View File

@ -0,0 +1,7 @@
{
"title": "$:/plugins/tiddlywiki/evernote",
"description": "Evernote migration tools",
"author": "JeremyRuston",
"core-version": ">=5.0.0",
"list": "readme docs"
}

View File

@ -0,0 +1,11 @@
title: $:/plugins/tiddlywiki/evernote/readme
This plugin contains tool to assist migration of content from Evernote ENEX files.
!! Instructions
# Download or save your ENEX file from Evernote
# Rename the file to have an `.enex` extension
# Drag the file into the TiddlyWiki browser window
## Alternatively, click the "Import" button in the "Tools" sidebar tab
# Review and accept the converted tiddlers