Identifying tags not having a target tiddler yet

I am trying to think of a ay to identify tags on a tiddler whose target tiddler has not been created yet.

For example, I have a tiddler as follows:

This tiddler has a number of tags as shown. The tag Sassetas does not have a target tiddler that has been created yet. I am looking for a way to highlight tiddlers like that when viewing a data tiddler. That way, as I go through the TW, I can fix up any of those tiddlers over time.

Anyone got any suggestions?

bobj

[<currentTiddler>tags[]!is[tiddler]]

I’m not quite sure I understand this part, are you referring to “data tiddler” in this precise meaning: https://tiddlywiki.com/#DataTiddlers ?

Here are some things to try.

Use filter

[tags[]is[missing]!is[system]]

In the Advanced Search > Filter tab to get a list of all non-system missing tags.

Or add this CSS to a tiddler tagged $:/tags/Stylesheet to set a specific formatting for all tag pills of missing tags:

.tc-tag-missing {
 font-style: italic; 
}

image

Tags that have a “target tiddler” are assigned CSS class tc-tag-exists.
Tags that do NOT have a target tiddler are assigned CSS class tc-tag-missing.

So, to make missing tags easily visible, you can create a stylesheet tiddler (e.g., “TagStyles”), tagged with $:/tags/Stylesheet, containing something like this:

.tc-tag-missing { font-style:italic; font-weight:bold; }

Then, when you are viewing a tiddler, any tags that don’t have a target tiddler will display with bold italic text which will make them stand out from the other tags.

enjoy,
-e

I use this filter:

[all[current]tags[]is[missing]]

2 Likes

Marked Eric’s answer as the “solution”, since it does exactly what the OP requested:

1 Like

image

That’s Eric’s code running on tiddlywiki.com

@EricShulman , thanks for your suggestion. I have worked out that the tag title display has its font style and weight altered when displayed in the All Tags list in the control panel. Not quite what I envisaged but all good nevertheless. I was hoping for an indication when viewing a tiddler and the tag in that tiddler’s tag list would have some indication, maybe a change of colour.

Anyway, your suggestion gets me much further much easier that before. So thanks again.

bobj

that’s exactly what it does. See my post above.

@CodaCoder , I can’t get that display on my TW. Don’t know why. For me the tag list is just displayed as normal. But I can get an italicised display in the All Tags list in the control panel.

bobj

And you set it up like this?

@CodaCoder , done all that. I think there maybe some interference from other stylesheets I have defined. Will set up a test and see if that’s it.

Nope, removed all my stylesheets and viewtemplates but no different, the missing tag title displays just as normal, not altered.

bobj

Look in DevTools Inspector – right click on the tag, choose “Inspect” and you should see something like this:

image

If not, take a screenshot…

@CodaCoder here is a screen shot. Using Firefox on a Mac. Have searched for

strong text

Have searched for tc-tag-missing to no avail.

bobj

What version of TW are you using?

If you use the browser debugger to examine the tag (right-click on the tag and choose “inspect”), it should show that the tag text is wrapped in a <span> that has a class of either tc-tag-exists or tc-tag-missing which is added by the TWCore <<tag>> macro that is used to display the tags. This macro is defined in $:/core/macros/tag which contains the following definition:

\define tag-pill-inner(...)
...
	<span class={{{ [<__tag__>is[missing]then[tc-tag-missing]else[tc-tag-exists]] }}}>
		<$view tiddler=<<__tag__>> field="title" format="text" />
	</span>
...
\end

If the tc-tag-missing class is not present, then perhaps you are using a modified version of $:/core/macros/tag rather than the default shadow definition.

Also, to confirm that your stylesheet is being applied, try entering the following into a test tiddler:

@@.tc-tag-missing This is some text that should be bold and italic @@

-e

@CodaCoder version 5.3.3

@EricShulman the span is

This is the text of $:/core/macros/. I’ve searched for tc-tag-missing and it does not appear to be included. I’ve not edited this tiddler at all.

\define tag-pill-styles()
background-color:$(backgroundColor)$;
fill:$(foregroundColor)$;
color:$(foregroundColor)$;
\end

<!-- This has no whitespace trim to avoid modifying $actions$. Closing tags omitted for brevity. -->
\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
\whitespace trim
<$let
	foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
	backgroundColor=<<__colour__>>
>
<$element-tag$
	$element-attributes$
	class="tc-tag-label tc-btn-invisible"
	style=<<tag-pill-styles>>
>
	<<__actions__>>
	<$transclude tiddler=<<__icon__>>/>
	<$view tiddler=<<__tag__>> field="title" format="text" />
</$element-tag$>
</$let>
\end

\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)
\whitespace trim
<$macrocall $name="tag-pill-inner"
	tag=<<__tag__>>
	icon=<<__icon__>>
	colour=<<__colour__>>
	fallbackTarget={{$palette$##tag-background}}
	colourA={{$palette$##foreground}}
	colourB={{$palette$##background}}
	element-tag=<<__element-tag__>>
	element-attributes=<<__element-attributes__>>
	actions=<<__actions__>>
/>
\end

\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"")
\whitespace trim
<span class="tc-tag-list-item" data-tag-title=<<__tag__>>>
	<$let currentTiddler=<<__tag__>>>
		<$macrocall $name="tag-pill-body"
			tag=<<__tag__>>
			icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
			colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
			palette={{$:/palette}}
			element-tag=<<__element-tag__>>
			element-attributes=<<__element-attributes__>>
			actions=<<__actions__>>/>
	</$let>
</span>
\end

\define tag(tag)
{{$tag$||$:/core/ui/TagTemplate}}
\end

bobj

After I upgrade to version 5.3.5, all seems to be working as it should.

This might be a useful facility to retain in TW core, possibly via a user selection in the control panel.

bobj