@sukima the main issue with the previous code was that it incorrectly
used comma to delimit tags. We actually use spaces, and double square
brackets to delimit tags containing spaces. Better is to leave the tags
field as an array; the core will serialise it correctly as required.
I also made some minor consistency tweaks.
As seen in the first pass of #2247, it was previously inadvertently
possible for callers to modify the tiddler object itself by adding and
replacing properties.
Relates to Issue #2268
I tried to map over the list of tags but NodeLists are not arrays and so
need to be converted. This looks ugly and probably should be abstracted
to a function. Come to think of it should we have a `$tw.utils.map()`
function?
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
Integrating this module allows us to do HTML/XML parsing under Node.js
(there is no built-in support for Node.js; we can already do HTML/XML
parsing in the browser). The implementation chosen is pure JavaScript,
and will work in all configurations of TiddlyWiki.
Fixes#2227
(Note I fixed this by editing the filename in the github.com online editor. It's happened before; I've raised #2261 to address the root cause)
Having the ability to write your plugins with ES2015 syntax is nice but
it is missing a large part of the ES2015 spec. Since not all browsers
support this a polyfill is offered.
So far it is IE10 which holds the need for the polyfill. This tiddler
offers a simple how to on adding the babel-polyfill to your TiddlyWiki.
NOTE: This how to would be obsolete if a proper ES2015 polyfill was part
of the official plugins offered in core. (Want a pull request?)