Hi Danielo

> The documentation says : "hasmap of tiddler fields" , not "string
> representing hasmap of tiddler fields".


The documentation is talking about the underlying JS event *object* that
describes the message. It's information that probably now belongs in the
"/dev" wiki.

The action-sendmessage widget "knows" about the "tm-new-tiddler" message
and packs the attributes that are specified into a hashmap for delivery
with the message.

There's no other, more direct way to create the hashmap in wikitext.


> If it expects a string why I can't use the text field of a Json tiddler as
> parameter?


The point about expecting a string was that JavaScript macros must return a
string.

Best wishes

Jeremy



>  El 22/10/2014 11:36, "Jeremy Ruston" <[email protected]> escribió:
>
> Hi Danielo
>>
>>>
>>> I created a small JavaScript macro to pass a  hasmap based from a  json
>>> tiddler. I attached it to this thread. Maybe it can be useful for somebody
>>> else.
>>>
>>
>> Your macro returns a hashmap and not a string as it is supposed to. I'm
>> afraid it's a bug in the core that it works.
>>
>> I've fixed it for 5.1.4:
>>
>>
>> https://github.com/Jermolene/TiddlyWiki5/commit/9a067b8dac679e100458b73815b9e5a3764db05c
>>
>> If you know the names of the fields involved then you can do something
>> like this:
>>
>> <$set currentTiddler="myJsonTemplateTiddler">
>> <$button>
>> <$action-sendmessage $message="tm-new-tiddler"
>> title={{##title}} text={{##text}} tags={{##tags}} 
>> anotherfield={{##anotherfield}}
>> />
>> New tiddler from JSON template
>> </$button>
>> </$set>
>>
>> Best wishes
>>
>> Jeremy.
>>
>>
>>
>>> It can be  used like:
>>>
>>> <$button message="tm-new-tiddler" param=<<getjson "jsonTestTiddler">>>
>>> Create new from Json</$button>
>>>
>>>
>>> Where jsonTestTiddler is a json tiddler that contains something like
>>> this:
>>>
>>> {
>>> "title":"created from JSON!",
>>> "text":"This is nice"
>>> }
>>>
>>>
>>>
>>>
>>>
>>>> Great, I'm sorry it's such a slow process :)
>>>>
>>>> Best wishes
>>>>
>>>> Jeremy
>>>>
>>>>
>>>>
>>>
>>> Slow but nice! Too much work for a single man, even with those nice
>>> collaborators.
>>>
>>
>>
>>
>> --
>> Jeremy Ruston
>> mailto:[email protected]
>>
>


-- 
Jeremy Ruston
mailto:[email protected]

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to