# [tw5] Re: Preparing for v5.1.16

--------------- Off Topic warning -------------------------

TLDR;

So having all those discussions and implementations in place, I would
suggest to add 1 more thing, to the view template, for ultimate
flexibility, *without *increasing complexity.

- We have a "color" field to define tag-colors
- We can have a "class" field that's added to a tiddler and the view
tempate like this:

\define frame-classes()
tc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $( shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$ $( userClass)$
\end
\define folded-state()
$:/state/folded/$(currentTiddler)$\end <$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify
"$:/state/popup/tiddler-info">> userClass={{!!class}}><$tiddler tiddler=<<
currentTiddler>>><div data-title=<<currentTiddler>> data-tags={{!!tags}}
class=<<frame-classes>>><$list filter= "[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable=
"listItem"><$transclude tiddler=<<listItem>>/></$list>
</div>
</$tiddler></$vars>

I think, this will create the ultimate flexibility about tiddler body
styling, in a performant and backwards compatible way.

----------------------------------------

On Sunday, April 8, 2018 at 9:38:19 PM UTC+2, BurningTreeC wrote:
>
> The new *data-tiddler-title* isn't mentioned anywhere in the release
> notes or the docs
>

That's not merged yet. IMO because we couldn't find a consensus, how it
should be implemented. ... See link to the discussions later in the post.

And your "data-tiddler-xxxxx" or "data-tiddler-type" example shows, that we
may need a more generic solution. ... keep on reading ;)

------------

My initial pull-request had only 1 intention: To fix the
"tc-tagged-Working%20with%20TiddlyWiki" problem. ... I think you can see
the problem here.

The CSS definition is a bit complicated for spaces. ... BUT imo it is
completely broken for languages, that use the Cyrillic or other alphabets.

eg: a tag like: сломанный
would be tc-tagged-%D1%81%D0%BB%D0%BE%D0%BC%D0%B0%D0%BD%D0%BD%D1%8B%D0%B9

Creating and maintaining these type of CSS rules, imo is a completely
broken user experience. My initial PR could nicely fix this issue.

The whole PR consists of about 17 tiddlers, where *16 are documentation*

*ONLY 1 line in the ViewTemplate had to be changed* to:

<$set name="storyTiddler" value=<<currentTiddler>>><$set
name="tiddlerInfoState" value=<<qualify
"$:/state/popup/tiddler-info">>><$tiddler
tiddler=<<currentTiddler>>><div data-title=<<currentTiddler>>
data-tags={{!!tags}} class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]"
variable="listItem"><$transclude tiddler=<<listItem>>/></$list>

Discussions can be seen at my 1st
<https://github.com/Jermolene/TiddlyWiki5/pull/2737> and 2nd PR
<https://github.com/Jermolene/TiddlyWiki5/pull/3038> at GitHub. ... Be
warned there are 2 "Walls of text"

Especially this post may be interesting:
https://github.com/Jermolene/TiddlyWiki5/pull/3038#issuecomment-349011301
It defines a way to dynamically define a stylesheet, based on any field.
... The problem here is. It may have a negative performance impact. ...
see: "may have" ...

If you need special handling for a tiddler with a field: rank and the
> value: species you can do this:
>

> title: myStyles
> tags: $:/tags/Stylesheet > > <$list filter="[rank[species]]">
> [data-title^="<$view field=title/>"] .tc-tiddler-body { > column-count: 2; > } > </$list>
>
> And you are good to go.
>

This is a very similar mechanism as you explained with "data-tiddler-type"
___without___ the need to change the ViewTemplate and the exact same
performance characteristic. ...

Conclusion!

If you made it that far ... Go up and read the TLDR;

---------------- OT END -------------------

Have fun!
mario

PS: I'll update my PR. Add data-tags and data-title attributes to the
ViewTemplate #3038
<https://github.com/Jermolene/TiddlyWiki5/pull/3038#issuecomment-349011301>
and the doc at: http://2737.tiddlyspot.com accordingly.
PPS: tiddlyspot contains the proposed ViewTemplate for further testing!

--
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