Fields name in lowercase and with no space: Is this a bug?

78 views
Skip to first unread message

Mohammad

unread,
Jan 10, 2020, 8:41:52 AM1/10/20
to TiddlyWiki
While Tiddlywiki does not allow to add fileds with space in name or uppercase word!
but it seems the through the $action-setfield it is possible.

To reproduce this issue you may use below code

  1. go to https://tiddlywiki.com/prerelease/
  2. create a new tiddler
  3. paste the blow code!
  4. Click the button and see the results


<$button>Do it
<$action-setfield $field="Hi Test" $value=100/>
</$button>


--Mohammad




Or in 

Eric Shulman

unread,
Jan 10, 2020, 9:12:55 AM1/10/20
to TiddlyWiki
On Friday, January 10, 2020 at 5:41:52 AM UTC-8, Mohammad wrote:
While Tiddlywiki does not allow to add fileds with space in name or uppercase word!
but it seems the through the $action-setfield it is possible.

This does seem like a "hole" in the core handling.  Also, when you save and reload the file,
the upper case letters are automatically re-mapped to lowercase, but the spaces result
in TWO fields (e.g., "this field" becomes two fields, "this" and "field").

I ran into this problem myself while working on a project, and here's my "fixup" for it:
<$vars fieldName={{{ [<fieldName>split[ ]join[_]lowercase[]] }}}>
What this does is replace spaces with underscore, and change all uppercase to lowercase

For example:
<$edit-text tiddler="$:/temp/newfieldname">
<$edit-text tiddler="$:/temp/newfieldvalue">
<$button> make field
   <$vars fieldName={{{ [{$:/temp/newfieldname}split[ ]join[_]lowercase[]] }}}>
   <$action-setfield $field=<
<fieldName>> $value={{$:/temp/newfieldvalue}}/>
   </$vars>
</$button>

enjoy,
-e









PMario

unread,
Jan 10, 2020, 11:17:20 AM1/10/20
to TiddlyWiki
Hi,

IMO you can create an issue at github. It seems to be an oversight.

-m

Mohammad

unread,
Jan 10, 2020, 12:52:47 PM1/10/20
to TiddlyWiki
Added to TW-Scripts.

Many Thanks Eric,
 Yep, I used the same in Tiddler Commander! 

--Mohammad

Mohammad

unread,
Jan 10, 2020, 12:53:27 PM1/10/20
to TiddlyWiki
Hi Mario
 I create an issue in GitHub

--Mohammad

Mohammad

unread,
Jan 10, 2020, 1:00:07 PM1/10/20
to TiddlyWiki


On Friday, January 10, 2020 at 7:47:20 PM UTC+3:30, PMario wrote:

TonyM

unread,
Jan 10, 2020, 5:56:49 PM1/10/20
to TiddlyWiki
Folks

It would be nice if we had a macro to which we pass a string such as a tiddler title which returns a predictable string that complies with the field naming standard. And the reverse to some degree. The advantage over tags is you can store the relationship in both directions.

One could even imagin a scenario where every tiddler could have any other tiddler represented as a fieldname, the value which is the type of relationship to the other tiddler.

Regards
Tony

Mark S.

unread,
Jan 10, 2020, 8:37:28 PM1/10/20
to TiddlyWiki
I suppose you could view this as a feature, if you wanted an easy way to create a dozen fields at once. ;-)
Reply all
Reply to author
Forward
0 new messages