Procedure calls

All, I’ve started playing around with procedures today and I have a couple of questions.

First, I’ve noticed that the system tag $:/tags/Global doesn’t work, but the system tag $:/tags/Global/View does. I must not be understanding the differences between the two.

Also, I’m having trouble passing tiddler fields as parameters when I do a procedure call. How do I do a procedure call using one of the tiddlers fields as a paremeter value? I’ve tried the following and none of the work:

date:{{!!mydate}}
date:{{{ [<currentTiddler>get[mydate]] }}}
date:<<thedate>> where thedate is defined as mydate with a let widget

It works fine when I used and explicit date in quotes such as date:“1886-05-20”, but not the field. What am I missing?

[Edited] by TW_Tones, to place backticks around code

You’ll have to explain what you mean by “doesn’t work”. $:/tags/Global seems to work OK for me. It’s best if you have an example site.

I think for passing transclusions and filtered transclusions, you can use the transclude widget:

<$transclude $variable="my-procedure"  date={{{ [all[current]get[mydate]] }}} />

But it’s possible there’s some new wikitext method that I’ve missed.

Thanks @Mark_S. I’ll try that.

By not working, I meant that the procedure wasn’t seen by the tiddler calling it unless I did an \import at the top of that tiddler.

It does work at tiddlywiki.com

Hmm. I’m going to have to play around some to understand why it doesn’t for me. Interesting. Thanks.

For some reason if I tag the tiddler that contains my procedure with $:/tags/Global or $:/tags/Global/View/Body, the procedure isn’t found in the tiddler I’m trying to call it from.

Only tagging it with $:/tags/Global/View will it work.

Any suggestions on how to troubleshoot this? I’m working in my Kansas Railroad TW with copyrighted content so I can’t share it unfortunately.

Edit: I confirmed that it works properly at tiddlywiki.com. There’s something about my file that is amiss.

You probably have some modified PageTemplate or ViewTemplate elements, that only use the “old” tags.

Try to use $:/tags/Macro instead of $:/tags/Global. It does the exact same thing.
Do not tag them with both.

1 Like

Yeah, $:/tags/Macro worked just fine.

I don’t have any PageTemplates, but I do have some ViewTemplates. What would I look for there?

To find your overwritten shadow tiddlers, you can open the ControlPanel → Info → Basics tab and

scroll down to: “Number of overridden shadow tiddlers” and click the search-icon. It will show a list in the AdvancedSearch → Filters panel.

If there are any templates, you may have a closer look, what you changed and what may need an update to v5.3.x

Every tiddler has a preview option: differences from shadow (if any), which you can use to see the differences.

I can think of two other ways this could be happening;

  • You are using a cascade that displays the tiddler diffently and does not import the macros
  • Something is overwriting the macro with an empty value

@TW_Tones,

I’m not using any cascades yet and there is no other macro, variable or tiddler with the same name.

I get the same behavior in tiddlers with a custom ViewTemplate and without.

@pmario,

I have 101 overwritten shadow tiddlers. If it is an overwritten shadow tiddler causing this, how can I narrow down that list?

In these examples I can see you are using the : which must mean you are using the <<procedurname>> or short form.

  • In the short form the above are not even valid in the legacy macro’s
  • To pass the values you suggested;
    • You must use the macrocall widget for macros /
    • or the <$transclude $variable="my-procedure" date=... form for procedures

I too have being investigating procedures;

From a functional perspective, it appears proceedures are somewhat simple and even more restrictive;

  • First you must
    • Use the new pragma
    • Call with the cumbersom
      • <$transclude $variable="my-procedure" rather than;
      • <$macrocall $name="my-procedure"
  • You gain the automatic transfer of parameters to variables
    • But you could do this before with a set/let or vars in the “macros”
  • You loose the macros substitutions of $(varname)$ and $paramname$
    • And while we now have the new backtick forms they can only be used as parameters to other procedures/widgets/html
  • Regarless of these deficentcies we do gain a lot more in 5.3.0 that will make up a lot for these, although many also work in macros.
    • Functions and custom operators
    • Custom and redefined widgets
      • Including the slot and fill so you can design widget that wrap content.
    • Substitute operator
    • The Parameters widget
    • We can still use the triple curly braces “filterd transclusion”.

Personaly I would like to see;

  • A more symantic way to call procedures like <$proccall $name=procname..

My own understanding is continuing to improve and TiddlyWiki is still a work in progress.

Have a look if $:/core/ui/PageTemplate is one of them?

You can use the transclusion widget for every macro, procedure and function call now, which “unifies” the mechanism. But – The macrocall-widget works fine with procedures too.

\procedure test() some text

<$macrocall $name="test" />

Basically every thing which can be activated with <<something>> can be activated with a transclusion or a macrocall now. This gives us the possibility to update the existing TW UI without compatibility problems.

1 Like

@pmario no that is not one of the overwritten shadows listed. $:/core/ui/PageTemplate is, but i reverted back to the original and no behavior changed. None of the other overwritten shadow tiddlers look as obvious as that one does.

Is there a debugging techinique that I could use to narrow this down?

Can you make a copy where you munge the text and descriptions? It’s really hard to diagnose at arm’s length.

You could do something along the lines of:

A) Disable each plugin installed to see if the problem is fixed by disabling one of them.

B) If not, then:

  1. Make a copy of the wiki
  2. Use the Adv Search filter tab to export all the overwritten shadows.
  3. Delete those tiddlers.
  4. If that fixes the problem, bring the shadow overwrites back in chunks until the problem comes back.
  5. Repeat 1—4 until you find the cause(es)

C) If that doesn’t work, repeat steps 1—5 with all remaining system tiddlers

Thanks @Brian_Radspinner, I was just about to start doing that.

If all else fails, I can remove most of the copyrighted content and make it available.

All,

I removed all added plugins and deleted all overwritten shadow tiddlers, but the problem persists.

I have created a tiddlyhost site without the copyrighted content: https://kansasrailroads.tiddlyhost.com/

I hope all can reach it. If not, please let me know. This is the first time I’ve used tiddlyhost.

I have a tiddler that contains the procedure called Date to String Conversion. It is currently tagged with $:/tags/Global. This is the failing state. If you change it to $:/tags/Global/View, then a date shows up in the Example Tiddler.

Hopefully, someone can take a look at this and help solve the problem. If nothing else, this allows me to showcase my Kansas Railroad TW without the copyrighted contains (which is approximately 1700 railroads).

By the way, there are many external images missing from this.