Text and String Manipulation - the missing join options?

141 views
Skip to first unread message

TonyM

unread,
Jun 2, 2020, 8:34:11 PM6/2/20
to TiddlyWiki
Folks,

Has anyone noticed we have the following Operators
Then we have
  • Join  (using simple text)
  • ??????
The missing piece here is how do we insert or replace non simple text?, in many cases you can use a macro to define what to join with but only if you can represent it as wikitext. 

  • The key example is one cant join using the new line character, splitregexp allows to to split based on \n but there is now way to join with \n
  • Eric shared a workaround, but I believe we need to solve this gap. 
  • It would be quite easy to identify a handful of other special characters such as tabs.
  • One thought is a set of macros that contain the special characters, eg <<new-line>> to use with join<new-line>
  • I was surprised I could not find a html entity or special character for new line.

Your thoughts?

Regards
Tony

PMario

unread,
Jun 3, 2020, 9:08:47 AM6/3/20
to TiddlyWiki
Hi,

On Wednesday, June 3, 2020 at 2:34:11 AM UTC+2, TonyM wrote:
Folks,

Has anyone noticed we have the following Operators
Then we have
  • Join  (using simple text)
  • ??????

PMario

unread,
Jun 3, 2020, 9:15:51 AM6/3/20
to TiddlyWiki
On Wednesday, June 3, 2020 at 2:34:11 AM UTC+2, TonyM wrote:
 
The missing piece here is how do we insert or replace non simple text?, in many cases you can use a macro to define what to join with but only if you can represent it as wikitext. 

  • The key example is one cant join using the new line character, splitregexp allows to to split based on \n but there is now way to join with \n

You are right joining a new-line is tricky. You need to use <$set filter ...>

\define testCreate()
<$set name=test filter="""[[aaa-bbb-ccc-ddd]split[-]join[
]]""">
<$action-createtiddler $basetitle="base" text=<<test>> />
</$set>
\end

<$button actions=<<testCreate>> >
Create Tiddler
</$button>

-mario

PMario

unread,
Jun 3, 2020, 9:21:43 AM6/3/20
to TiddlyWiki
Hi,

It should be possible to create something like: join:special[\n\t\xxxx] which would make it much easier.

-m

PMario

unread,
Jun 3, 2020, 9:23:06 AM6/3/20
to TiddlyWiki
Hi,

IMO should be a github feature request.

-mario

TonyM

unread,
Jun 3, 2020, 7:54:03 PM6/3/20
to TiddlyWiki
Mario,

Will you or I raise that Issue?

Another approach would be a set of macros that return the value. 

However your approach makes more sense I would like to see the ability to do this more generally. 

I am surprised it cant seem to be achieved with html entities, ASCII or other fonts. Or perhaps it can and the join operator ignores it.

Join is not the only place, inside then or else operators, addprefix[\n] etc...

Regards
Tony

PMario

unread,
Jun 4, 2020, 5:22:05 AM6/4/20
to TiddlyWiki
Hi,

I did create a new issue.

-mario

PMario

unread,
Jun 4, 2020, 5:22:27 AM6/4/20
to TiddlyWiki
Reply all
Reply to author
Forward
0 new messages