Discussion:
[tw5] Appending text to a tiddler
Scott Kingery
2018-12-06 17:45:40 UTC
Permalink
I'm trying to build a button to append text to a tiddler. Thing is, I want
the name of the tiddler to by dynamic. Stephan has the example I'm building
on here: http://skeeve.tiddlyspot.com/ . That code is:

\define appendButton(now, add)
<$button set="Target" setTo="$now$$add$">append</$button>
\end

<$edit-text tiddler="$:/temp/Append"/>
<$macrocall $name="appendButton" now={{Target}} add={{$:/temp/Append}}/>

---
{{Target}}

That appends a tiddler called Target.

My attempt is almost there. I'm able to dynamically set the the tiddler I
want to send the text to and that bit is working but it isn't appending.
I'm trying to figure out how to dynamically set the now={{Target}} bit.

My non working attempt is here.
\define appendButton(target, now, add)
<$button set=$target$ setTo="$now$$add$<br>">append</$button>
\end

<$wikify name="thisproj" text={{!!project}}>
<$wikify name="projnotes" text='<<thisproj>> Notes'>

{{||$:/timer}}

<$edit-text tiddler="$:/temp/Append"/>
<$macrocall $name="appendButton" target="<<projnotes>>" now=<<projnotes>>
add={{$:/temp/Append}}/>

Any ideas appreciated.

Thanks,
Scott
--
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 ***@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/d80cc64e-7c72-473b-b215-d895195d3351%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Scott Kingery
2018-12-06 23:59:21 UTC
Permalink
Decided to switch things up and got closer to my goal.
Made a macro:
\define updtTID(param:"", btn-caption:"Add a Note", color:"#8058A5")
<$button style="color:$color$; fill:$color$; margin-bottom:3px;">
{{$:/core/images/new-button}} $btn-caption$


<$wikify name="master" text="{{$param$}}{{$:/temp/Append}}">
<$action-setfield $tiddler="$param$" text=<<master>>/>
<$action-setfield $tiddler="$:/temp/Append" text=""/>
</$wikify>
</$button>
\end

Then calling this macro:
<$wikify name="thisproj" text={{!!project}}>
<$wikify name="projnotes" text='<<thisproj>> Notes'>


<$edit-text tiddler="$:/temp/Append"/>


<<updtTID param:$(projnotes)$>>

Now the only thing missing is a way to add a <br> to the end each time the
text is appended.
--
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 ***@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/270db3c8-cb86-4290-a7c8-0e5df8bee1f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mohammad
2018-12-07 07:12:21 UTC
Permalink
Hello Scott!
This is not a very good solution, but works for you!

Change the line

<$wikify name="master" text="{{$param$}}{{$:/temp/Append}}">



with


<$wikify name="master" text="{{$param$}}&#10;&#10;{{$:/temp/Append}}">


--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 post to this group, send email to ***@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/23b6d75c-c822-401f-ac82-5bcb9892d9d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mohammad
2018-12-07 07:26:39 UTC
Permalink
Scott,
The problem with your solution is: Some wikitext formatting in your main
tiddler or $:/temp/Append
will not work and every time you use updtTID macro those formatting will
be removed or wikified. For example try to append

This is a ''Text''.

Or

```
y=sx
```

This is another Test. `y` is a variable.



And if for example your main tiddler contains


This text has been transcluded from`test`:{{test}}

After appending, you will not have {{test}} but its wikified value has been
inserted!


-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 post to this group, send email to ***@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/c447d8f0-3dfe-4e09-bf41-98e3bae92525%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Scott Kingery
2018-12-07 18:28:48 UTC
Permalink
Mohammad,
Thanks for the tip on using the code for <br>. It works great.

You make a good point about wikifying the text I am passing. It may not be
a big problem for the simple case I have for this current project but it
does make sense to consider changing my solution.
Post by Mohammad
Scott,
The problem with your solution is: Some wikitext formatting in your main
tiddler or $:/temp/Append
will not work and every time you use updtTID macro those formatting
will be removed or wikified. For example try to append
This is a ''Text''.
Or
```
y=sx
```
This is another Test. `y` is a variable.
And if for example your main tiddler contains
This text has been transcluded from`test`:{{test}}
After appending, you will not have {{test}} but its wikified value has
been inserted!
-Mohammad
--
You received this message because you are subscribed to a topic in the
Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/tiddlywiki/XSnQsePRSVU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
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/c447d8f0-3dfe-4e09-bf41-98e3bae92525%40googlegroups.com
<https://groups.google.com/d/msgid/tiddlywiki/c447d8f0-3dfe-4e09-bf41-98e3bae92525%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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 ***@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/CAGUDtYEiV8a865KmX21UAHMc-PZdUBH5%3Dm_hb45XTsmAiqzbWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...