Should we prohibit leading and trailing whitespace in field names in 5.2.0?

93 views
Skip to first unread message

Soren Bjornstad

unread,
Aug 18, 2021, 4:38:29 PM8/18/21
to TiddlyWiki
I'll preface this by saying this probably belongs in a GitHub issue, and I'll be happy to create one over there if we want one. But wanted to get people's thoughts first, and ASAP because now is our last chance to do this without breaking backwards compatibility (once 5.2.0 is released, it would be pretty hard to change).

Would it make sense to prohibit leading and trailing whitespace in field names, even though we now allow whitespace elsewhere? In the prerelease, it's not possible to add such fields within the GUI, but you can import tiddlers that contain such fields, or create them with an action or $edit-text widget. Fields with leading or trailing whitespace are almost impossible to distinguish within the GUI, since there is already whitespace before and after the name when it's displayed.

In addition, if we continue to prohibit leading and trailing whitespace, I think we would be able to allow whitespace in between filter steps, which is a common annoyance for new users (but maybe I'm missing something there).

I can't think of any situation in which someone would want leading or trailing whitespace in a field name, except maybe to integrate with another system which allowed it for some reason – as evidenced by the fact that the GUI doesn't even let you create such a field. At any rate, it seems much more confusing than helpful. Unix filenames have suffered enormously from being overly permissive in what characters they allow, including leading and trailing whitespace; my instinct tells me this is likely to be a continuing irritation.

On the minus side, someone would of course have to implement checks to prevent these fields from being added.

Soren Bjornstad

unread,
Aug 18, 2021, 4:41:51 PM8/18/21
to TiddlyWiki
Just realized some people might not be familiar with the term "leading and trailing whitespace"...I mean whitespace at the very beginning or end of the name. In the current prerelease, these are valid and distinct field names (with the quotes removed):

"my field"
" my field"
"my field "
"       my field  "

PMario

unread,
Aug 18, 2021, 4:57:26 PM8/18/21
to TiddlyWiki
On Wednesday, August 18, 2021 at 10:38:29 PM UTC+2 Soren Bjornstad wrote:
I'll preface this by saying this probably belongs in a GitHub issue, and I'll be happy to create one over there if we want one. But wanted to get people's thoughts first, and ASAP because now is our last chance to do this without breaking backwards compatibility (once 5.2.0 is released, it would be pretty hard to change).

I think this won't happen because of backwards compatibility with 5.1.x. There have been some discussions on github already. The conclusion was, we keep the status quo and live with it. 

There has been a discussion recently, where a user needed to be able to add whitespace as needed. And the description of the usecase made sense. So there are usecases. ... See: https://groups.google.com/g/tiddlywiki/c/Cjy074MsfzM

-mario

Soren Bjornstad

unread,
Aug 18, 2021, 6:33:29 PM8/18/21
to TiddlyWiki
Mario,

I don't think the thread you linked is relevant. I'm talking about field names, not field values. And I don't see how it would break backwards compatibility with 5.1.x, because 5.1.x didn't allow any spaces in field names.

If I'm misunderstanding, please correct me (and can you link the discussions on GitHub?).

Eric Shulman

unread,
Aug 18, 2021, 6:34:12 PM8/18/21
to TiddlyWiki
On Wednesday, August 18, 2021 at 1:57:26 PM UTC-7 PMario wrote:
There has been a discussion recently, where a user needed to be able to add whitespace as needed. And the description of the usecase made sense.

That discussion was related to having leading whitespace in a field *value*, not a field *name*, and then transcluding that field value into another tiddler.

-e

Joshua Fontany

unread,
Aug 18, 2021, 7:35:09 PM8/18/21
to TiddlyWiki
I am in favor of stripping out leading and trailing whitespace in field Names during field creation and tiddler import.

Best,
Joshua F

Mohammad Rahmani

unread,
Aug 19, 2021, 2:44:48 AM8/19/21
to tiddl...@googlegroups.com
Hi Soren,

I absolutely support removing such spaces in the field name! Those spaces are not displayed visually and are a source of error!
I even support trimming field values when they are saved!

I had encountered such cases many times and it took me a lot of time to find the cause of error!

I believe having clear, simple to follow, semantic rules are much better to have a lot of flexibility!
Normally users get confused, these cause errors for advanced users if they do not care enough and are mostly time consuming!


Best wishes
Mohammad


--
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 tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/20fec6b1-1604-407b-9637-e11f1d749144n%40googlegroups.com.

PMario

unread,
Aug 19, 2021, 3:08:23 AM8/19/21
to TiddlyWiki
On Thursday, August 19, 2021 at 12:33:29 AM UTC+2 Soren Bjornstad wrote:

If I'm misunderstanding, please correct me (and can you link the discussions on GitHub?).

Sorry, I was talking about field values.

You are right, we should trim field names. There is some time left to do so. But this question should be raised as a github issue.

-m

Soren Bjornstad

unread,
Aug 19, 2021, 8:52:35 AM8/19/21
to TiddlyWiki
Posted here, thanks everyone.

TW Tones

unread,
Aug 19, 2021, 8:55:37 AM8/19/21
to TiddlyWiki
Trimming values, fieldnames and tiddler titles makes sense, there may however be a rare occasion where this is needed, however I think the hack would be to use a special space character (that is not trimmed) if you really needed.

Of course when possible allow the default to be overridden if needed, with a conscious action to do so. Just follow the standards eg in HTML input fields.

Tones
Reply all
Reply to author
Forward
0 new messages