Tinderbox Forum

Prototype templates do not show up in the Template drop-down

Hi all!

If a note is defined to be a Template (i.e., $IsTemplate is set to true), then that note will show up in the Template drop-down menu in the Export tab of the HTML inspector.

However, if a note is defined to be both a Template and a Prototype (i.e., $IsTemplate and $IsPrototype are both set to true), then the note does not show up in the Template drop-down menu.

Is this the expected behavior?

Thanks!

I suspect this was an unexpected scenario. Whilst incremental formalisation means any note may be made into a prototype, I suspect this combination of prototype-and-template wasn’t envisaged. I’d note that for the first part of Tinderbox’s life templates were external files (and thus couldn’t be templates) and this may still affect some internal logic: of course, now templates are only notes in the current document. Mark B is travelling at present but I’m sure can provide a more authoritative answer in due course.

Meanwhile, if using the built-in HTML template prototype, templates really only differ in their $Text. A prototype’s $Text is only inherited once - at prototype assignment. Furthermore, if a (new) prototype is assigned after the template’s $Text has been edited the that attribute is no longer inherited as it already has a local value.

I’d propose that it makes good sense not to plan to make template prototypes as well. If you need several different prototype-based template setting (e.g. HTML vs Markdown ones), I’d suggest having multiple prototypes, one for each use case and then making templates use the appropriate prototype. If those prototypes have $Text you want inherited, then you may wish to removes the /Templates container’s OnAdd so you can choose the appropriate prototype rather than have the action auto-assign 'HTML Template", and thus setting $Text such that a change of prototype won’t insert new default $Text (as might be desired).

If I’ve misunderstood the underlying problem, please ask, as I’m interested to understand why one might need a template/prototype as opposed to making one simply because it seemed sensible and possible to do (i.e. no one said “don’t”!).

The case is built into 7.2.1.

Despite Tinderbox’s embrace of prototype inheritance, most prototypes represent empty classes of things. For example, the HTML Template prototype sets up a number of attributes and text format settings that are nice for templates, but it is itself an empty template and not very useful as a template.

I agree this is a bit of an odd corner case, but it’s likely more useful to more people as it is.

1 Like

So it is the intended behavior that template prototypes do not show up in the template drop-down, yes? The idea being that there may well be template-prototype notes in the document, but it is unlikely that they will actually be used as templates themselves?

That’s the current assumption – I believe deriving from a user’s observation that their prototype template was distracting when it appeared in a menu.

1 Like

Seems like the right choice.

1 Like

I’ve now clarified in several other pertinent places in aTbRef, that templates which are also prototypes are not listed in the Template pop-up menu.