@technome gladly! Not sure what part exactly you’re interested in, so I give you everything 
- my default tiddlers (set in the control panel) includes today’s journal
[<now "YYYY-0MM-0DD, ddd">]
.
-
$:/zig/auto_journal_on_startup
is tagged $:/tags/StartupAction/PostRender
and contains this:
<$let journalTitleTemplate={{$:/config/NewJournal/Title}} >
<!-- <$wikify name="journalTitle" text="<$transclude $variable='now' format=<journalTitleTemplate>/>"> -->
<!-- No idea why transclude or the macro itself do not interpret the format correctly whereas it works in a filter, but it works better. -->
<!-- ended up hardcoding the date format instead of using journalTitleTemplate -->
<$wikify name="journalTitle" text="{{{[<now 'YYYY-0MM-0DD, ddd'>]}}}">
<$list filter="[<journalTitle>!is[tiddler]]" >
<$action-createtiddler $basetitle=<<journalTitle>> $template="$:/zig/templates/JournalBody" tags="Journal" />
</$list>
</$wikify>
-
$:/zig/templates/JournalBody
contains only this
{{||$:/zig/templates/JournalTemplate}}
-
$:/zig/templates/JournalTemplate
contains what I want to see on every journal, currently the list of tiddlers created and modified in that day, and buttons to the previous/next days:
<$list filter="[<currentTiddler>tag[Journal]]"
<$let journaldate={{{ [{!!journal-date}split[]first[8]join[]] }}}
titledate={{{ [{!!title}parsedate[YYYY-0MM-0DD, ddd]] }}}
createddate={{{ [{!!created}format:date[YYYY0MM0DD]] }}}>
<$set name="thisdate" value=<<journaldate>> emptyValue=<<titledate>>>
<$set name="thisdate" filter="[<thisdate>search:title[NaN]]" value=<<createddate>> emptyValue=<<thisdate>>>
<$set name="thisdate" filter="[<thisdate>match[]]" value=<<createddate>> emptyValue=<<thisdate>>>
<$set name="created" filter="[!is[system]!has[draft.of]] [all[tags]regexp[zig]tagging[]is[system]] :filter[<currentTiddler>get[created]format:date[YYYY0MM0DD]match<thisdate>]">
<$set name="modified" filter="[!is[system]!has[draft.of]!enlist<created>] [all[tags]regexp[zig]tagging[]is[system]] :filter[<currentTiddler>get[modified]format:date[YYYY0MM0DD]match<thisdate>]">
<$list filter="[<created>!match[]]" >
Created:
<ul style="margin-top:0;margin-bottom:0;">
<$list filter="[enlist<created>sort[]]">
<li><$link/></li>
</$list>
</ul>
</$list>
<$list filter="[<modified>!match[]]">
Modified:
<ul style="margin-top:0;margin-bottom:0;">
<$list filter="[enlist<modified>!sort[modified]]">
<li><$link/></li>
</$list>
</ul>
</$list>
<$let nextday={{{ [<thisdate>format:date[YYYY0MM0DD]add[1]] }}} prevday={{{ [<thisdate>format:date[YYYY0MM0DD]subtract[1]] }}} >
<$button><$link to={{{ [<prevday>format:date[YYYY-0MM-0DD, ddd]] }}}>< Previous day</$link></$button><$button><$link to={{{ [<nextday>format:date[YYYY-0MM-0DD, ddd]] }}}>Next day ></$link></$button>
-
$:/zig/receive_share_GET_pwa
is tagged $:/tags/StartupAction/PostRender
with content to parse the URL http://<my localhost tiddlywiki url>?source_title=mytitle&source_text=mytext&source_url=myurl
and subsequently remove the query strings from the URL to not reprocess them when I reload the page:
\whitespace trim
\define content(title,text,url)
<%if [[$text$]minlength[1]] %>
<<<
$text$
<<<
<%if [[$url$]minlength[1]] %>
from
<%endif%>
<%endif%>
<%if [[$url$]minlength[1]] %>
<%if [[$title$]minlength[1]] %>
`[ext[$title$|$url$]]`
<%else%>
$url$
<%endif%>
<%endif%>
\end
\define link_node(nodetolink) `[[$nodetolink$]]`
\function stream_node_title(parenttt,thistt) [<parenttt>] [[/]] [<thistt>] +[join[]]
<$list filter="[[$:/info/url/search]get[text]split[&]first[]regexp[source_title=.*]] [[$:/info/url/search]get[text]split[&]first[]regexp[source_text=.*]] [[$:/info/url/search]get[text]split[&]first[]regexp[source_url=.*]]">
<$let source_title={{{ [[$:/info/url/search]get[text]split[&]regexp[source_title=]split[=]last[]] +[decodeuricomponent[]] }}}
source_text={{{ [[$:/info/url/search]get[text]split[&]regexp[source_text=]split[=]last[]] +[decodeuricomponent[]] }}}
source_url={{{ [[$:/info/url/search]get[text]split[&]regexp[source_url=]split[=]last[]] +[decodeuricomponent[]] }}}
tiddlerTitleTemplate={{$:/language/DefaultNewTiddlerTitle}} >
<$wikify name="tidTitle" text="<$transclude $variable='now' format=<<tiddlerTitleTemplate>>/>">
<$wikify name="tidcontent" text="<$transclude $variable='content' title=<<source_title>> text=<<source_text>> url=<<source_url>> />" >
<$navigator story="$:/StoryList" history="$:/HistoryList">
<$action-sendmessage $message="tm-new-tiddler" title=<<tidTitle>> text=<<tidcontent>> />
</$navigator>
</$wikify>
</$wikify>
</$let>
<$action-removeQsFromUrl param="source_text"/>
<$action-removeQsFromUrl param="source_title"/>
<$action-removeQsFromUrl param="source_url"/>
</$list>
... Another similar section to use the URL ...?NewStreamToday= to create a new stream tiddler under today's journal tiddler ...
- The custom widget
action-removeQsFromUrl.js
to remove the query string parameters, type=application/Javascript
, field module-type
=widget
:
/*\
Widget to remove the querystring from the URL
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
// console.log("Called action-removeQsFromUrl custom widget!");
// Copied from http://scott.sauyet.com/Tiddlywiki/WIP/AndoverCharterChanges/v3/?#%24%3A%2F_%2Fatc%2Fcore%2Fmodules%2Fwidgets%2Faction-removequeryparam.js
var RemoveQueryParamWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
};
/*
Inherit from the base widget class
*/
RemoveQueryParamWidget.prototype = new Widget();
/*
Render this widget into the DOM
*/
RemoveQueryParamWidget.prototype.render = function(parent,nextSibling) {
this.computeAttributes();
this.execute();
// console.log("Executed render.");
};
/*
Compute the internal state of the widget
*/
RemoveQueryParamWidget.prototype.execute = function() {
this.name = this.getAttribute("param","default");
};
/*
Refresh the widget by ensuring our attributes are up to date
*/
RemoveQueryParamWidget.prototype.refresh = function(changedTiddlers) {
// Nothing to refresh
return this.refreshChildren(changedTiddlers);
};
// console.log("Invoking the action...");
/*
Invoke the action associated with this widget
*/
RemoveQueryParamWidget.prototype.invokeAction = function(triggeringWidget,event) {
var queryParams = new URLSearchParams(window.location.search);
// console.log("Found queryParams " + queryParams.toString());
queryParams.delete(this.name);
history.replaceState(null, null, "?" + queryParams.toString() + document.location.hash);
// Remove them all
// history.replaceState(null, null, document.location.hash);
// history.replaceState(null, null, (queryParams.size > 0 ? ("?" + queryParams.toString()) : '') + document.location.hash);
return true; // Action was invoked
};
// console.log("Invoked the action");
exports["action-removeQsFromUrl"] = RemoveQueryParamWidget;
})();
That’s quite exhaustive, so I hope I’m not drowning you in irrelevant details @technome
but I have more PWA related stuff if you need, let me know!