/*\
title: $:/substring_from_to
type: application/javascript
module-type: macro
A macro to get certain characters from a string.
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "substr";
exports.params = [
{name: "from",default:"0"},
{name: "to", default:"0"}
];
/*
Run the macro
*/
exports.run = function(from, to) {
var tiddlertitle = this.getVariable("currentTiddler");
if (to !== "0") {
return tiddlertitle.substring(from,to);
} else {
return tiddlertitle.substring(from);
}
};
})();
<$list filter="[!is[system]!is[shadow]tag[yourTag]]">
<$link to=<<currentTiddler>>><<substr "0" "5">></$link>
title: $:/substring_from_to
type: application/javascript
module-type: macro
save and reload, to activate the macro.
-m