Further tweaks to #2272

@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.
print-window-tiddler
Jermolene 2016-02-05 19:48:37 +00:00
rodzic 6aac2b00c9
commit 5b925ed868
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -37,10 +37,13 @@ exports["application/enex+xml"] = function(text,fields) {
var result = {
title: noteNode.querySelector("title").textContent,
type: "text/html",
tags: Array.prototype.slice.call(noteNode.querySelectorAll("tag")).map(function(tag) { return tag.textContent; }).join(","),
tags: [],
text: noteNode.querySelector("content").textContent
};
$tw.utils.each(noteNode.querySelector("note-attributes").childNodes,function(attrNode) {
$tw.utils.each(noteNode.querySelectorAll("tag"),function(tagNode) {
result.tags.push(tagNode.textContent);
});
$tw.utils.each(noteNode.querySelectorAll("note-attributes"),function(attrNode) {
result[attrNode.tagName] = attrNode.textContent;
});
results.push(result);