On Friday, November 1, 2019 at 4:06:22 AM UTC-7, Andrés Pérez wrote: > > So this is probably me not understanding something fully, so I am asking > here to be better educated. I was playing around with a viewtemplate and > thought about how to apply it based on tiddler title. When I did that > filter, though, it applied the template to every single tiddler. > > So I have these two viewtemplate-tagged tiddlers: > Title-based: > >> <$list filter="[all[current]is[tiddler]!is[system]title[foobar]]"> >> foo >> </$list> > > > Tag-based: > >> <$list filter="[all[current]is[tiddler]!is[system]tag[foobar]]"> >> bar >> </$list> > > > My expectation is that the title-based viewtemplate only gets applied to a > tiddler with a title of 'foobar' and the tag-based one is only applied to > tiddlers with a tag of "foobar'. > What winds up happening is that the tag-based template only gets applied > based on the tag, but the title-based one gets applied to all tiddlers. > > I feel like this is due to something fundamental/important in how this is > all put together, but I don't know what or why. > > I have a working example in this link: > > https://storage.googleapis.com/hgdrop/titlebasedtemplate.html#TagBasedViewTemplate:foobar%20blankTiddler%20tagged%20TitleBasedViewTemplate%20TagBasedViewTemplate > > > And a wordier description here: > > With the two ViewTemplates described above, and these 3 tiddlers with no > contents: > A: Title: foobar, Tag: *none* > B: Title: blankTiddler, Tag: *none* > C: Title: tagged, Tag: foobar > > My expectation is that the contents of the three tiddlers be: > A: foo > B: *nothing* > C: bar > > Actual rendered contents: > A: foo > B: foo > C: foo bar >
The following note appears in the documentation for https://tiddlywiki.com/#title%20Operator title is a constructor (except in the form !title), but field:title is a > modifier. see https://tiddlywiki.com/#Selection%20Constructors, which explains: The output of a Filter Step depends on its operator: > Most operators derive their output from their input. For example, many of > them output a subset of their input, and thus truly live up to the name of > "filters", narrowing down the overall output of the containing run. These > operators are called selection modifiers. > A few operators ignore their input and generate an independent output > instead. These are called selection constructors: they construct an > entirely new selection. > A good example of a constructor is title. The output of [title[A]title[B]] > is just B. But the field operator is a modifier, so [title[A]field:title[B] > outputs nothing at all. Thus, in your experiment: "title[foobar]" is a "constructor" that always returns "foobar" regardless of what precedes it in the filter, while "field:title[foobar]" is a "modifier" that only returns "foobar" if the preceding filter terms already contain "foobar" enjoy, -e Eric Shulman TiddlyTools: "Small Tools for Big Ideas!" (tm) http://tiddlytools.github.io/ InsideTiddlyWiki: The Missing Manuals http://insidetiddlywiki.tiddlyspot.com/ -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/32efca11-8cd6-438a-8302-8e9d400ffd92%40googlegroups.com.

