2015-10-14 18:25:11 +00:00
|
|
|
/*\
|
|
|
|
title: $:/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: slicer
|
|
|
|
|
2015-10-24 10:01:43 +00:00
|
|
|
Handle slicing definition nodes in definition lists
|
2015-10-14 18:25:11 +00:00
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
2015-10-24 10:01:43 +00:00
|
|
|
exports.processDefinitionNode = function(domNode,tagName) {
|
2015-10-14 18:25:11 +00:00
|
|
|
var text = $tw.utils.htmlEncode(domNode.textContent);
|
|
|
|
if(domNode.nodeType === 1 && tagName === "dd") {
|
|
|
|
// if(!this.isBlank(text)) {
|
|
|
|
var title = this.makeUniqueTitle("definition",text),
|
|
|
|
parentTitle = this.parentStack[this.parentStack.length - 1].title,
|
|
|
|
tags = [];
|
2016-02-01 21:22:55 +00:00
|
|
|
if(domNode.className && domNode.className.trim() !== "") {
|
2015-10-14 18:25:11 +00:00
|
|
|
tags = tags.concat(domNode.className.split(" "));
|
|
|
|
}
|
|
|
|
this.addToList(parentTitle,title);
|
|
|
|
this.addTiddler({
|
|
|
|
"toc-type": "definition",
|
|
|
|
title: title,
|
|
|
|
text: "",
|
|
|
|
list: [],
|
|
|
|
tags: tags
|
|
|
|
});
|
|
|
|
this.currentTiddler = title;
|
|
|
|
this.containerStack.push(title);
|
|
|
|
// this.containerStack.push("Just testing" + new Date());
|
|
|
|
this.processNodeList(domNode.childNodes);
|
|
|
|
this.containerStack.pop();
|
|
|
|
return true;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|