[tw] script request. . . (possibly in the macro realm)

9 views
Skip to first unread message

Mike

unread,
Apr 28, 2010, 11:35:23 PM4/28/10
to TiddlyWiki
I would like to have a script that can identify if any *list (<li>)
elements are present in a section, if not return *No Items, if so
return nothing. . .

!!!Section1
*list
*list
!!!Section1
*No Items
@@display:none
!!!End
@@
I am having a hard time figuring out how to identify if any *list
(<li>) items are present between sections

Thoughts or Guidance?

Mike

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To post to this group, send email to tiddl...@googlegroups.com.
To unsubscribe from this group, send email to tiddlywiki+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.

Anthony Muscio

unread,
Apr 29, 2010, 1:06:44 AM4/29/10
to tiddl...@googlegroups.com
A Thought !

Would the core code that deals with numbered lists;

#Item 1
#item 2

Already have some of this same behaviour already.

Eg;
!Sec1
#Item a
#item B
!Sec 2
#item c
#item d

Gives

Sec1

  1. Item a
  2. item B

Sec 2

  1. item c
  2. item d

So it must be counting and resetting each section !

Tony

TonyM

If you have not found an easy way to do it with TiddlyWiki, you have missed something.
www.tiddlywiki.com

Mike

unread,
Apr 29, 2010, 12:34:52 PM4/29/10
to TiddlyWiki
Is that handled by a formatter?

Mike

On Apr 29, 12:06 am, Anthony Muscio <anthony.mus...@gmail.com> wrote:
> A Thought !
>
> Would the core code that deals with numbered lists;
>
> #Item 1
> #item 2
>
> Already have some of this same behaviour already.
>
> Eg;
> !Sec1
> #Item a
> #item B
> !Sec 2
> #item c
> #item d
>
> Gives
> Sec1
>
>    1. Item a
>    2. item B
>
> Sec 2
>
>    1. item c
>    2. item d
> > tiddlywiki+...@googlegroups.com<tiddlywiki%2Bunsubscribe@googlegrou ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/tiddlywiki?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
> To post to this group, send email to tiddl...@googlegroups.com.
> To unsubscribe from this group, send email to tiddlywiki+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/tiddlywiki?hl=en.

PMario

unread,
Apr 29, 2010, 6:24:29 PM4/29/10
to TiddlyWiki
Hi,

If you read the content of the section a

var text ... should contain the text of the section.
In your case the else path would be of interest.

The following should be sensitive for
*list and
#list

