Hi everyone,

Let me explain the method I am using to do these custom templates. I am not 
changing the existing $:/tags/ViewTemplate or $:/tags/EditTemplate 
architecture at all. The $list widget that builds each tiddler in the 
story-river still does exactly that. What I have done is gone into key 
system tiddlers with those  tags and found the "bare minimum" code used to 
render the content, moved that to a macro, such as `\define 
tiddler-body-default()`. Then, in that place in the system-tiddler, I put 
(cutting out the debug and "missing tiddler" fail-safe code):
<$list variable="sectionTemplate" 
filter="[all[current]subfilter{$:/config/ui/ViewTemplate/body}]" 
emptyMessage=<<tiddler-body-default>> >

<$transclude tiddler=<<sectionTemplate>> >
<$/list>


This checks the $:/config/ui tiddler specified for a series of filters, and 
uses those titles as sections. BY DEFAULT this will return empty and place 
the original code back using the `emptyMessage` parameter. Because the list 
hosting these `sectionTemplates` exist in the tiddler defining the 
<<tiddler-body-default>> definition, I can use that macro anywhere in my 
own templates to render the default __whatever__, be that into a tab, a 
$reveal widget, a new <$div> with a specific class or id value that is a 
filtered translcusion (triple braces), etc. So I can insert or hide/show 
the default chunk of code within my own templates. So my glossary template 
tiddler is as simple as:

<<tiddler-body-default>>

<<glossary-item>>

The <<tiddler-body-default>> code is defined within the 
$:/tags/ViewTemplate "body" tiddler, and the <<glossary-item>> code is 
defined in a global macro tiddler ($:/tags/Macro) because I re-use it in 
other templates.

Because we are using the `subfilter{configTiddler}` operator, each filter 
run in that config tiddler gets fed the <<currentTiddler>> value. Then, the 
output is collected and returned as a title-list. This is used to render 
the new UI for that section. The use of filters allows __whatever__ custom 
triggers, conditionals, etc, you can conceive by using the current filter 
operators. I am currently using the existence of a tag for both the 
Glossary and $:/tags/Macro custom bodies. I will be building UI for my 
Youtube, Vimeo, etc bookmarks to transclude their player-embed code by 
grabbing the right parts from their link URL, and drive that on 
[tag[Bookmark]regexp:url<youtube-domain>], or 
[tag[Bookmark]regexp:url<vimeo-domain>], or whatever.

I realize now that one of the things that sparked this idea was listening 
to Jeremy on one of the tiddly-hangout videos talk about how robust the 
filter operator "language" has become now, and that many things in the core 
that were done in other ways could be revisited using Filters as the 
primary syntax. This plus seeing some of the really cool stuff being 
developed recently, and getting a better sense of how TW renders things 
"under the hood". Thanks for trying this out, and for all the feedback so 
far!

Best,

Joshua Fontany

On Monday, May 25, 2020 at 7:58:29 PM UTC-7, Joshua Fontany wrote:
>
> Here is a json of all the tiddlers necessary to test this out, both the 
> changed sysetem tiddlers, and the custom templates and settings tiddlers I 
> have been using to test this new system. If you drag everything into a 
> fresh wiki, and then open the "Adat 1" tiddler, you should see that the 
> Fields section is now in a toggle-able hidden $reveal widget, there is a 
> toggle link/$button floating to the right of the Type field, and the BODY 
> has two TABS - one with the normal Edit Text stuff, the other with my 
> custom Languages fields for the glossary I am building.
>
> Best,
> Joshua F
>
> On Monday, May 25, 2020 at 6:27:36 PM UTC-7, Joshua Fontany wrote:
>>
>> Yeah, this is probably my favorite hack I've ever come up with. Its so 
>> easy to customize pieces of the Tiddler-in-the-Story-River.
>>
>> Right now I just got a tabbed editor working on all [tag[Glossary]] 
>> tiddlers, that auto-hides the Fields section in an accordian $reveal 
>> widget, and has the default editor on one tab, and my custom-fields editor 
>> on the next. This has edit boxes for the `aliases` field, as well as every 
>> field found in the `_language_list` field. It all just works. Setting up a 
>> set of test tiddlers you can play with now.
>>
>> Best,
>> Joshua F
>>
>> On Monday, May 25, 2020 at 5:45:18 AM UTC-7, TonyM wrote:
>>>
>>> Post script,
>>>
>>> A Hide-body variable/macro that would override the hide-body field if it 
>>> is set, allowing one template to turn it off or on programmatically as 
>>> required.
>>>
>>> Regards
>>> Tony
>>>
>>>
>>> On Monday, May 25, 2020 at 10:29:09 PM UTC+10, TonyM wrote:
>>>>
>>>> Joshua,
>>>>
>>>> Can you share what the implications are in your mind?
>>>>
>>>> I now have Timimi on Chrome, and read the forum in chrome. I found a 
>>>> nice workflow. 
>>>>
>>>>    - Download the json files to a my scratch folder, but they sit in 
>>>>    the browser footer tray
>>>>    - Go to Tiddlywiki.com drag the json files from the footer tray on 
>>>>    top of tiddlywiki.com
>>>>    - I took the extra step of downloading tiddlywiki.com, double click 
>>>>    in the download tray to open in a tab and drag the json to that for a 
>>>>    Timimi savable test.
>>>>
>>>> You idea seems like an advance but I need to re-conceptualize this in 
>>>> relation to all the things I already know about viewTemplates, and how I 
>>>> would do what I already do.
>>>>
>>>> If we are modifying the view Templates there are a few other 
>>>> hackability issues that would be nice; Given the area you are modifying it 
>>>> makes sense to raise them here;
>>>>
>>>>    - Tags to add items to the subtitle
>>>>    - Ability to display a prefix or suffix to the title
>>>>       - eg if chapter number is available display that before title
>>>>       - even use the tiddlers position in a tag list to obtain the 
>>>>       number
>>>>    - Optional Extra a new float right toolbar under the existing one 
>>>>    to add contextual buttons
>>>>       - Ones that appear of disappear on various tiddler or wiki wide 
>>>>       conditions
>>>>       - We can already do this with conditional code in buttons, but 
>>>>       it would help sort them from standard buttons if they had their own 
>>>> place. 
>>>>    
>>>> Either you could incorporate these changes in your templates, with a 
>>>> view to adding them to the core as well.
>>>>
>>>> Regards
>>>> Tony
>>>>
>>>>
>>>> On Monday, May 25, 2020 at 6:01:53 PM UTC+10, Joshua Fontany wrote:
>>>>>
>>>>> Oooooh, wow. This is incredibly powerful.
>>>>>
>>>>> PR is up. I have attached a *.json bundle with the tiddlers I am using 
>>>>> to test the rendering. 
>>>>> The Title and Subtitle overrides have a `name` field, like a plugin, 
>>>>> and this triggers a custom view template for each that pushes the title 
>>>>> into the subtitle, and renders the Name in the <h2>title</h2>. Both obey 
>>>>> the Titles-a-Links setting in $:/Config > Settings.
>>>>>
>>>>> I have also attached a *.json bundle with just the changed 
>>>>> shadow-tiddlers, so you could actually try this out on tiddlywiki.com by 
>>>>> dragging both to a tab with it loaded.
>>>>>
>>>>> https://github.com/Jermolene/TiddlyWiki5/pull/4681
>>>>>
>>>>> Best,
>>>>> Joshua Fontany
>>>>>
>>>>

-- 
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/7fff4883-7c43-49ba-b97b-6c2681526900%40googlegroups.com.

Reply via email to