I don't know how in-depth you want me to go into regarding an explanation
of how I'm using your make plugin, so here goes.
I have a setup where I store individual historical events in individual
tiddlers. The events have the following naming convention:
Event_YYYY_MM_DD_X, where YYYY is the year, MM is the month, DD is the day,
and _X is optionally added, incrementing from one, when a tiddler with the
same date already exists, similar to how new tiddlers are named when using
the plus button.
The setting I'm working in is the Star Trek universe, designed so I can
have an extensive database of background information for use in fan
fiction. I have things like species, governments, planets, etc stored in
their own tiddlers.
I wanted to create an easy way to compile which species, planets, and star
systems belong to which governments inside the corresponding government's
tiddler. Since planets can change hands, and since I wanted a way to
compile all historical events into a single History tiddler, I made event
tiddlers tagged with empire_event to denote events where a planet changed
hands with regard to which government controlled it. This worked fine, but
I wanted to make things easier. What I created was a form that would
create a new tiddler, based on a template tiddler, and modify the fields in
the new tiddler to reflect the values in the form. All the template
tiddler does is presents the fields in a user-friendly manner. I can show
how this is done if anyone wants me to.
Here is the form code bit-by-bit with explanations:
Planet: <$select field='planet'>
<$list filter="[tag[planet]sort[title]]">
<option><<currentTiddler>></option>
</$list>
</$select>
This creates a selection box that modifies a field in the form's tiddler
called planet. The list widget selects tiddlers tagged with the planet
tag, sorts them by title, and adds them as options to the selection box.
Action:
<$select field='jointype'>
<$list filter="join conquer colonize found destroy breakfree cede">
<option><<currentTiddler>></option>
</$list>
</$select>
Similar to the planet selection box, but this uses an explicitly-defined
list of possible ways a planet can join or leave a government, and can be
modified if needed.
Faction:
<$select field='faction'>
<$list filter="[tag[faction]sort[title]]">
<option><<currentTiddler>></option>
</$list>
</$select>
Identical to the planet selection box, except that it handles governments.
Year:
<$edit field="year" placeholder="year" />
Month:
<$select field='month'>
<$list filter="01 02 03 04 05 06 07 08 09 10 11 12">
<option><<currentTiddler>></option>
</$list>
</$select>
Day:
<$select field='day'>
<$list filter="01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31">
<option><<currentTiddler>></option>
</$list>
</$select>
This allows me to enter the date an event occurred. Since the year has
infinite range, I chose to go with a simple text box instead of a selection
box.
!!!Same-Year Events
<$list filter="[tag[event]] [tag[empire_event]] +[year{!!year}sort[title]]">
*<$link to=<<currentTiddler>>><<currentTiddler>></$link>:{{}}
</$list>
This compiles a list of any events that occurred the same year, allowing me
a way to determine with greater accuracy when an event would make sense to
have occurred. It gets all tiddlers tagged event, all tiddlers tagged
empire_event, then picks only those whose year matches the value in the
year box, then sorts them by title to put them in chronological order. The
line within the list widget simply creates a link to the event tiddler,
adds a colon, then transcludes the event tiddler, since the event tiddler
is usually only one line of text. This allows me to see the date and
contents easily while letting me quickly make changes when necessary.
Now where the heavy lifting comes in.
<$set name=eventtitle
filter="[make[Event_{{!!year}}_{{!!month}}_{{!!day}}\max:1 \ sep:_]]">
This creates a variable called eventtitle and uses a filter to return a
link to a new, undefined tiddler. It uses Tobias Beer's make plugin.
Here's how it works:
Everything before the first backslash, that being
Event_{{!!year}}_{{!!month}}_{{!!day}}, is a prefix for any tiddler titles
the make plugin creates. If I had year set to 2011, month to 07, and day
to 22, the prefix for the titles created by the make plugin would be
Event_2011_07_22. The "\max:1" tells the make plugin to only generate one
link, since I'm only creating one tiddler at a time. The "\sep:_" tells
the plugin to use an underscore as a separator between the prefix and any
number appended to the title. For example, if I have two events occuring
on 07 22 2011, the second tiddler created by the form would have the title
Event_2011_07_22_1, the third Event_2011_07_22_2, etc.
<$button>New Event
<$action-setfield $tiddler="Template: Empire Event" title=<<eventtitle>>/>
<$action-setfield $tiddler=<<eventtitle>> year={{!!year}}
planet={{!!planet}} faction={{!!faction}} jointype={{!!jointype}}/>
</$button>
</$set>
This creates a button which performs two actions.
The first is where it duplicates the tiddler named Template: Empire Event
and sets the title of the duplicate to the eventtitle variable I made
earlier.
The second is where it sets the fields of the new tiddler to match the
values in the form.
This form allows me to select a planet, an action, and a government, then
specify the date, and create a new tiddler that fits in well with other
things I have going on in my workspace.
On Wed, Dec 30, 2015 at 1:29 PM, David Allen <[email protected]>
wrote:
> Well, that worked, but I'm still having the problem where I can't get the
> planet name to be stored correctly.
>
> On Wed, Dec 30, 2015 at 12:38 AM, Tobias Beer <[email protected]>
> wrote:
>
>> Hi David,
>>
>>
>>> What about doing something where, if a tiddler with a certain title
>>> exists, create one with an incremented number after it, similar to how the
>>> New Tiddler button works? Does anyone know how I could do that?
>>>
>>
>> Take a look at tobibeer/make
>> <http://tobibeer.github.io/tw5-plugins/#make>.
>>
>> Best wishes,
>>
>> Tobias.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "TiddlyWiki" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/tiddlywiki/1NbjFgAAUkU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/tiddlywiki.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/14e88f08-e77c-4693-b1a0-024223f7b072%40googlegroups.com
>> <https://groups.google.com/d/msgid/tiddlywiki/14e88f08-e77c-4693-b1a0-024223f7b072%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> David Allen
>
--
David Allen
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/CALaYjLhDj8wSq1ZeOY6NyK4eD%2B_M9HBP%2BLSw%3DsMxa%3DPkYBuzWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.