1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-26 18:10:27 +00:00
TiddlyWiki5/plugins/tiddlywiki/text-slicer/modules/slicers/item.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-09-15 12:37:12 +00:00
/*\
title: $:/plugins/tiddlywiki/text-slicer/modules/slicers/item.js
type: application/javascript
module-type: slicer
Handle slicing list item nodes
2015-09-15 12:37:12 +00:00
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.processListItemNode = function(domNode,tagName) {
var text = $tw.utils.htmlEncode(domNode.textContent);
if(domNode.nodeType === 1 && tagName === "li") {
// if(!this.isBlank(text)) {
var title = this.makeUniqueTitle("list-item " + text),
2015-09-15 12:37:12 +00:00
parentTitle = this.parentStack[this.parentStack.length - 1].title,
tags = [];
if(domNode.className && domNode.className.trim() !== "") {
2015-09-15 12:37:12 +00:00
tags = tags.concat(domNode.className.split(" "));
}
this.addToList(parentTitle,title);
this.addTiddler({
"toc-type": "item",
title: title,
text: "",
2015-09-15 12:37:12 +00:00
list: [],
tags: tags
});
this.currentTiddler = title;
this.containerStack.push(title);
// this.containerStack.push("Just testing" + new Date());
this.processNodeList(domNode.childNodes);
this.containerStack.pop();
2015-09-15 12:37:12 +00:00
return true;
// }
2015-09-15 12:37:12 +00:00
}
return false;
};
})();