Mod of the Sticky-ToDo-Plugin: Filter to sort extracted strings by the date at the end of the string wanted

Hi Mario!
Sorry, it was just a slightly too big finger which made me add the WIKI.Can remove it?
Back to the original question and merry x-mas!

Hello @JanJo , thanks for your interest, I’m glad you find it helpful. For some context, I run a full GTD-style task management system in my wikis, and my Stickies system was meant to append to that and only flag something to be entered as a “real” task with the associated Metadata (assigned to, sponsor, due date, reminderdate,project, context). Given that, I don’t plan on adding anymore features to Stickies in terms of fields. Its aim is to not interrupt the flow of taking notes in a meeting, like if you were writing notes by hand and you circled something as followup for instance.

All of that said I welcome and encourage others to tweak and modify to fit their own needs! That’s what makes TiddlyWiki so great to me, you can easily adapt the work of others to suit. There no Javascript or anything, it’s just filters and other wikitext.

Per your sorting question, I imagine it would be possible, but a core design decision of the plug-in is NO STORE of the tasks outside of the tiddler itself. The lists I do generate are based on tiddler parsing with Regex, so without a store or using real fields, sorting gets a little complicated. If that functionality is important, my guess is that another of the great todo plugins from the community might be a better fit?

1 Like

Okay, new effort to build the filter to display the stickies ordered by date:

<$list filter="[regexp:text<sticky-string>!is[system]!is[current]subfilter<sticky-filter-result>get[text]join[]]" variable="longstring">
    <!--<$link/> activating this you see the input to the filter <br>-->
    <$list filter="[<longstring>splitregexp[\n]regexp<sticky-string>] HOW CAN I SORT THIS?" variable="line">
      <div style="margin-left:2em;text-indent:-1em;" title=<<line>> >
        <$list filter="[search<line>]"><!--nessesary to apply the macro to the correct tiddler!-->
        <$list filter="[<line>search-replace::regexp{$:/plugins/stobot/sticky/settings##sidebar-search},[$1]]" variable="line-clean"><<line-clean>></$list></$list>
      </div>
    </$list>
    <br>
  </$list>

Where I wrote HOW CAN I SORT THIS?
I could not figure out the correct syntax to apply the sort filter on the result of the first filter this means: Extract the DateString which has the form “YYYY/MM/DD”>> and sort by it.
How is this done? You find a sandbox on the link above.

Best wishes Jan

Is there something like a sortregex filter to achieve this?
The problem I have is that something like the code seems to refer to the input title, not to the result… am I right?

\define short-string() ^+?"(0-9/)"\>\>
...

<$list filter="[<longstring>splitregexp[\n]regexp<sticky-string>] :sort:string[search-replace::regexp<short-string>,[$&]]" variable="line">

to check see the link new Effort in the post above…

Hello @JanJo, I’m back in town and catching up. You’d posted a link and asked it to be referenced, but the link now appears to be broken?

