On Saturday, October 3, 2020 at 1:39:59 AM UTC-7, Eric Shulman wrote: > > The short answer is (currently) "no". Here's a bit more info: >
Success! I've just updated the http://TiddlyTools.com/timer.html Calendar to support showing "events" for tiddlers that have a "start-date" (and optional "end-date") field! Here's some tech notes on how it's done: > > - In the showday() macro, the tiddlers with created/modified dates on > that day are identified by: > > <$set name="haschanges" filter="[enlist<tiddlers>sameday<thisdate>] > [enlist<tiddlers>sameday:created<thisdate>] [<journalTitle>is[tiddler]]"> > > > - Similarly, in the showday_popup() macro, the tiddlers with > created/modified dates on that day are identified by: > > <$set name="created" filter="[enlist<tiddlers>!title<journalTitle> > sameday:created<thisdate>sort[created]]"> > <$set name="modified" filter="[enlist<tiddlers>!title<journalTitle> > sameday:modified<thisdate>!sort[modified]]"> > > I realized that I could make things just a bit more efficient by only doing the "sameday:created" and "sameday:modified" filters ONCE instead of twice! Thus, showday() now does the <$set name="created"...> and <$set name="modified"...> code, and then computes the "haschanges" flag using: <$set name="haschanges" filter="[<created>!match[]] [<modified>!match[]] [ <journalTitle>is[tiddler]]"> Then, showday_popup() just references the already computed <<created>> and <<modified>> variables, instead of recomputing them. > - In the getevents() macro, "events" are loaded in from two types of > tiddlers: > > > 1. text tiddlers tagged with "events", containing one event per line > of text, using format: "YYYYMMDD;Description" > 2. text tiddlers with an ".ics" suffix, using the iCalendar > standard VEVENT text record format (see > https://en.wikipedia.org/wiki/ICalendar) > > getevents() now also defines events from tiddlers that have "start-date" fields (using YYYYMMDD format). If there is an "end-date" field, it also defines an event for that date as well... and, if it has a "description" field, it uses that text to show the event in the calendar (otherwise it just uses the tiddler's title as the event description). Here's the added code in getevents(): <$list filter="[all[]has[start-date]]"> ``[[``{{!!start-date}};{{!!title}}{{{ [{!!description}!match[]then[: ]] }}}{{!!description}}|{{!!title}}``]]``<br> <$list filter="[<currentTiddler>get[end-date]]" variable="end_date"> <!-- TBD: add entries for each date in between start-date and end-date --> ``[[``{{!!end-date}};{{!!title}}{{{ [{!!description}!match[]then[: ]] }}}{{!!description}}|{{!!title}}``]]``<br> </$list> </$list> Note that currently, this code creates an event for the "end-date" only if there is also a "start-date", and does NOT yet create events for any of the dates in between. (Thus, the "TBD" comment in the above code) Note also how the generated "event" item includes "|{{!!title}}" at the end. This allows the display of the event in showday_popup() to link to the source tiddler, rather than linking to the full description text. Here's the changed code from showday_popup(): <$list filter="[enlist<todays_events>]"> <$vars event_text={{{ [<currentTiddler>split[|]first[]] }}}> <$vars event_link={{{ [<currentTiddler>split[|]rest[]] }}}> <$link to={{{ [<event_link>!match[]else<event_text>] }}} tooltip="view tiddler"><$text text=<<event_text>>/></$link> </$vars> </$vars> </$list> I still need to add a new checkbox option for enabling/disabling the "start-date/end-date" handling. Currently, any tiddlers with "start-date" will *always* be shown as events, even if the Calendar is configured to turn off *all* "Holiday/Events". Lastly, I also haven't added support for recognizing "journal-date" fields, but that will also be coming soon. enjoy, -e -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/950c8e9d-d6e9-4fb7-b0f5-e52f9f8344d4o%40googlegroups.com.

