> I have this in my StyleSheet:
> div[tags~="120"].tiddler .viewer { font-size:120%; color:black; }
> In a tiddler, if I want the text to appear larger, I just add the "120"
> tag. Works great.
>
> Is there a way use a custom field value instead?
> What I mean is that lets say I have a field called "Fontsize", if I enter
> the value 120 then the font size would be 120%,
> but if I change the value to 90 then the font size would be 90%.

When a tiddler is rendered, a DIV is created and the tiddler's tags
are set as an attribute of that div.  Here's the line in the TWCore
story.prototype.refreshTiddler() code:
        tiddlerElem.setAttribute("tags",tiddler.tags.join(" "));

This then allows use of a CSS selector, div[tags~="..."], that can
match a tag value to apply specific
style rules to tht tiddler.

However, creating DIV attributes corresponding to a tiddler's custom
fields is *not* being done by the TWCore, so there's (currently) no
way to specify a CSS rule based on matching a custom field value.

I should be possible to re-write (hijack) the TWCore refreshTiddler()
function to also create DIV attributes for the custom fields.  One
possible caveat: a field name might "collide" with some standard DIV
attribute name (e.g., "style", "id", etc.), so special checks would be
needed to prevent specific custom fields names from being assigned as
DIV attributes.

-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to