match = text.match(/^[*|#]/im);
if (match != null) {
// matched text: match[0]
// match start: match.index
// capturing group n: match[n]
} else {
// Match attempt failed
}

How regexp works can be found at:
http://www.regular-expressions.info/reference.html

hope this helps
have fun
Mario

Anthony Muscio

unread,
Apr 30, 2010, 12:54:21 AM4/30/10
to tiddl...@googlegroups.com
Mike,

Personally I cant answer your question. Just let you know something I observed.

FYI Have you noticed your replys in this forum have "Re: " in the title ?

I have all tiddlywiki posts sent to me by mail. Having exactly the same subject keeps the thread of posts together. The inclusion of Re: in the subject creates a new thread.


TonyM

If you have not found an easy way to do it with TiddlyWiki, you have missed something.
www.tiddlywiki.com



Mike

unread,
Apr 30, 2010, 10:27:04 AM4/30/10
to TiddlyWiki
Mario,
Thanks for the feedback, might be a few days before I can wrap my head
around the code, gotta full plate at home this week :D

Tony,
I am using the default web interface, and just this week Jonathon
showed me how to change topics - so I am not changing the subject
manualy, I do monitor twgg via RSS, and as far as I can tell this is a
default behaviour. . .
If you want we can start a new thread and experiment, maybe I am doing
something out of the ordinary and do not realize it.

Mike

Mike

unread,
May 3, 2010, 9:01:49 PM5/3/10
to TiddlyWiki
Mario,
I think I am using the text variable wrong. . . (or I am not
understanding the usage)
also how do I limit the script to the desired section? (more than one
section in the tiddler)

<script show>
var text='!!!Section2';
match = text.match(/^[*|#]/im);
if (match != null) {
// matched text: match[0]
// match start: match.index
// capturing group n: match[n]
} else {

// Match attempt failed
return ('*No Items')

}
</script>

Missing something obvious. . .

Mike

PMario

unread,
May 4, 2010, 1:34:13 PM5/4/10
to TiddlyWiki
Hi Mike,

On May 4, 3:01 am, Mike <eris...@gmail.com> wrote:
> Mario,
> I think I am using the text variable wrong. . . (or I am not
> understanding the usage)
> also how do I limit the script to the desired section? (more than one
> section in the tiddler)
The function to use is:
store.getTiddlerText('TiddlerName##SectionName');
see TiddlyWiki.org for more: [1][2]

The problem with TW.org is, that there are not enough example
programs. (OT: please don't flame me. I know, that I have write access
there. But I have to say. I like TW wiki-syntax. But I hate the
one .org is using. end-OT) Thats why you have to look to other plugin
sources, and look how it is used there. That's the way. I also have a
lookt at insideTW [3] to get up to date info from the core. Because
there are links to the source repository.

I did set up a little "TeamWork" experiment at tiddlyHoster [4]. I
think, it is not effective, to test something on my lokal TW. Copy/
Paste it into the list, which most of the times does some unwanted
linebreaks. You copy it from the list to your lokal TW. Fix the
linebreaks and test again. ...

Hoster has the possibility to have protected and public bags. At
protected bags I can write something, that is usable and readable, but
only editable by me. Public can be edited by everyone, which is logged
in as a member.

Have a look at TeamWork [4]
*TeamPubMp is protected
*TempPub is public

I did some changes! look at link [4].

>
> Missing something obvious. . .
>
> Mike

============
If you could set up a protected hoster / bag with your project source
and your plugins. I think it could be fun. And may be some others
could jump in too ..

For editing public the TeamPub will be used automatically.

regards Mario
[1] http://tiddlywiki.org/wiki/Dev:Core_Code_Overview
[2] http://tiddlywiki.org/wiki/Dev:TiddlyWiki_Class
[3] http://www.tiddlytools.com/insideTW/
[4] http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#TestScript

PMario

unread,
May 5, 2010, 7:56:21 AM5/5/10
to TiddlyWiki
Hi,
Started a new thread about the TeamWork experiment at TiddlyWeb group:

http://groups.google.com/group/tiddlyweb/browse_thread/thread/d760543fb820a4dc?hl=en

-m

PMario

unread,
May 31, 2010, 4:53:22 PM5/31/10
to TiddlyWiki
Hi,
Sorry for posting this 3 times, but I didn't know a better way.

I made a [1] "Visual HowTo" (10 min) join the TeamWork TiddlyWiki, I
uploaded the screencast to youtube.

Watch the video!

The following text is only there to get some descriptions for the
links.
==============
The video coveres the following aspects of TiddlyWeb, and Hoster [2]

*Create a new Wiki [3]
**One private bag
**One public (protected) bag
*I can not be viewed directly, because one bag is private

*Include a bag from a different account [4]
**systemPublish

*Publish a private tiddler with PublishCommand plugin
**PublicText [5]

*Include the public (protected) bag into a public wiki
**TeamPubScpm [6]

Have Fun!
Mario

[1] http://www.youtube.com/watch?v=WzHRHLd7tyk
[2] http://hoster.peermore.com/
[3] http://hoster.peermore.com/screencast.myopenid.com
[4] http://hoster.peermore.com/pmario.myopenid.com
[5] http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#PublicText
[6] http://hoster.peermore.com/recipes/TeamWork/tiddlers

Tobias Beer

unread,
Jun 1, 2010, 9:03:08 AM6/1/10
to TiddlyWiki
Hi PMario,

this is really exciting stuff and a simple means of starting to play
with tiddlyweb based solutions ...without having to deal with all the
pythonic backend / installation / commandline twanaging.
Reply all
Reply to author
Forward
0 new messages