[title[TiddlerName]is[tiddler]] [title[{{$:/state/NewTiddlerForm!!name_temp}}]is[tiddler]]\define ShowButton()
Press this button and the tiddler will be created and opened so you can view it.
<$button>Create Tiddler
<$action-setfield $tiddler={{$:/state/NewTiddlerForm!!name_temp}} text={{$:/state/NewTiddlerForm!!text}} description={{$:/state/NewTiddlerForm!!description}} tags={{$:/state/NewTiddlerForm!!tags}}/>
<$action-navigate $to={{$:/state/NewTiddlerForm!!name_temp}}/>
<$action-setfield $tiddler='$:/state/NewTiddlerForm' name_temp='' text='' description='' tags=''/>
</$button>
<$button>Clear Form
<$action-setfield $tiddler='$:/state/NewTiddlerForm' name_temp='' text='' description='' tags=''/>
</$button>
\end
\define ShowExist() @@color:red; ''This tiddler exists pick a different name''@@\define filter() [title[{$:/state/NewTiddlerForm!!name_temp}]is[tiddler]]!!Step 1 - ''Give the tiddler a name''
---
<$edit-text class='tc-edit-texteditor' tiddler='$:/state/NewTiddlerForm' field='name_temp' placeholder='Tiddler Name'/><br>
!!Step 2 - ''Fill in tiddler text''
---
You can use any WikiText here, see [[Wiki Formatting - text, tables, etc.]] for some easy examples of text formatting.
You can resize the exiting field by clicking and dragging the lower right corner.
<$edit-text class='tc-edit-texteditor' tiddler='$:/state/NewTiddlerForm' field='text' placeholder='Tiddler Text'/><br>
!!Step 3 - ''Give the tiddler a description'' (optional)
---
This can be used as a short description or summary of what each tiddler is. It can be useful in lists.
<$edit-text class='tc-edit-texteditor' tiddler='$:/state/NewTiddlerForm' field='description' placeholder='Tiddler Description'/><br>
!!Step 4 - ''Add a tag or tags to the tiddler'' (optional)
---
Tags are used for the table of contents, so it may be advisable to add tags to new tiddlers. For example, if you wanted to add a tiddler that would be displayed under 'Tools' in the table of contents you would add the 'Tools' tag to the tiddler.
<$select tiddler='$:/state/NewTiddlerForm' field='add_or_create_tag'>
<option value='existing'>Add existing tag</option>
<option value='create'>Add a new tag</option>
</$select>
<$reveal type=match state='$:/state/NewTiddlerForm!!add_or_create_tag' text='create'>
New Tag Name: <$edit-text tiddler='$:/state/NewTiddlerForm' field='tag_temp' placeholder='New Tag'/><$fieldmangler tiddler='$:/state/NewTiddlerForm'>
<$button>
<$action-sendmessage $message='tm-add-tag' $param={{$:/state/NewTiddlerForm!!tag_temp}}/>
<$action-setfield $tiddler='$:/state/NewTiddlerForm' $field='tag_temp' $value=''/>Add Tag
</$button>
</$fieldmangler><br>
</$reveal>
<$reveal type='match' state='$:/state/NewTiddlerForm!!add_or_create_tag' text='existing'>
Tag to add: <$select tiddler='$:/state/NewTiddlerForm' field='tag_temp'>
<$list filter='[tags[]sort[title]]'>
<option><$view field='title'/></option>
</$list>
</$select>
<$fieldmangler tiddler='$:/state/NewTiddlerForm'>
<$button>
<$action-sendmessage $message='tm-add-tag' $param={{$:/state/NewTiddlerForm!!tag_temp}}/>Add Tag
</$button>
</$fieldmangler>
<br>
</$reveal>
List of current tags:<br>
<$fieldmangler tiddler='$:/state/NewTiddlerForm'>
<$set name=tiddlerEditing value='$:/state/NewTiddlerForm'>
<$list filter='[[$:/state/NewTiddlerForm]tags[]]'><$view field='title'/> <$button>Remove Tag<$action-sendmessage $message='tm-remove-tag' $param=<<currentTiddler>>/></$button><br> </$list>
</$set>
</$fieldmangler>
!!Step 5 - ''Create the tiddler''
---
<$list filter=<<filter>> emptyMessage=<<ShowButton>>> <<ShowExist>> </$list>In TiddlyWiki *content*, variables are referenced using <<variableName>>. The double-bracket syntax is used to avoid conflicts with standard HTML syntax (i.e., <b> starts normal HTML bold formatting, while <<b>> embeds the value of a TiddlyWiki variable named "b")
However, within TiddlyWiki *filters*, there is no need doubling the brackets, as HTML is not allowed *within* the filter, so only single <variableName> is used.
...and why I don't have to wrap <fieldname> with [<fieldname>] before giving it to split.
Think of the brackets in filters as part of the operand itself rather than a "container" for the operand. The type of bracket indicates the type of operand being used:
use [...] for literal values, e.g., [texthere]
use {...} for field references, e.g., {!!fieldname}
use <...> for variables e.g. <currentTiddler>
Thus, to split the literal text, "sometext", you could write:
[title[sometext]splitbefore[t]removesuffix[t]]
you would get "some" as a result.
If the value "sometext" is stored in a field named "somefield" in the current tiddler, you could write:
[{!!somefield}splitbefore[t]removesuffix[t]]
and, if the value "sometext" is stored in a variable named "somevariable", you could write:
[<somevariable>splitbefore[t]removesuffix[t]]
As a slightly more complex example, suppose the value to split on was also stored in a variable. Then you could write:
[<somevariable>splitbefore<othervariable>removesuffix<othervariable>]