Hey,

you could try it with a "substring" macro like this:

/*\
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);
    }

};
})();

tag: $:/tag/Macro
type: application/javascript
module-type: macro


Usage: (even with a Filter)
<$list filter="[!is[system]!is[shadow]tag[yourTag]]">

<$link to=<<currentTiddler>>><<substr "0" "5">></$link>


Regards,
The Bo

Am Freitag, 17. März 2017 22:13:00 UTC+1 schrieb stevesuny:
>
>  Hi, 
>
> this topic seems to have come up before, but without a clear answer.
>
> How do I define a substring with  the first x characters of a tiddler name?
>
> If I have $tiddler$ named "01 01 Long name of tiddler" (those are spaces) 
> I'd like to be extract "01 01" to <<short-name>> so I can write <$link 
> to="$tiddler$><<short-name>></$link> to display "01 01" as a link.
>
> Thanks!
>
> (It seems I could play with prefix, but I kind of messed up with my 
> tiddler names by having two spaces, so I can't make a prefix of the first 
> five characters...)
>
> //steve.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ea8915ed-aae4-4bca-92ec-b0ab23ed2fdf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to