Template for set field?

326 views
Skip to first unread message

Ste Wilson

unread,
Jul 29, 2018, 9:16:21 AM7/29/18
to tiddl...@googlegroups.com
I'm trying to set some user input between latex markers so the user doesn't have to put in the $$.

So far I have:

\define mylatex(a)
<$latex text="{$a$}" displayMode="true"></$latex>
\end

<$button>
Work...Please work
<$action-setfield $tiddler="Newtid" $field="test"
$value=''<$macrocall $name="mylatex" a={{lddata}}> /''
</$button>

So what I'd want in field test is for example <latex>3+5</latex> or $$3+4$$

The macro will render a latex string in the text field without having to add anything.
I just don't know how to get that Wiki text into a different field.


Any help as always appreciated.

Ste Wilson

unread,
Jul 29, 2018, 9:21:56 AM7/29/18
to TiddlyWiki

For those of you on e-mail...Original post updated as I pressed the wrong button while typing it.

TonyM

unread,
Jul 29, 2018, 8:34:34 PM7/29/18
to TiddlyWiki

Note 1: The button label lmst proceed the </$button>

<$button>

<$action-setfield $tiddler="Newtid" $field="test" 
$value=''<$macrocall $name="mylatex" a={{lddata}}> /''
Work...Please work
</$button>

Ste Wilson

unread,
Jul 30, 2018, 6:11:32 AM7/30/18
to TiddlyWiki
Hi Tony
Is that just convention? Didn't seem to make any difference as long as its outside the action widgets.

TonyM

unread,
Jul 30, 2018, 10:17:11 AM7/30/18
to TiddlyWiki
I would need to check, I thought it was more than convention and had a problem when not doing so, but I stand to be corrected.

Tony

Ste Wilson

unread,
Aug 1, 2018, 4:09:49 AM8/1/18
to TiddlyWiki
Bump...
How can I use the set field widget to put user entered text into $$text here$$ without the user having to do it manualy?

FrD

unread,
Aug 1, 2018, 4:30:12 AM8/1/18
to TiddlyWiki
Hi,

I made a test.
I create a tiddler named "test a" containing :

enter text : <$edit-text tiddler="test b" field="input"/>

In a tiddler called "test b" I put the following code :

\define concatlatexfield() $${{!!input}}$$

\define actions()
<$wikify name="latextext" text=<<concatlatexfield>>>
<$action-setfield inputlatex=<<latextext>>/>
</
$wikify>
\end

<$button actions=<<actions>>>to latex</$button>

input : <$view field="input"/
>

inputlatex
: <$view field="inputlatex"/>

The content of the field "inputlatex" seems OK. Is that what you want ?

Regards

FrD

Ste Wilson

unread,
Aug 1, 2018, 7:49:16 AM8/1/18
to TiddlyWiki
Thanks for the response.
It looks spot on!
Thank you!

Ste Wilson

unread,
Aug 9, 2018, 7:11:32 AM8/9/18
to TiddlyWiki

Hmm, possible bug!

The above code from FrD works fine in new tiddliwiki and indeed works on tiddlywiki.com however id doesn't work in my other wikis.
It must be a plugin thought I.
Starting with a blank wiki i tested then installed the katex plugin, at which point it fails to send anything to the output field!

Any thoughts?

Stephen

Ste Wilson

unread,
Aug 9, 2018, 12:21:58 PM8/9/18
to TiddlyWiki
Update,
it seems to be the katex plugin causing the problem as, instead of the variable being placed in the field between double brackets so it can be displayed by the katex plugin the field contains ParseError: KaTeX parse error: $ within math mode.
even thought the data going into the field is valid for Katex.

Get the same error with \define convalue() $${{$:/state/NewTiddlerForm!!value}}$$ as \define convalue() <$latex text="{{$:/state/NewTiddlerForm!!value}}"></$latex>

My code here:
\define convalue() <$latex text="{{$:/state/NewTiddlerForm!!value}}"></$latex>

\define actions()
<$wikify name="valuetext" text=<<convalue>>>
<$action-setfield $tiddler="$:/state/NewTiddlerForm" $field="valuetext" $value=<<valuetext>> />
</$wikify>
\end


!Title
<$edit-text class='tc-edit-texteditor' tiddler='$:/state/NewTiddlerForm' field='name_temp' placeholder='Life the Universe and Everything' /><br>

!!Value of Constant

<$edit-text class='tc-edit-texteditor' tiddler='$:/state/NewTiddlerForm' field='value'/><br>

<$button>Create Tiddler
<<actions>>
<$action-setfield $tiddler={{$:/state/NewTiddlerForm!!name_temp}} 
text={{$:/state/NewTiddlerForm!!text}} 
value={{$:/state/NewTiddlerForm!!valuetext}}/>
<$action-navigate $to={{$:/state/NewTiddlerForm!!name_temp}}/>
<$action-setfield $tiddler='$:/state/NewTiddlerForm' name_temp='' text='' description='' tags=''/>
</$button>

Jeremy Ruston

unread,
Aug 9, 2018, 1:27:43 PM8/9/18
to tiddl...@googlegroups.com
Hi Stephen

