mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-09 03:19:56 +00:00
41 lines
971 B
JavaScript
41 lines
971 B
JavaScript
|
/*\
|
||
|
title: $:/plugins/tiddlywiki/text-slicer/modules/slicers/list.js
|
||
|
type: application/javascript
|
||
|
module-type: slicer
|
||
|
|
||
|
Handle slicing heading nodes
|
||
|
|
||
|
\*/
|
||
|
(function(){
|
||
|
|
||
|
/*jslint node: true, browser: true */
|
||
|
/*global $tw: false */
|
||
|
"use strict";
|
||
|
|
||
|
exports.processListNode = function(domNode,tagName) {
|
||
|
if(tagName === "ul" || tagName === "ol") {
|
||
|
var title = this.makeUniqueTitle("list-" + tagName),
|
||
|
parentTitle = this.parentStack[this.parentStack.length - 1].title,
|
||
|
tags = [];
|
||
|
if(domNode.className.trim() !== "") {
|
||
|
tags = tags.concat(domNode.className.split(" "));
|
||
|
}
|
||
|
this.addToList(parentTitle,title);
|
||
|
this.parentStack.push({type: tagName, title: this.addTiddler({
|
||
|
"toc-type": "list",
|
||
|
"toc-list-type": tagName,
|
||
|
"toc-list-filter": "[list<currentTiddler>!has[draft.of]]",
|
||
|
text: "",
|
||
|
title: title,
|
||
|
list: [],
|
||
|
tags: tags
|
||
|
})});
|
||
|
this.processNodeList(domNode.childNodes);
|
||
|
this.parentStack.pop();
|
||
|
return true;
|
||
|
}
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
})();
|