This is a shot in the dark based on your description of what you think is the problem (seems to refer to the input title, not to the result. To sort on a property of a title, rather than the title itself is normally handled with the sortsub operator https://tiddlywiki.com/#sortsub%20Operator - is that of any help here?

The other idea just trying to piece together the code visually is that you (and perhaps “I” if it’s based on my original code) have an outer list and then the inner list. If that’s mine, it’d be because I wanted to first list the tiddlers with stickies (outer), and then within each of those tiddlers list all the individual stickies (since each tiddler can contain many stickies). Because of that nesting, sorting would be limited to sorting only within tiddlers. To get around that, you’d need to think about instead combining the filters somehow so that all the stickies could be present in a single list to be sorted across tiddlers.

Anyways, that might all be a waste of time for which I apologize, but just giving you some thoughts quickly in case that led you in the right direction. Good luck!

Hi @stobot, thanks for your help.
sortsub seems to be the correct approach, though I did not get it to work yet.
Thanks to your plugin I learned more regex than in the years befor, but it is not my best friend yet.

I had left the sandbox-wiki a little untidy. It should be more explaining now.

Best wishes Jan

@JanJo - I spent time trying to unravel your tweaks to see what you’ve tried so far. I unfortunately still think that this is not the right method to get to what you want. Again if you used a todo mechanism that stored its parameters in fields or something this would be a very easy ask, but trying to make a block of raw text act like a database is just going to make your life really hard.

That warning aside, if you were confident about some assumptions, I think this is what it’d take… Your outer list finds all the tiddlers with sticky macros in them. You’ve now asked them to just join[] together in their entirety (I think you may need to join by at least a newline by the way). You should know that in that context you’ve lost the ability to know what tiddler you’re in anymore… Anyways, then you have a bunch of lines, some of which have stickies, and some don’t. You’d want to get rid of the lines without stickies (you’re doing that in your 2nd outer list), and then you have just lists of lines (text between newline characters) from all of your tiddlers with stickies. Now you’re trying to sort based on the value between quotes somewhere in the line.

If you know with certainty that it’s always the case that:

  1. There’s only one sticky per line
  2. You always provide all 3 parameters manually with the " character
  3. You’d not use the quote character in those lines in any other way than for the macro

Then theoretically you’d make a variable holding a filter to extract the text between the 5th and 6th quotation marks. Then you could use sortsub based on that variable.

To me, that’s a LOT of ifs, but hopefully that’s helpful - good luck!

Hi @stobot ,
I have to join the tiddler texts to sort the stickies independent of their tiddler.
The sorrounding tiddler then is found by searching for <line> in the next filter - clicking the checkbox works after the two filters.
My problem is to get the resultine line into the second subsort-opetrator filter - title seems to look for the initial title before splitting the tiddler. I could need something like “sortregex operator”

I don’t know that you need a different operator, you just need the regex to get the text between the 5th and 6th quotation mark. Something like:

[search-replace::regexp[.*?<<sticky ".+?" ".+?" "(.+)" *>>.*],[$1]]

So, if you have your filter down to lines containing stickies, you should be able to store something like the above in a get-date variable and then do a sortsub<get-date> to sort it, since using ISO dates will sort alphabetically.

Cool - thanks a lot - the main part works.
Some issues remain:


<<sticky "Fix the problem of Stickies without date" "" "">>
<<sticky "...without name" "" "2022/01/11">>
<<sticky "...and with erased dated" "" "2022/01/11">>
collecting stickies from other tiddlers does not wor well either.

CORRECTION
After some tuning it is just an order problem now:

So far stickies without date appear before stickies with date.
This would be better the other way round.

best wishes Jan

Gotcha. Not at my computer at the moment, but if blanks are possible I suggest changing the regex + signs in the quotes to *

Also, try changing the end
]]
to
]else[9999]]

Which might treat no date like year 9999?

1 Like

Hi stobot,
Regex is black magic… I do not know how i spoiled it.
I’ll try again next year. :woozy_face:

Hi @stobot,
I finally found out, that I was struggling with the syntax of the subsort-operator
Now it is working.

Thanks a lot and best wishes Jan

1 Like

Sshhhh!
With the help of @stobot the mod is now a plugin which adds the possibility to add a who and a due to the ToDo
Warning: It only works with wikis 5.2 + and is not entirely translated from German.
You can modify a dictionary-tiddler to change the language.
It would be nice to post the .jsons of the translations here, I will link them in the wiki.
As always, backup before installing.
Here it is:
http://szen.io/ToDo/

4 Likes

@JanJo Thanks for this mod of sticky todos. I like the purpose behind such a mod and plan to use it in my wikis. I also need a filter to list the todos with due-date of today in today’s journal tiddler. Can you please help to create that filter?

untested!
I guess you will create a viewtemplate for this.

You could use the ToDo-sidebar-date Macro and modify the ToDo-date macro to

\define ToDo-date() [<currentTiddler>search-replace::regexp[.*<<ToDo ".+?" ".*?" "(.*?)">>.*],[$1]match<now>]

I guess this is the ToDo-sidebar-date Macro that you are talking about ?

\define ToDo-sidebar-date()
<$list filter="[regexp:text!is[system]!is[current]first[1]]" emptyMessage={{$:/plugins/JJ/ToDo/settings##done-message}} variable=“x”>
<>
<$wikify name=“ToDo-filter-result” text=<>>
<$list filter="[regexp:text!is[system]!is[current]subfilterget[text]join[spl1t]]" variable=“longstring”>
<$list filter="[splitregexp[\n|spl1t]regexpsortsub]" variable=“line”>
<div style=“margin-left:2em;text-indent:-1em;” title=<> > {{{ [search-replace::regexp[.<<ToDo “.+?” ".?" “(.)">>.],[$1]] }}}
<$list filter=”[search]">
<$list filter="[search-replace::regexp{$:/plugins/JJ/ToDo/settings##sidebar-search},[$1]]" variable=“line-clean”><></$list>
</$list>

</$list>


</$list>
</$wikify>
</$list>
\end

Am i supposed to copy paste the same in the $:/plugins/JJ/ToDo/macros ?

And which parts of that macro should i replace with \define ToDo-date() [<currentTiddler>search-replace::regexp[.*<<ToDo ".+?" ".*?" "(.*?)">>.*],[$1]match<now>]

@JanJo Hope to get some help from you regarding this filter and macro once you are back.

This feature request is solved as discussed here.

Can the dynaannotate plug-in be used to insert the todo macro to some text contents within the tiddler body in the view mode?

1 Like