Hi!
After playing with the script a bit, it occurred to me that it is
limited to a single occurrence of a particular section/slice/part. But
suppose you had several of them, sequentially numbered, like: Slice1,
Slice2, Slice3... Could it be possible that when a random article
containing the keyword (in this example Slice) is selected, that the
script would count the number of appearances of that keyword and then
select a random one?

I tried adding the following:
Instead of v=store.getTiddlerText(tids[t].title+'##Summary')

I added three more lines and modified the original line:
var txt=store.getTiddlerText(tids[t].title);
var s = txt.match('Summary').length;
j=Math.floor(Math.random()*s);
v=store.getTiddlerText(tids[t].title+'##Summary'+j);

It didn't quite work. Any ideas?
w

On Feb 20, 8:06 pm, whatever <[email protected]> wrote:
> Hi!
> 1. Inline parts come in hand especially in cases like mine, when I can
> simply insert the part in the middle of the text. It does not corrupt
> the flow of the text and I can reference that part, like in my Did You
> Know feature. Also, when you have multilined text and you need to use
> it in a table. You put the text in a hidden part and then transclude
> it in a table cell. Parts don't need to be hidden, by the way.
>
> 2. In your script there is this line
> v=store.getTiddlerText(tids[t].title+'##Summary');
> which I've changed into
> v=store.getTiddlerText(tids[t].title+'/1');
>
> It works fine.
>
> 3. And after checking the new version, I noticed that that is in your
> new script as well, beside some other minor changes. I also noticed
> that random numbers appear to be unique this time.
>
> 4. That, I'm afraid, way over my head. :)
>
> w
>
> On Feb 20, 7:09 pm, Tobias Beer <[email protected]> wrote:
>
> > Hi w,
>
> > 1) In what circumstance would you benefit from or even depend on
> > "inline parts"?
>
> > 2) Unless you have some extension to PartTiddlerPlugin that I am
> > missing, the following does not (!) yield the desired output:
>
> > store.getTiddlerText('SomeTiddler/SomePart')
>
> > Instead you have to do something like this:
>
> > t=store.fetchTiddler('SomeTiddler/SomePart');
> > t=t?t.text:'';
>
> > 3) I have added this and fixed the bug from the macro in the "single
> > purpose script" and posted an update here:
>
> >http://pastebin.com/z4rXNBv3
>
> > 4) As for the combination of DcTableOfContentsPlugin or
> > SectionLinksPlugin and hidden sections ...it seems to me their
> > behaviour is faulty while the core probably doesn't provide adequate
> > utility functions.
>
> > Cheers, Tobias.

-- 
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