Hi TwWizards

Sorry for the long title - however I hope it will make sense in a
minute ...

I've made myself an automated tiddlercreation button. Unfortunately it
creates a title with several rows thus not allowing me to make links
in fETtables without breaking them...
However I managed to implement a "firstline only"script into the table
I still am not able to make a link to the original tiddler.... see:
http://lektie.tiddlyspot.com/#dansk

If only I knew how to change the js to create tiddlertitles without
linebreaks - this would be solved.. otherwise I'll have to find
another way to make links in the fET...

This is the jsline which creates a title from 3 defined parameters:
var tid=prompt('New title will become:\n\n',tt_alias+who
+when.formatString('$1'));
(unfortunately they all seem to be one long word - but when the script
has finished it seems that each parameter (incl. formatstring params)
gets a linebreak of its own. I'd like to change that)

tt_alias is a field, who is username and tags is a list of proposed
tags- same list again:
var tags=prompt('Write tags here(make space between words) (lesson HAS
to be one of them):\n\n',tt_alias+who+lesson);
 (unfortunately all tags appears to be one long word - I'd like to
change that):

All of it is here: http://lektie.tiddlyspot.com/#NyLektieKnap
(Danish*)
Try the big button called "ny Lektie" and follow the promts - see
result - Then you'll see what i mean...

The script (translated into English): I know there must be some basic
errors - I am a total JS-Ignorant and this is my first real attempt to
make a prompted mishmash of fields and tags to get title and tags
streamlined... )

Here translated into English*:

[[NewLessonButton]]

<<tiddler {{'NewLessonButton##'+
('$1'=='$'+'1'||'$2'=='$'+'2'?'Apply':'Macro')}} with: [[$1]] [[$2]]>>
/%
!Apply
<<tiddler [[NewLessonButton##Macro]]>>
!end Apply
!Macro
<script label="$2" title="create new lesson">
        var tt_alias=prompt("subject (small letters only)","danish
math german english etc");
        if (!tt_alias || !tt_alias.length) return;
        var fields={ tt_alias: tt_alias };
        var who=config.options.txtUserName;
        var when=new Date();
        var tid=prompt('New lessontitle will be:\n\n',tt_alias+who
+when.formatString('$1'));
        if (!tid || !tid.length) return;
        var txt="<<formTiddler [[LessonTemplate]]>"+">";
        var lesson=['lesson'];
        if (!lesson) return;
        var title=[!tid];
        if (!title) return;
        var msg=config.messages.overwriteWarning.format([title]);
        if (store.tiddlerExists(title) && !confirm(msg)) return;
        var tags=prompt('Write tags here (make spaces) (lesson HAS to be one
of them):\n\n',tt_alias+who+lesson);
        if (!tags || !tags.length) return;
        store.saveTiddler(tid,tid,txt,who,when,tags,fields);
        story.displayTiddler(null,tid);
</script>
!end Macro
%/

All advice will be well recieved...

YS Måns Mårtensson
-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.


Reply via email to