[tw5] Re: Add items to a running tiddler

2021-08-12 Thread TW Tones
Best of luck with the covid-19, 

In Australia if you get a test because you were a close or casual contact 
with Covid you have to self isolate until you get the result (24-48 hours 
max). Ee would not be allowed (with some special exceptions) to go to work 
today. Be carful.

Today I proudly got my second Astra-Zeneca after apparently the ideal 12 
weeks and I hope to get a booster from an RNA vaccine in the next 6-12 
months

Then perhaps we can visit France again, and isolate at home on our return, 
if necessary.

It is a curse to say "may you live in interesting times".

Tones


On Wednesday, 11 August 2021 at 12:46:25 UTC+10 anarchoNerd wrote:

> That's awesome, thank you. I only have a very very basic understanding of 
> javascript and want to learn, so I'm going to try and understand this as I 
> implement it, so it may be a bit. I'll let you know once I get it up and 
> running. Unfortunately both my son and I were exposed to covid over the 
> weekend and we're waiting on test results, so I'm off work and have some 
> extra time. I'll start looking at it tonight and may have it figured out by 
> tomorrow. 
>
> On Tuesday, August 10, 2021 at 5:52:41 PM UTC-7 Eric Shulman wrote:
>
>> On Tuesday, August 10, 2021 at 4:22:31 PM UTC-7 anarchoNerd wrote:
>>
>>> Here is an example of what my *Commands learned* header looks like 
>>> right now:
>>>
>> ...
>>>
>> I would like to automatically add each one to a separate tiddler (and 
>>> auto sort them if possible) so that all commands can be accessed in one 
>>> place, while also remaining in their original tiddler.
>>>
>>
>> Try this:
>> 1) First, create a tiddler (e.g., "CommandListMacros") tagged with 
>> $:/tags/Macro, containing this macro definition:
>> \define addToList(tid)
>> <$vars lf="
>> ">
>> <$button class="tc-btn-invisible" style="text-align:left;" actions="""
>><$set name="lines" filter="[[$tid$]get[text]splitregexp[\n]]">
>>   <$action-setfield $tiddler="$tid$" text={{{ 
>> [enlistsort[]join] }}} />
>>""">
>>
>> !!$tid$:
>> <>
>> <$action-setfield $tiddler="$tid$" text={{{ 
>> [{$tid$!!text}addsuffixaddsuffix] }}}/>
>> 
>> 
>> \end
>>
>> 2) Then, create a tiddler containing the following content:
>> \define commands()
>> * ''whoami'' - Prints current username.
>> * ''clear (ctrl l)'' - Clears terminal.
>> * ''adduser'' - *requires sudo* Adds new user.
>> * ''which'' - Prints directory which command binaries are being used 
>> from. 
>> \end
>>
>> <>
>>
>> Notes:
>>
>> In the macro tiddler:
>> * The addToList() macro presents a $button that shows the title of the 
>> target tiddler as a heading, followed by the list of commands
>> * $vars lf="..." defines a literal newline character
>> * Note that the blank line before the "!!$tid$" is necessary so that the 
>> heading is rendered properly using "block mode"
>> * The primary $action-setfield appends the commands to the text of the 
>> target tiddler, separated from existing content by a newline
>> * After adding the commands to the target tiddler, the $button then 
>> invokes the actions="""...""" as a secondary action
>> * This secondary action reads the contents of the now updated target 
>> tiddler, splitting them into separate lines
>> * It then enlists and sorts those lines, joins them back together, and 
>> writes it back to the target tiddler
>> * Note that the enlist filter operator removes any duplicate 
>> lines, so it won't matter if you click the addToList button multiple times
>>
>> In the content tiddler:
>> * First, define the list of commands as a local macro named "commands"
>> * Then, invoke the <> macro to display that command list with 
>> the $button surrounding it
>> * When you click on the displayed command list (or the heading), the 
>> commands are added to the target tiddler and sorted into place.  Q.E.D.
>>
>> Let me know how it goes...
>>
>> enjoy,
>> -e
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3d9b62c1-33cc-4c81-b39c-6bd6c5f68175n%40googlegroups.com.


[tw5] Re: Add items to a running tiddler

2021-08-11 Thread PMario
Hi anarchoNerd,

On Wednesday, August 11, 2021 at 4:46:25 AM UTC+2 anarchoNerd wrote:

> That's awesome, thank you. I only have a very very basic understanding of 
> javascript and want to learn,


The code that Eric posted is TiddlyWiki wikitext only. So JavaScript is 
working in the background to convert wikitext inth HTML.
 

> so I'm going to try and understand this as I implement it, so it may be a 
> bit. I'll let you know once I get it up and running.


Here are a links to the wikitext elements 

 
Eric used. 
 

