2015-09-15 12:37:12 +00:00
|
|
|
/*\
|
|
|
|
title: $:/plugins/tiddlywiki/text-slicer/modules/slicers/item.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: slicer
|
|
|
|
|
2015-09-16 17:59:03 +00:00
|
|
|
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);
|
2015-09-17 07:41:21 +00:00
|
|
|
if(domNode.nodeType === 1 && tagName === "li") {
|
|
|
|
// if(!this.isBlank(text)) {
|
2015-09-15 12:37:12 +00:00
|
|
|
var title = this.makeUniqueTitle("list-item",text),
|
|
|
|
parentTitle = this.parentStack[this.parentStack.length - 1].title,
|
|
|
|
tags = [];
|
|
|
|
if(domNode.className.trim() !== "") {
|
|
|
|
tags = tags.concat(domNode.className.split(" "));
|
|
|
|
}
|
|
|
|
this.addToList(parentTitle,title);
|
|
|
|
this.addTiddler({
|
|
|
|
"toc-type": "item",
|
|
|
|
title: title,
|
2015-09-17 07:41:21 +00:00
|
|
|
text: "",
|
2015-09-15 12:37:12 +00:00
|
|
|
list: [],
|
|
|
|
tags: tags
|
|
|
|
});
|
2015-09-16 17:59:03 +00:00
|
|
|
this.currentTiddler = title;
|
2015-09-17 07:41:21 +00:00
|
|
|
this.containerStack.push(title);
|
|
|
|
// this.containerStack.push("Just testing" + new Date());
|
2015-09-16 17:59:03 +00:00
|
|
|
this.processNodeList(domNode.childNodes);
|
2015-09-17 07:41:21 +00:00
|
|
|
this.containerStack.pop();
|
2015-09-15 12:37:12 +00:00
|
|
|
return true;
|
2015-09-17 07:41:21 +00:00
|
|
|
// }
|
2015-09-15 12:37:12 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|