[TW5] How store the result, not the macro+transclusion call?

105 views
Skip to first unread message

Mat

unread,
Jan 19, 2016, 7:45:17 AM1/19/16
to TiddlyWiki
Maybe the thread "Force wikification of text" is the same question, I can't tell? Anyway;

I've almost successfully created a plugin to check+get updated plugins/bundles/tiddlers.

I need to store the actual result from evaluating a macro and a transclusion into a field. What happens instead is that the invocation+transclusion themselves are stored.

Specifically it is the intended string resulting from 

<<location 'origin'>>/#:{{Fetch_main!!plugin}}

(where the location macro is BuggyJ's macro to sniff out the current URL of the TW).

The context is this

\define makesource() <<location 'origin'>>/#:{{Fetch_main!!plugin}}

...
<$set name="pluginsource" filter="[{Fetch_main!!plugin}get[source]]" emptyValue=<<makesource>> >
<$action-setfield $tiddler="Fetch_main" $field="pluginsource" $value=<<pluginsource>> /
>
</$set>


What to do? Thank you!

<:-)

Tobias Beer

unread,
Jan 19, 2016, 9:33:38 AM1/19/16
to TiddlyWiki
Hi Mat,
 
What to do? Thank you!

Try setting more variables, using the vars widget,
and then have the macro only do textual substitution:

\define makesource() $(origin)$/#:$(fetch)$

...

<vars origin=<<location origin>> fetch={{Fetch_main!!plugin}}>
<$set name="pluginsource" filter="[<fetch>get[source]]" emptyValue=<<makesource>> >

<$action-setfield $tiddler="Fetch_main" $field="pluginsource" $value=<<pluginsource>> />
</
$set>
</$vars>

Best wishes,

Tobias.

Jed Carty

unread,
Jan 20, 2016, 7:32:35 AM1/20/16
to TiddlyWiki
Now I am excited. This sounds like the final piece for simple inter-wiki communication. With this and your idea of passing parameters to a wiki via url we may be able to allow a wiki to fetch custom bundles from another wiki for things like sharing blog comments.

Mat

unread,
Jan 20, 2016, 8:48:56 AM1/20/16
to tiddl...@googlegroups.com

Try setting more variables, using the vars widget,
and then have the macro only do textual substitution:


@Tobias - thank you! That does the trick. But why actualy? Are macros not intended to be used when evaluating stuff? Is there some kind of rule I should know about?

<:-)

Tobias Beer

unread,
Jan 20, 2016, 9:22:43 AM1/20/16
to TiddlyWiki
Hi Mat,
 
@Tobias - thank you! That does the trick. But why actualy? Are macros not intended to be used when evaluating stuff? Is there some kind of rule I should know about?

Indeed. The key thing to remember about macros is that they do one thing and one thing only: textual substitution. Everything else, especially wikification, is done "after the fact" ...or "before the fact" in case of the macrocall widget.

Best wishes,

Tobias. 

Mat

unread,
Jan 20, 2016, 9:32:25 AM1/20/16
to TiddlyWiki
@Jed


Now I am excited. This sounds like the final piece for simple inter-wiki communication. With this and your idea of passing parameters to a wiki via url we may be able to allow a wiki to fetch custom bundles from another wiki for things like sharing blog comments.

I'm afraid the "fetching" I refer to here merely is to the 2-step import thing I discovered some week ago, i.e that you can manually circumvent iframe restrictions by first dragging a tiddler title/bundle/plugin from the iframe up to your bookmarksfield. And then from the bookmarksfield into your TW for import.

...and so far, other than passing a filter via url, I don't know what other parameters are possible to pass. I'm looking into javascript injection and XSS (Cross Site Scripting) but... well, it's as fruitful as you'd expect.

BUT please elaborate a bit on what you're thinking, Jed. What woudl be required?

And your comment gave me an idea, regarding bundles. I'll post a separate thread on it in  a moment.

<:-)


Jed Carty

unread,
Jan 20, 2016, 12:35:34 PM1/20/16
to TiddlyWiki
Jeremy had suggested a very similar situation a while ago when talking about federation, but now we have some more pieces about how we could make it work.

Using tiddlywikis as blogs as an example situation:

We each have our own wiki hosted where ever we want and we have some agreed-upon convention for tagging posts. If you want to follow a wiki you import a tiddler that contains metadata about that wiki (like url, author, etc.). We make a button that when you click it will, using the URL control, create a bundle from tiddlers on the followed wiki using some filter (like all new posts, all comments tagged with a specific post, etc.), you then import this bundle into your own wiki and unpack it. If we can automate this so you just open your wiki and click on a button to do all of the fetching and importing that would be nice, if we need to have some intermediate steps for now it still works.

In this situation if you post something and I want to comment on it I would import your post into my wiki and leave the comment on it there and then when you check for updates from my wiki it would see that comment and import it to the correct place in your wiki. All of this would take some consensus on tagging, and you may just make a comment tiddler and tag it instead of importing the original post or something like that. I think that importing the original post would work best but we could just have a link to the original post or something similar.

In this case a site like mine that can take outside comments could be used as a bridge to comment on wikis that don't have access to a server.

To we have everything to make a minimally working version of this now, but to make it work well we should make a way to create the bundles via url and a way to import the bundle without having to open up the second wiki.

There are a lot of things to decide about what conventions to use for this and I am not sure how reasonable making the bundles using url parameters and then importing the result automatically would be.

But that is what all of this made me think of.

Mat

unread,
Jan 21, 2016, 9:46:04 AM1/21/16
to TiddlyWiki
Jed,

I started replying but it quickly diverged in all directions and got too complex so I'm keeping it very short instead. I really like your idea and the blog example is a really good application!!!

I'm thinking there are two parallel solutions for something like a blog;
  • your outlined ideas
  • simply an iframed based solution without importing: i.e a viewtemplate under each blogpost that shows an iframe for each src that the blogger has in a whitelist, e.g src="foobar.tiddlyspot.com/#:[tag[@Jed]] [tag<currentTiddler>]" - it could even be Mr Foobar who provides the src link for this, via his own site. This is doable today already. And one could attach an eventual import feature to pull in comments selectively.
<:-)

Reply all
Reply to author
Forward
0 new messages