> Unfortunately both my son and I were exposed to covid over the weekend and 
> we're waiting on test results, so I'm off work and have some extra time. 
> I'll start looking at it tonight and may have it figured out by tomorrow. 
>

I hope you both are well. Good luck!

-mario

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/202a8221-723f-4c70-ab50-9f191545b5a9n%40googlegroups.com.


[tw5] Re: Add items to a running tiddler

2021-08-10 Thread anarchoNerd
That's awesome, thank you. I only have a very very basic understanding of 
javascript and want to learn, so I'm going to try and understand this as I 
implement it, so it may be a bit. I'll let you know once I get it up and 
running. Unfortunately both my son and I were exposed to covid over the 
weekend and we're waiting on test results, so I'm off work and have some 
extra time. I'll start looking at it tonight and may have it figured out by 
tomorrow. 

On Tuesday, August 10, 2021 at 5:52:41 PM UTC-7 Eric Shulman wrote:

> On Tuesday, August 10, 2021 at 4:22:31 PM UTC-7 anarchoNerd wrote:
>
>> Here is an example of what my *Commands learned* header looks like right 
>> now:
>>
> ...
>>
> I would like to automatically add each one to a separate tiddler (and auto 
>> sort them if possible) so that all commands can be accessed in one place, 
>> while also remaining in their original tiddler.
>>
>
> Try this:
> 1) First, create a tiddler (e.g., "CommandListMacros") tagged with 
> $:/tags/Macro, containing this macro definition:
> \define addToList(tid)
> <$vars lf="
> ">
> <$button class="tc-btn-invisible" style="text-align:left;" actions="""
><$set name="lines" filter="[[$tid$]get[text]splitregexp[\n]]">
>   <$action-setfield $tiddler="$tid$" text={{{ 
> [enlistsort[]join] }}} />
>""">
>
> !!$tid$:
> <>
> <$action-setfield $tiddler="$tid$" text={{{ 
> [{$tid$!!text}addsuffixaddsuffix] }}}/>
> 
> 
> \end
>
> 2) Then, create a tiddler containing the following content:
> \define commands()
> * ''whoami'' - Prints current username.
> * ''clear (ctrl l)'' - Clears terminal.
> * ''adduser'' - *requires sudo* Adds new user.
> * ''which'' - Prints directory which command binaries are being used from. 
> \end
>
> <>
>
> Notes:
>
> In the macro tiddler:
> * The addToList() macro presents a $button that shows the title of the 
> target tiddler as a heading, followed by the list of commands
> * $vars lf="..." defines a literal newline character
> * Note that the blank line before the "!!$tid$" is necessary so that the 
> heading is rendered properly using "block mode"
> * The primary $action-setfield appends the commands to the text of the 
> target tiddler, separated from existing content by a newline
> * After adding the commands to the target tiddler, the $button then 
> invokes the actions="""...""" as a secondary action
> * This secondary action reads the contents of the now updated target 
> tiddler, splitting them into separate lines
> * It then enlists and sorts those lines, joins them back together, and 
> writes it back to the target tiddler
> * Note that the enlist filter operator removes any duplicate 
> lines, so it won't matter if you click the addToList button multiple times
>
> In the content tiddler:
> * First, define the list of commands as a local macro named "commands"
> * Then, invoke the <> macro to display that command list with 
> the $button surrounding it
> * When you click on the displayed command list (or the heading), the 
> commands are added to the target tiddler and sorted into place.  Q.E.D.
>
> Let me know how it goes...
>
> enjoy,
> -e
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/740a8902-e13d-4233-b774-0fabdfd24c18n%40googlegroups.com.


[tw5] Re: Add items to a running tiddler

2021-08-10 Thread Eric Shulman
On Tuesday, August 10, 2021 at 4:22:31 PM UTC-7 anarchoNerd wrote:

> Here is an example of what my *Commands learned* header looks like right 
> now:
> ...
>
I would like to automatically add each one to a separate tiddler (and auto 
> sort them if possible) so that all commands can be accessed in one place, 
> while also remaining in their original tiddler.
>

Try this:
1) First, create a tiddler (e.g., "CommandListMacros") tagged with 
$:/tags/Macro, containing this macro definition:
\define addToList(tid)
<$vars lf="
">
<$button class="tc-btn-invisible" style="text-align:left;" actions="""
   <$set name="lines" filter="[[$tid$]get[text]splitregexp[\n]]">
  <$action-setfield $tiddler="$tid$" text={{{ 
[enlistsort[]join] }}} />
   """>

!!$tid$:
<>
<$action-setfield $tiddler="$tid$" text={{{ 
[{$tid$!!text}addsuffixaddsuffix] }}}/>


\end

2) Then, create a tiddler containing the following content:
\define commands()
* ''whoami'' - Prints current username.
* ''clear (ctrl l)'' - Clears terminal.
* ''adduser'' - *requires sudo* Adds new user.
* ''which'' - Prints directory which command binaries are being used from. 
\end

<>

Notes:

In the macro tiddler:
* The addToList() macro presents a $button that shows the title of the 
target tiddler as a heading, followed by the list of commands
* $vars lf="..." defines a literal newline character
* Note that the blank line before the "!!$tid$" is necessary so that the 
heading is rendered properly using "block mode"
* The primary $action-setfield appends the commands to the text of the 
target tiddler, separated from existing content by a newline
* After adding the commands to the target tiddler, the $button then invokes 
the actions="""...""" as a secondary action
* This secondary action reads the contents of the now updated target 
tiddler, splitting them into separate lines
* It then enlists and sorts those lines, joins them back together, and 
writes it back to the target tiddler
* Note that the enlist filter operator removes any duplicate lines, 
so it won't matter if you click the addToList button multiple times

In the content tiddler:
* First, define the list of commands as a local macro named "commands"
* Then, invoke the <> macro to display that command list with 
the $button surrounding it
* When you click on the displayed command list (or the heading), the 
commands are added to the target tiddler and sorted into place.  Q.E.D.

Let me know how it goes...

enjoy,
-e

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/21c4e57d-a631-4018-83be-75deecacfc72n%40googlegroups.com.


[tw5] Re: Add items to a running tiddler

2021-08-10 Thread anarchoNerd
Hi Tones,

Thank you for your reply. 

Here is an example of what my *Commands learned* header looks like right 
now:

*Commands learned:*


   - *whoami *- Prints current username.
   - *clear *(ctrl l) - Clears terminal.
   - *adduser *- **requires sudo* *Adds new user.
   - *which *- Prints directory which command binaries are being used from. 

The list goes on, but I think you can gather the idea from this. As of now, 
they are just living inside of the tiddlers in which they were recorded. I 
would like to automatically add each one to a separate tiddler (and auto 
sort them if possible) so that all commands can be accessed in one place, 
while also remaining in their original tiddler.

I have also created a *Glossary *tiddler for recording important 
definitions. For that, I have simply been using this format [[*new 
term*|Glossary]] 
as a link to the *Glossary *tiddler and then adding them manually there. I 
think this is what you are referring to in your reply, but I'm not certain. 
If so, this doesn't really solve the problem of having to manually add them 
to the tiddler. 

On Tuesday, August 10, 2021 at 3:55:17 PM UTC-7 TW Tones wrote:

> anarchoNerd
>
> No plugin needed, much can be done just with wikitext, typically with a 
> button to trigger the activity.
>
> My I suggest you not get too hung up on appending text to a tiddler, when 
> additional tiddlers can be associated with the parent tiddler, see new here 
> button, or streams etc... appending can be done later with a button, just 
> set the text field of a tiddler to the text field + the new text. 
>
> Perhaps you can describe your desired workflow a little more.
>
> Regards
> Tones
>
> On Wednesday, 11 August 2021 at 08:41:13 UTC+10 anarchoNerd wrote:
>
>> Is there a plugin that will allow me to place some code before an item or 
>> a list of items that will append the text to an already existing tiddler? 
>> As an example, I am currently taking a YouTube course on the Linux command 
>> line and am creating a tiddler for each video. One of my note headers is 
>> "Commands learned", and I would like to have this list of commands placed 
>> into a tiddler of the same name without having to manually add them. 
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a1916a61-d4d2-426c-be1e-4ba9b9f60e18n%40googlegroups.com.


[tw5] Re: Add items to a running tiddler

2021-08-10 Thread TW Tones
anarchoNerd

No plugin needed, much can be done just with wikitext, typically with a 
button to trigger the activity.

My I suggest you not get too hung up on appending text to a tiddler, when 
additional tiddlers can be associated with the parent tiddler, see new here 
button, or streams etc... appending can be done later with a button, just 
set the text field of a tiddler to the text field + the new text. 

Perhaps you can describe your desired workflow a little more.

Regards
Tones

On Wednesday, 11 August 2021 at 08:41:13 UTC+10 anarchoNerd wrote:

> Is there a plugin that will allow me to place some code before an item or 
> a list of items that will append the text to an already existing tiddler? 
> As an example, I am currently taking a YouTube course on the Linux command 
> line and am creating a tiddler for each video. One of my note headers is 
> "Commands learned", and I would like to have this list of commands placed 
> into a tiddler of the same name without having to manually add them. 

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e4e378ab-d1cd-4ccc-8230-82de1602f638n%40googlegroups.com.