1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Extend ginsu.sh to generate a split.recipe file

This commit is contained in:
Jeremy Ruston 2013-08-03 15:03:07 +01:00
parent 0e78ecd3e0
commit 5994a84644
3 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,44 @@
/*\
title: $:/core/modules/widgets/view/viewers/urlencoded.js
type: application/javascript
module-type: fieldviewer
A viewer for viewing tiddler fields as url encoded text
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var UrlEncodedViewer = function(viewWidget,tiddler,field,value) {
this.viewWidget = viewWidget;
this.tiddler = tiddler;
this.field = field;
this.value = value;
};
UrlEncodedViewer.prototype.render = function() {
// Get the value as a string
if(this.field !== "text" && this.tiddler) {
this.value = this.tiddler.getFieldString(this.field);
}
var value = "";
if(this.value !== undefined && this.value !== null) {
value = this.value;
}
// Set the element details
this.viewWidget.tag = "span";
this.viewWidget.attributes = {
"class": "tw-view-urlencoded"
};
this.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer,[{
type: "text",
text: encodeURIComponent(value)
}]);
};
exports.urlencoded = UrlEncodedViewer;
})();

View File

@ -0,0 +1,5 @@
title: $:/core/templates/split-recipe
<$list filter="[!is[system]]">
tiddler: <$view field="title" format="urlencoded"/>.tid
</$list>

View File

@ -9,5 +9,6 @@ node ./tiddlywiki.js \
./editions/empty \
--verbose \
--load $1 \
--savetiddler $:/core/templates/split-recipe tmp/ginsu/split.recipe text/plain \
--savetiddlers [!is[system]] $:/core/templates/tid-tiddler tmp/ginsu text/plain .tid \
|| exit 1