Recent Changes - Search:

PmWiki

pmwiki.org

edit SideBar

Tiddlywiki

Tiddlywiki is a small wiki that lives in a single file. It's a combination of the code that is needed and the pages. The entire thing runs in a browser. This makes it convenient to keep it on a USB stick and take it with you.

It can also be locally hosted on small system. There is also a free hosting site Tiddlyhost (signin) that can be used.

It was in the running for my replacement personal wiki. I had been running JSP Wiki, but the security on it diverged from what I wanted. I ended up using PM Wiki. It's written in PHP, and it's big claim is that each of the wiki pages are in single files. This made it easy to back things up. Mine is externally hosted.

In November I came across a series of videos by Charles J Veniot on how to imbed wwwBasic into Tiddlywiki. wwwBasic was a Google supported project. It is a Basic written in Javascript that can be included into any web page. The videos on how to do this are very short (about 5 mins each) to set things up.Setting up a TiddlyWiki as a BASIC programming platform (part 1/5)

I set this up and it's actually pretty cool. It's fun to be able to imbed basic in a page and then run it.

I wanted to expand it to

  1. Not need to have the language type in the name, I wanted to be able to use tag.
  2. Be able to add other languages like Python, Pascal, etc.

I tried to get it to fly but got tripped up by Tiddlywiki syntax. The following is the emails that went back and forth as he helped me.


Message 1

Hi, I followed your series on adding Basic to TW. I was able to do the same to add python to the wiki. I've hit a snag, I want to use tags, but I can't figure out how to get the Basic and Python tag out so they can add the run button. I need to change this to get the tag,

<$list filter="[<currentTiddler>regexp<basfilter>]">

Can you direct me to some documentation on how I get the tags from a tiddler?

The code is in the Run Button Code

\define basfilter() [.]BAS
<$list filter="[<currentTiddler>regexp<basfilter>]">
<$button>
<$action-sendmessage 
  $message="tm-open-window" 
  $param=<<currentTiddler>>
  template={{Run BASIC Program Window!!title}}
  windowTitle={{{ [RUN ]] [<currentTiddler>] +[join[]]}}}
  width="640"
  height="480"/>
RUN
</$button>
</$list>

Message 2 - from Charlie


To get the tags for a tiddler (using TiddlyWiki.com as example)...

[[Welcome]tags[]]  will give us all of the tags for the "Welcome" tiddler.

[[Welcome]] is the simplest filter possible.  That is saying "give me the value Welcome", and whatever that is running that filter will treat it like a tiddler title.

Ways to run that filter include putting it in curly brackets:

{{{ [[Welcome]]] }}}

That is fine for just getting one value.

When dealing with possibly multiple values being returned by a filter, we would use a "list" widget.

<$list filter="[[Welcome]]">
<<currentTiddler>>
</$list>

<<currentTiddler>> is a reference to a variable.  Within the list tags, (it is like a "for..next" loop), the stuff between the list tags of displayed for every item in the list.  <<currentTiddler>> is the current value in the loop, for the current item from the list of items returned from the filter.

You could have all kinds of stuff between the opening and closing "list" tags.

<<currentTiddler>> is a notation for a variable or macro reference (maybe other things too, I have not kept up with latest TW features since version 5.2.3).

Variables and macros can be used in filters.  Using the examples above:

{{{ [<currentTiddler>] }}} will result in a value that is whatever currentTiddler is at that moment.

The filter I had setup does not use tags, but rather looks for ".BAS" in the name of the tiddler.

If you do not want to use a check for something in a tiddler title ...

Say I were to modify my code to instead look for a "BAS" tag instead of looking for ".BAS" in the title, I'd setup the filter like so:
<$list filter="[<currentTiddler>tag[BAS]]">

The "basfilter" macro is no longer needed, so I would delete the following line:
\define basfilter() [.]BAS


Message 3 from Charlie

In my opinion, TiddlyWiki.com is the best reference.

To become proficient in TiddlyWiki, read absolutely everything in the Contents tab (in the sidebar.)

Read it once, maybe twice, without necessarily trying to understand what you are reading.  Read it all just to take stock of things (i.e. get the vocabulary and an awareness/inventory of everything.)

In your second, maybe even third, read of everything, all will make sense.  Something that may not have made sense the first time around likely made no sense because you were missing some bits that you only discovered further down into your reading.  The second time around, it will make sense because you have become aware of certain things you weren't aware of before.

"{{{" and "}}}", those are shorthand notation for "evaluate the filter contained between these triple-curly brackets.  Whatever filter you have in there, make sure it is the kind of filter that results in at most one value.

"{{" and "}}", that is shorthand for "transclude/get" the value in this tiddler and field, maybe using a transclusion template:  {{ tiddler-title !! tiddler-field || template }}

If tiddler-title is not specified, then the "current tiddler" is assumed.  If "!! tiddler-field" is not specified, then the text field is assumed.  If "|| template" is not specified, then whatever is retrieved is shown as-is.

All of that will make more sense after you have read everything a couple of times.

I asked about some of the other details and got this response

Message 4 from Charlie

search-replace[:::PROGRAM:::],{!!text} 

That says: whatever is coming from the left side of the filter, however many things, for each thing search for the string ":::PROGRAM:::"  (the colons are not notation, they are just added to make the string visually stick out like a sore thumb when I'm looking at the text), and replace it with the value in the text field from the current tiddler.

{{ tiddler-name !! tiddler-field }} is a transclusion that returns the value of the named field from the named tiddler.  If tiddler-name is not specified, then current tiddler is assumed.

That transclusion (which is used in the body of text in whatever tiddler) can be used inside filters.  When used inside filters, only one of each curly bracket is used, and each curly bracket replaces what would normally be square brackets wrapping a literal value.  The single-curly brackets say "hey, not a literal value here, but rather a transclusion of some value from some tiddler's field".

Once you know what all the dots are, then your next read, you'll automagically see the connections between them dots.

You'll also quickly be able to identify those things you can ignore (but later easily find if/when you need them, because you'll have "wait a minute, I read something about that" moments.

Always  keep in mind that TiddlyWiki is a champ at "componentizing" content/information/knowledge (i.e. break it down into the smallest reusable bits), and transcluding content (i.e. bringing those bits together however needed and in however many ways needed).  Everything is, ultimately, a transclusion of content (however simple or complex).

Happy to say that I did get it all to work and have added Python and Pascal. Thanks Charlie!


Other Tiddlywiki links:

Edit - History - Print - Recent Changes - Search
Page last modified on January 02, 2025, at 05:20 PM