mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-29 14:06:48 +00:00
Text-slicer: Add support for definition lists
This commit is contained in:
44
plugins/tiddlywiki/text-slicer/modules/slicers/term.js
Normal file
44
plugins/tiddlywiki/text-slicer/modules/slicers/term.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/text-slicer/modules/slicers/term.js
|
||||
type: application/javascript
|
||||
module-type: slicer
|
||||
|
||||
Handle slicing definition list term nodes
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.processTermItemNode = function(domNode,tagName) {
|
||||
var text = $tw.utils.htmlEncode(domNode.textContent);
|
||||
if(domNode.nodeType === 1 && tagName === "dt") {
|
||||
// if(!this.isBlank(text)) {
|
||||
var title = this.makeUniqueTitle("term",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": "term",
|
||||
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;
|
||||
};
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user