mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Text-slicer: copy document fields from source tiddler
User-defined fields of the source tiddler are copied across to the document tiddler when it is sliced.
This commit is contained in:
parent
f61bb316b2
commit
3a10bfe0de
@ -193,16 +193,26 @@ Slicer.prototype.processNode = function(domNode) {
|
||||
|
||||
// Slice a tiddler into individual tiddlers
|
||||
Slicer.prototype.sliceTiddler = function(title) {
|
||||
this.sliceTitle = "Sliced up " + title;
|
||||
var sourceTiddler = $tw.wiki.getTiddler(this.sourceTitle),
|
||||
sliceTitle,sliceTiddler = {};
|
||||
if(sourceTiddler) {
|
||||
sliceTiddler = $tw.utils.extend({},sourceTiddler.fields);
|
||||
}
|
||||
if(sliceTiddler["doc-santovia-id"]) {
|
||||
sliceTiddler.title = sliceTiddler["doc-santovia-id"];
|
||||
delete sliceTiddler["doc-santovia-id"];
|
||||
} else {
|
||||
sliceTiddler.title = "Sliced up " + title;
|
||||
}
|
||||
sliceTiddler.text = "Document sliced at " + (new Date());
|
||||
sliceTiddler.type = "text/vnd.tiddlywiki";
|
||||
sliceTiddler.tags = [];
|
||||
sliceTiddler.list = [];
|
||||
sliceTiddler["toc-type"] = "document";
|
||||
var domNode = this.getSourceDocument();
|
||||
this.parentStack.push({type: "h0", title: this.addTiddler({
|
||||
title: this.sliceTitle,
|
||||
text: "Document sliced at " + (new Date()),
|
||||
list: [],
|
||||
"toc-type": "document"
|
||||
})});
|
||||
this.parentStack.push({type: "h0", title: this.addTiddler(sliceTiddler)});
|
||||
this.currentTiddler = title;
|
||||
this.containerStack.push(this.sliceTitle);
|
||||
this.containerStack.push(sliceTiddler.title);
|
||||
this.processNodeList(domNode.childNodes);
|
||||
this.containerStack.pop();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user