How to automatically add origin URL when copying tiddler from another TiddlyWiki?

60 views
Skip to first unread message

bimlas

unread,
Aug 10, 2018, 5:25:21 AM8/10/18
to TiddlyWiki
Hi!

First of all: I'm a newby in TiddlyWiki, so please be patient if I misunderstood something.

Is it possible to add a "hook" to drag-n-droping tiddler URL? I would like to add a reference (the original URL) to the Tiddy where the tiddler is copied from, it would be a compliment to the author. For example I copied http://tobibeer.github.io/tb5/#Handling%20And%20Naming%20Tiddlers to my wiki (https://bimlas.gitlab.io/#Handling%20And%20Naming%20Tiddlers) but there are no references to Tobias; my visitor could think that I wrote this note.

I imagine the "hook" as:
  • Add the URL as "origin" field to the tiddler
  • Modify the presentation of tiddlers to list this field on above/bellow the content
Is it possible? Or are there exist solution for this?

PMario

unread,
Aug 10, 2018, 7:02:36 AM8/10/18
to TiddlyWiki
On Friday, August 10, 2018 at 11:25:21 AM UTC+2, bimlas wrote:
First of all: I'm a newby in TiddlyWiki, so please be patient if I misunderstood something.

Welcome!
 
I imagine the "hook" as:
  • Add the URL as "origin" field to the tiddler
  • Modify the presentation of tiddlers to list this field on above/bellow the content
Is it possible?

It should be possible, IF the different browsers give us this information, with the drag & drop event. But it's a feature request.
 
Or are there exist solution for this?

I don't think there is an existing solution. .. At least I don't know it :)

have fun!
mario



bimlas

unread,
Aug 10, 2018, 7:43:53 AM8/10/18
to TiddlyWiki
Thanks for the answer!

Adding this field manually is acceptable, but can you please help me in modifiying the "render"? Where can I found the template (?) of tiddlers to show the "origin" above/bellow the content automatically?

bimlas

unread,
Aug 10, 2018, 8:11:46 AM8/10/18
to TiddlyWiki
Ok, just found the solution: I had to modify $:/core/ui/ViewTemplate by adding "This is a copy of {{!!origin}}" to the bottom of the div. One more question: is it possible to assign this sentence to a condition which cheks that "origin" is set or not?

bimlas

unread,
Aug 10, 2018, 8:26:49 AM8/10/18
to TiddlyWiki
Mission acomplished. :) So how to show field values on the top/bottom of the tiddler automatically?

  • Add a field to the tiddler ("origin" for example, the value is an URL)
  • Open $:/core/ui/ViewTemplate for editing
  • Add the lines above the line contains "</div>":

    <$list filter={{!!origin}}>
    This is a copy of <<currentTiddler>>
    </$list>
The sentence is written to the bottom of the tiddler only if it has "origin" field.

bimlas

unread,
Aug 10, 2018, 8:49:54 AM8/10/18
to TiddlyWiki
Just found a better way:

Edit $:/core/ui/ViewTemplate/body instead of $:/core/ui/ViewTemplate and put the code above/bellow the transclude block.

Sorry for writing often, but I'm so excited about TiddlyWiki! It's the most hackable "document manager" I've ever seen (besides Vim). The syntax is a bit weird for first but I see that it's not as bad as I thought. :)

PMario

unread,
Aug 10, 2018, 9:25:04 AM8/10/18
to tiddl...@googlegroups.com
:)

It is possible, to add new elements to the ViewTemplate, without modifying the core tiddlers.

The tiddler is built dynamically using the: $:/tags/ViewTemplate tag. So if you tag any tiddler eg: myElement with this tag, it will be automatically added to the "bottom" of the tiddler.

The order of a dynamically created list can be controlled with the tiddler "list-field".

Eg: If you want, that myElement is shown below the title, you can add a list-after field to myElement, containing the value: $:/core/ui/ViewTemplate/title

If you want to show it below the body use the value: $:/core/ui/ViewTemplate/body instead.

The existing list can be seen, if you open the $:/tags/ViewTemplate tiddler. ...

The advantage of using the list-before and list-after fields with myElement is, that you don't need to modify the existing core tiddlers. .. So if the core is updated, you will also get the new updates. ...

If you directly modify the core tiddlers, your modifications will always win.

I did add a myElement.json file, to play with, which you can download and drag & drop import to your TW.

have fun!
mario
myElement.json

bimlas

unread,
Aug 10, 2018, 2:07:10 PM8/10/18
to TiddlyWiki
Oh my God... It's full of stars... O_O

Such a great flexibility! I feel that I will fell in love with Tiddly. :D

The JSON works well, thanks for your help!

Reply all
Reply to author
Forward
0 new messages