<$list filter="<my conditions>">
<style>
<target> {display:none;}
</style>
</$list>
Titles can be very long and contain special characters, maybe this is the reason, it was not done before.
URI-encoding or hashing appear both to be possible, hash values tend to be shorter (if you have longer titles than "foo").
The problem with hash values is, that if the tiddler title is changed, there is absolutely no way to find the "tiddler name" (responsible for the styling), if you only know the hash from the CSS definition.
The existing way, at least gives you a hint, about the connection between tag name and CSS class name.
/*\
title: $:/core/modules/macros/HashStr.js
type: application/javascript
module-type: macro
Generate a numeric hash from a string
uses $:/core/modules/utils/utils.js
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "HashStr";
exports.params = [
{name: "str"}
];
/*
Run the macro
*/
exports.run = function(str) {
var hash = $tw.utils.hashString(str);
return hash;
};
})();
Yea, that's easy. ... But I'm talking about the other way around. I'll give you the hash and you give me the title (after renaming it). This is maintenance nightmare!
I would not recommend to include title-hashes in CSS ... but to somehow filter the titles you want to apply special css to and transclude the result in the CSS.
- Not modifying the core view template.
The point is. TiddlyWiki implemented a consistent way to modify the UI.
a) TW applies default classes to every widget, that create HTML elements, to allow the built in "palette" and "themes" functionality.
b) TW automatically assigns a tag class="" to tiddlers, that are tagged. So if a user wishes, they can assign special rules to tagged tiddlers.
This was implemented because of high demand.
c) TW uses the <$list> widget to dynamically create the core ViewTemplate. All tiddlers tagged: $:/tags/ViewTemplate are used to build the "top level" tiddler UI
some important blocks are:
To get the full shadow list. Use: <<list-links [all[shadows]tag[$:/tags/ViewTemplate]]>>
list-before
can be used. No need to modify existing core templates!$:/core/ui/ViewTemplate/title uses 2 elements to dynamically create the tiddler toolbar. The system tag: $:/tags/ViewToolbar and a "visibility" configuration tiddler prefixed: $:/config/ViewToolbarButtons/Visibility/??? which allows the user (and plugin authors) to decide which elements are shown by default.
Those settings can be changed at: ControlPanel: Appearance: Toolbars
If a plugin author wants to add or remove elements, they can just use this tag. If a special position within the template is needed the field: list-before
can be used. If a button needs to be visible by default, just create the needed config tiddler. No need to modify existing core templates!
-> This mechanism is consistent for all View- and EditTemplates.
- Without assigning certain tag to the tiddler.
- Not using global CSS styles.
d) If all those dynamic mechanisms don't give enough possibilities,
every plugin author is free to create their own UI, with partially or
completely change the default behaviour. Best practice is: modify the
core Templates with your own implementations.
have fun!
mari
--IMO at a certain point of customization it is needed to modify the core templates, because ever other possibility is much more fragile, and a lot more work to maintain.
have fun!
mari
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/NiS6c9yO-Lg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/71de5d61-0d8a-412f-9cd0-6a56d8c3722e%40googlegroups.com.
I did a test with a new ta-title attribute in the ViewTemplate. See the attached file.
Could this be used generically for any field? If one does want to style using tags, or any other field?
Also, this would also make it possible to, in each tiddler, have a dedicated style field (just like currently there can be a color field) for quick styling of a tiddler without a separate stylesheet. I.e directly in the tiddler create a field with style: color:green; background:yellow;
A style field would also make it possibly to style easily via actions (a button); it is just to "set that field". Powerful!
That is awesome, and far better than using a class.
This allows very flexible selectors as ta-title^="Draft of '" for selecting all the tiddlers begginig with that string, including single quotes. And the browsers compatibility seems to be very wide, from IE7 and all the mayor browsers.
I hope you have posted this information on the GH issue. I find it very valuable.
How open are you to implement this on the core? I know this depends ultimately on Jeremy, but your opinion has a lot of weight too.
Yes. I think it might be a possibility fix issue 958 and even improve the possibilities.
But it will introduce backwards incompatibility, if we replace the existing mechanism, which is definitely needed in my point of view see issue 958
- So we would need to deprecate the existing one and introduce the new one.
- After enough time eg: 2 version updates we could remove the old mechanism.
So the way to convince Jeremy is: to prove, that it works and is actually a lot better then the existing mechanism.
--------------
I'm not sure, how much the tc-tagging mechanism is really used. There aren't many posts in this group about problems. May be because many tags are "single words", or low usage. .. I don't know.
-m
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/fc82b6c8-c6b4-4ada-996b-de707d0bebc9%40googlegroups.com.
!field:hide-body[yes]
Also, this would also make it possible to, in each tiddler, have a dedicated style field (just like currently there can be a color field) for quick styling of a tiddler without a separate stylesheet. I.e directly in the tiddler create a field with style: color:green; background:yellow;
Using the <style> element imo isn't a good idea, because
\define style() {{$(currentTiddler)$!!style}}
\define frame-classes()
tc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$
\end
\define folded-state()
$:/state/folded/$(currentTiddler)$
\end
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/popup/tiddler-info">>><$tiddler tiddler=<<currentTiddler>>><div style=<<style>>><div class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list></div></div>
</$tiddler></$set></$set>
<:-)
Yes. I think it might be a possibility fix issue 958 and even improve the possibilities.What do you mean by fixing #958?
That ticket merely points out that tag names have to be encoded for use in a stylesheet.
We don’t have a plausible proposal for how to avoid the need for escaping, so I’m not sure what a fix would look like.