How to render [ ] in Tiddler title?

99 views
Skip to first unread message

Cd.K

unread,
Sep 19, 2019, 6:28:34 PM9/19/19
to TiddlyWiki
Here's what I've been trying to do:

20-09-_2019_00-07-12.png


I want:

tiddlers created [01.09.2019 to 15.09.2019[


Is this possible?


TonyM

unread,
Sep 19, 2019, 8:05:25 PM9/19/19
to TiddlyWiki
Cd.K

I am not exactly sure of your request however I will assume you want to list tiddlers with a created date between 

01.09.2019 to 15.09.2019


When you transclude the created and modified dates like this
{{!!created}}
Tiddlywiki intervieins to display it in a data format.

However it is contained within the hidden created field, according to this format https://tiddlywiki.com/#Date%20Fields

You can see this using 
<$text text={{!!created}}/>
eg
20190919063745877

So since the values in a date go from most significant years, to least significant milliseconds it is a number that can be used for comparisons.
Yes there are numbers that are not valid like the 99th of a month but they remain in sequence.

So in your example you need only test if the prefix YYYYMMDD is between 20190901 and 20190915

The reveal widget contains a test for greater than and less than.

However in your example you also have a range that could be expressed with the days[-14] operator on the 20190915 second date or days[+14] on the first.

I will leave the balance of this issue to you or another contributor.

Regards
Tony

Cd.K

unread,
Sep 19, 2019, 9:37:11 PM9/19/19
to tiddl...@googlegroups.com
TonyM

My request is because of this "bad-chars" warning:

20-09-_2019_03-34-02.png


I only want to be able to have [ ] chars in a tiddler title.

Regards
Cd.K

TonyM

unread,
Sep 19, 2019, 10:10:53 PM9/19/19
to TiddlyWiki
Cd.K

Well with Respect, you do want to do something it is telling you not to. Avoid using [ ] in tiddler titles.
  • Why are you doing this? 
  • Is there something unstated here you want to do?
  • Surly it not just a preference for [ ]?

Try ( ) instead. Or place in the tiddler
<h1>tiddlers created [01.09.2019 to 15.09.2019]</h1>

or use the title

tiddlers created: 01.09.2019 - 15.09.2019


There are possibilities to make it look as you desire, you could hack the way and what is displayed in 

$:/core/ui/ViewTemplate/title


However, Let's return to the real problem you are trying to solve before you adopt exceptional solutions.

Regards
Tony

Cd.K

unread,
Sep 19, 2019, 10:29:13 PM9/19/19
to tiddl...@googlegroups.com
TonyM

It means:

tiddlers created: inclusive 01.09.2019 - 15.09.2019 exclusive


It is simply a mathematical notation of range boundaries.

Thanks for the hint

$:/core/ui/ViewTemplate/title


Regards
Cd.K


On Friday, September 20, 2019 at 4:10:53 AM UTC+2, TonyM wrote:
Cd.K

TonyM

unread,
Sep 19, 2019, 11:32:05 PM9/19/19
to TiddlyWiki
Unless you has a really good reason don't hack 

$:/core/ui/ViewTemplate/title


Regards
Tony

Mat

unread,
Sep 20, 2019, 12:59:05 AM9/20/19
to TiddlyWiki
Here's a cheat that can be copy pasted. I have no idea how these characters show in different browsers but in mine they're variants of square brackets

⦏ ⦎ 
⁅ ⁆
⟦ 
⦋ 

<:-)

Mohammad

unread,
Sep 20, 2019, 1:58:45 AM9/20/19
to TiddlyWiki
This is quite easy but the way you tackle the problem seems not inline with TW!

See examples here



Note that, TW used created and modified field where you see when your tiddler created or modified!

Good luck

Mohammad

unread,
Sep 20, 2019, 2:06:23 AM9/20/19
to TiddlyWiki
This is a bad practice!
Avoid using [] in tiddler title!

I think it is better to explain what you want to in Tiddlywiki instead of your approach to solve it!

--Mohmmad

Mohammad

unread,
Sep 20, 2019, 2:27:24 AM9/20/19
to TiddlyWiki
Not tested but this should work.

Simply create a tiddler and paste the below code inside it


<$edit-text tag="input" size="40" tiddler="mycreated" default="" placeholder=" regexp pattern"/>

<$set name=pattern value={{mycreated}} emptyValue="::No pattern">
Number of tiddlers found: <$count filter="[!is[system]!is[shadow]regexp:created<pattern>]"/><br>
<dl>
<$list filter="[!is[system]!is[shadow]regexp:created<pattern>]">
<dt><$link/></dt>
<dd><$view field=created format=date template="YYYY.0MM.0DD"/></dd>
</$list>
</dl>
</$set>


If you use 

^201909[01]


Then all tiddlers created from 2019.09.01 to 2019.09.19 are created will be listed! (system and shadow tiddlers are excluded)
 
For you case I think

(^2019090|^2019091[012345])



Should work!

Not tested

Mark and Josiah may have better solution.


--Mohammad

@TiddlyTweeter

unread,
Sep 20, 2019, 4:36:56 AM9/20/19
to TiddlyWiki
A couple of regex solutions have been proposed that work to match the "created" field for the range.

The only issue is its pure pattern, not maths informed.

I was wondering if any of the other operators could do this too?

For instance the "days" operator. https://tiddlywiki.com/#days%20Operator

Can you set a date it would start from in a filter?

TT

@TiddlyTweeter

unread,
Sep 20, 2019, 4:46:08 AM9/20/19
to TiddlyWiki
Mohammad 
For you case I think
(^2019090|^2019091[012345])

Should work!

Neat! It could be slightly more compact 

(^2019090|^2019091[0-5])

A version that does the same but without needing a variable to escape the [...] brackets. 

Can be used directly in Advanced Search Filter ...

[regexp:created[(^2019090|^2019091(0|1|2|3|4|5))]]


TT

Mohammad

unread,
Sep 20, 2019, 6:34:36 AM9/20/19
to TiddlyWiki
Added to tw-regexp

Cd.K

unread,
Sep 20, 2019, 7:57:14 AM9/20/19
to TiddlyWiki
Mat

This offer ⦏ ⦎ is good for me.👍
Gives the impression of dirt on the screen if you don't look closely.

Thanks
Cd.K

Cd.K

unread,
Sep 20, 2019, 8:02:06 AM9/20/19
to TiddlyWiki
Mohammad

I just want the possibility to mask/escape special chars in tiddler titles. It renders "[" oder"]" and you don't have problems with this chars.

Regards
Cd.K

Cd.K

unread,
Sep 20, 2019, 8:12:34 AM9/20/19
to tiddl...@googlegroups.com
Mohammad

Works!

My new tiddler:

"Mohammad regexpr list filter tool"


Thanks
Cd.K




Mohammad

unread,
Sep 20, 2019, 10:00:14 AM9/20/19
to TiddlyWiki
I am Glad you find it useful!


We have collected few regexp patterns to search in title, fields (excluding text) and partially on text.
Using these as I sent above needs its own input box and should not be used with advanced search.

Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages