[TW5] Appending (Rather than Overwriting) Text into a Tiddler

185 views
Skip to first unread message

Zaphod Beeblebrox

unread,
Jul 29, 2016, 11:05:58 AM7/29/16
to TiddlyWiki
It's me again.

Having much success with overriding my users' $:/ControlPanel/DefaultTiddlers and forcing my 'update' tiddlers to appear after import, but apparently I wasn't forward-thinking enough.  While discussing it with one such user a few days ago, he brought up the point that he had several tiddlers that he liked to have appear every time he loads his TW, and if I 'injected' my new updates it would overwrite what he had there before.

So, is there a way to append the updated tiddler titles to the (beginning or end) of any titles that already exist in Defaulttiddlers ?

After a two-day search of both the group and tiddlywiki.com for 'append-like' information all I've found of relevance.is this bit of code from Jed Carty (originally from someone else I believe, but I can't find the original post, now...):

\define thisAction()
<$action-setfield $tiddler=HelloThere text="""$(HelloThereText)$$(LearningText)$"""/>
\end

<$set name=HelloThereText value={{HelloThere}}>
<$set name=LearningText value={{Learning}}>
<$button>Test
<<thisAction>>
</$button>
</
$set>
</$set>

This seems to work, but what I really need is not to read from another tiddler, but something in the form of a tiddler that the user could open, and perhaps click a button, and have a predefined list of tiddler titles (contained in this same tiddler) that would be appended to their DefaultTiddlers file.

Ideally, it would also have the capacity for multiple tiddler titles, at least 10(?).
Also, there would need to be a way of including carriage returns so that each title creates a new line for itself (\n perhaps?)

Any ideas?

--Zaphod

Mark S.

unread,
Jul 29, 2016, 12:18:56 PM7/29/16
to TiddlyWiki
I don't follow your use case. Are both you and your users saving to the same TW? How are you overriding your users DefaultTiddlers?

Why do you need to put a carriage return after each item, since it's all in the DefaultTiddlers which isn't usually used for viewing lists?

Do your import tiddlers have anything in common? In particular, a tag? Then you could just add this to the bottom of the DefaultTiddlers:

[tag[MyImportedTiddlers]]

and your imported tiddlers would be automatically opened when the TW is opened.

Good luck!
Mark

Zaphod Beeblebrox

unread,
Jul 29, 2016, 7:17:11 PM7/29/16
to TiddlyWiki


On Friday, July 29, 2016 at 12:18:56 PM UTC-4, Mark S. wrote:
I don't follow your use case. Are both you and your users saving to the same TW? How are you overriding your users DefaultTiddlers?

For each 'update,' I'm planning on sending out a complete TW, with all new posts (tiddlers) included (for those that don't wish to keep a TW around), and also a .json file containing just the new posts since the last update, for the folks who will be maintaining their own local TW.

The method I was going to use was just to include a $:/DefaultTiddlers tiddler containing the titles of the updated posts, so that they would automatically open upon a refresh of the TW after importing the .json file.  But after talking to my friend I see that would not work as well as I thought...


Why do you need to put a carriage return after each item, since it's all in the DefaultTiddlers which isn't usually used for viewing lists?

I thought the title of each tiddler in the file needed to be on its own line?  eg:

[[tiddler1]]
[[tiddler2]]
[[tiddler3]]



Do your import tiddlers have anything in common? In particular, a tag? Then you could just add this to the bottom of the DefaultTiddlers:

[tag[MyImportedTiddlers]]

and your imported tiddlers would be automatically opened when the TW is opened.

That is a very good idea, and one that I hadn't considered at all...

But, no, they don't ALL share a common tag - MOST are tagged "Movie", some "Short Film" and then there's a handful of other tags...

Plus, if I did a match on some tag within the DefaultTiddlers file, ALL tiddlers with that tag would attempt to open, including others that were already in the users' TW...

If we were dealing with even moderately tech-savvy folks, it wouldn't be such a problem, but trust me, the majority of my users do well to know how to turn their computers on :-P - Even so, doing it the way I have envisioned, I will still have to write up detailed instructions for them on how to go into ControlPanel and delete the 'updated' tiddler titles after they've viewed and digested them.

--Zaphod

Mark S.

unread,
Jul 29, 2016, 9:09:15 PM7/29/16
to TiddlyWiki
Hi Z

My quick test suggests that the names don't have to be separated by carriage returns. Try it and see.

The reason it matters is that I think (not sure) it might be possible to do this with the

ActionListopsWidget operator without any extra-TW programming IF carriage returns are not required.


Maybe your imported tiddlers could be marked with a tag like IMPORT. Then you could use the tag filter, and all your users would have to do is uncheck the special IMPORT tag when they want to clear the decks. Or a simple button in the sidebar could wipe out the IMPORT tag with a single click.


Hmm ... If your users are so unsavvy, how do they manage to import the .JSON in the first place?


Mark

PMario

unread,
Jul 30, 2016, 10:29:48 AM7/30/16
to tiddl...@googlegroups.com
Hi Zaphod,

You could tell your users, that they should just add a tag eg: default to the tiddlers, they want to keep.
In your json file, that overwrites the Default tiddlers just add [tag[default]] at the beginning or the end. -> everyone will be happy :) 
You can overwrite the default setting. You just have to remember that you need to add one extra line.

TW is based on many conventions. This is one for you and your users.

just a thought.
mario

Zaphod Beeblebrox

unread,
Aug 11, 2016, 1:11:17 AM8/11/16
to TiddlyWiki
So sorry for the long delay in replying, but I've had to be out of town (and AFK) for some days...

@Mark S.


Hi Z

My quick test suggests that the names don't have to be separated by carriage returns. Try it and see.

The reason it matters is that I think (not sure) it might be possible to do this with the

ActionListopsWidget operator without any extra-TW programming IF carriage returns are not required.


Thank You for looking into this for me :)

I may delve into that ActionListopsWidget later.

Maybe your imported tiddlers could be marked with a tag like IMPORT. Then you could use the tag filter, and all your users would have to do is uncheck the special IMPORT tag when they want to clear the decks. Or a simple button in the sidebar could wipe out the IMPORT tag with a single click.


I like that IMPORT idea, but I especially like the button in the SideBar to wipe the tag out...
 

Hmm ... If your users are so unsavvy, how do they manage to import the .JSON in the first place?

 
Heh heh - Trust me, some had the greatest amount of trouble (and needed detailed instructions) to be able to copy download links (from my former static-page site) and paste them into their download managers :&#222;

With the method I came up with, all they have to do is drag & drop the .JSON file, click "Import", then hit F5 to reload the TW (yet I still anticipate hand-holding will be necessary for a few).


@PMario
 
Thank You very much for this 'thought,' Mario!

I really like this idea a lot, and will probably end up going with it in the long run :)

--Zaphod
Reply all
Reply to author
Forward
0 new messages