The confusing thing here is that we are manipulating wikitext that will be stored in a tiddler and rendered later. Here’s one version that works, but I’m not sure it’s exactly what you want:

<$tiddler tiddler="$:/state/NewTiddlerForm">

!Title

<$edit-text class='tc-edit-texteditor' field='name_temp' placeholder='Life the Universe and Everything' /><br>

!!Value of Constant

<$edit-text class='tc-edit-texteditor' field='value'/>

<$button>
Create Tiddler
<$set name="valuetext" value={{{ [{!!value}addprefix[<$latex text="""]addsuffix["""></$latex>]] }}}>
<$action-setfield $tiddler={{!!name_temp}} text=<<valuetext>> value={{!!value}}/>
</$set>
<$action-navigate $to={{!!name_temp}}/>
</$button>

</$tiddler>


Notes:

* If you’re referring to the same tiddler many times, it’s often helpful to use the <$tiddler> widget to set the currentTiddler, and then be able to take advantage of defaults and omit the tiddler title from widgets like the edit widget
* We use a filtered transclusion with the set widget to create the text value for the new tiddler by taking the value entered by the user and adding a prefix and suffix

Best wishes

Jeremy.


--
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 post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/fae270d4-c9b7-4e4a-92f4-5ea09f750e17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ste Wilson

unread,
Aug 10, 2018, 2:27:49 PM8/10/18
to TiddlyWiki
Wow, that makes things more simple!
I can definetlty use that.
Thank you.

Mohammad

unread,
Aug 11, 2018, 11:37:20 PM8/11/18
to tiddl...@googlegroups.com
Jeremy 

The tiddler widget  (https://tiddlywiki.com/#TiddlerWidget) has several other features like tiddlerTagClasses 
is it possible to give an example to see how they can be used?

Mohammad

PMario

unread,
Aug 12, 2018, 4:32:57 AM8/12/18
to TiddlyWiki

Mohammad

unread,
Aug 12, 2018, 1:29:38 PM8/12/18
to tiddl...@googlegroups.com
Thanks Mario.

So if I defined some css in another tiddler tagged with $:/tags/Stylesheet then can I use them with tiddlerTagClasses?

-Mohammad

PMario

unread,
Aug 13, 2018, 4:37:13 AM8/13/18
to TiddlyWiki
On Sunday, August 12, 2018 at 7:29:38 PM UTC+2, Mohammad wrote:
So if I defined some css in another tiddler tagged with $:/tags/Stylesheet then can I use them with tiddlerTagClasses?

tiddlerTagClasses is an internal variable, that is set by the core. ... You should __not__ mess with it!!

You can use the mechanisms described in the docs. ... There are several possibilities. You should use the 1 that meets your needs best.

-m

Ste Wilson

unread,
Aug 15, 2018, 7:39:09 PM8/15/18
to TiddlyWiki
Hi Jeremy (and other wonderful peeps),

Finally had time to play with your code.
I need to expand it to accept output multiple variables so my button mow looks like

<$button>
Create Tiddler

<$set
 name="valuetext" value={{{ [{!!value_temp}addprefix[<$latex
text="]addsuffix["displayMode="true"></$latex>]] }}} >
<$set
 name="constext" value={{{ [{!!const_temp}addprefix[<$latex
text="]addsuffix["displayMode="true"></$latex>]] }}} >
<$set
 name="unittext" value={{{ [{!!unit_temp}addprefix[<$latex
text="]addsuffix["displayMode="true"></$latex>]] }}} >
<$action-setfield $tiddler={{!!name_temp}}
text={{!!text_temp}}
value=<
<valuetext>>
variablelatex=<
<constext>>
unitlatex=<
<unittext>>
tags='constant'/>

</$set>
<$action-navigate $to={{!!name_temp}}/>

</$button>

</$tiddler>

All works as expected apart from the button which now reads Create Tiddler </$button> </$tiddler>

I suspect I've missed a bracket somewhere, but my attempts to resolve the matter end in only the final field being created.

Stephen


On Sunday, 29 July 2018 14:16:21 UTC+1, Ste Wilson wrote:

Mark S.

unread,
Aug 15, 2018, 7:54:29 PM8/15/18
to TiddlyWiki
I think you forgot to paste a "<$tiddler>" widget at the top?

You have 3 set widget tags, but only one </$set> matching tag -- that will throw things off.

-- Mark

Eric Shulman

unread,
Aug 15, 2018, 11:17:02 PM8/15/18
to TiddlyWiki
On Wednesday, August 15, 2018 at 4:39:09 PM UTC-7, Ste Wilson wrote:
All works as expected apart from the button which now reads Create Tiddler </$button> </$tiddler>
I suspect I've missed a bracket somewhere, but my attempts to resolve the matter end in only the final field being created.

You have three <$set> widgets, but only ONE matching </$set>... a two more and it should work.

-e

Ste Wilson

unread,
Aug 16, 2018, 2:49:07 AM8/16/18
to TiddlyWiki
Brliant!
</$set></$set></$set> does the job. Thanks!
Reply all
Reply to author
Forward
0 new messages