mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-30 03:56:53 +00:00
Text-slicer: Add support for definition lists
This commit is contained in:
40
plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js
Normal file
40
plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js
|
||||
type: application/javascript
|
||||
module-type: slicer
|
||||
|
||||
Handle slicing definition list nodes
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.processDefListNode = function(domNode,tagName) {
|
||||
if(domNode.nodeType === 1 && tagName === "dl") {
|
||||
var title = this.makeUniqueTitle("def-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": "def-list",
|
||||
"toc-list-filter": "[list<currentTiddler>!has[draft.of]]",
|
||||
text: "",
|
||||
title: title,
|
||||
list: [],
|
||||
tags: tags
|
||||
})});
|
||||
this.currentTiddler = title;
|
||||
this.processNodeList(domNode.childNodes);
|
||||
this.parentStack.pop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user