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 3:02:36 AM UTC-7, Saq Imtiaz wrote:
>
> I have some tiddlers that use UUIDs that are not human-readable and have a 
> readable name in another field. So this is the exact use case for which I 
> wanted this extended beyond just the body field. Similarly I also have a 
> custom tags implementation in the view template....
>
> Not to mention another wiki in which I completely replace the tiddler UI 
> for certain tiddlers.
>
> I will adopt this whether the pull request gets merged or not, thanks 
> Joshua.
>
>
> On Monday, May 25, 2020 at 9:56:37 AM UTC+2, 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
>>
>> On Sunday, May 24, 2020 at 4:06:40 PM UTC-7, Joshua Fontany wrote:
>>>
>>> Yes, I think we can use this modification in all of the tiddler 
>>> ViewTemplate/EditTemplate sections.
>>>
>>> I like the idea of using it for $:/config/ui/ViewTemplate itself.... 
>>> hmm, some way to debug things would be good, because this opens things up 
>>> to a lot of possible ways to mess thing up. Maybe a new tab or section in 
>>> $:/Config to toggle transcluding the template tidders VS just outputing 
>>> their name as a link (so you can "jump to the code" if it is not rendering 
>>> correctly by toggling the Debug switch and clicking a template title).
>>>
>>> Thanks Saq, I'll put together a set of change as a PR, so we can have 
>>> some testable code and references to clean the idea up a bit.
>>>
>>> Best,
>>> Joshua F
>>>
>>> On Sunday, May 24, 2020 at 1:42:15 PM UTC-7, Saq Imtiaz wrote:
>>>>
>>>> I'm still a bit under the weather so not thinking with the clearest 
>>>> head here but a few thoughts:
>>>>
>>>>    - I like the use of subfilter, that is the problem with the current 
>>>>    way $:/config/ui/ViewTemplate is used, it is a direct assignment as a 
>>>> text 
>>>>    reference
>>>>    - I would want similiar extensibility for other parts of the 
>>>>    templates and not just the body. 
>>>>    - Could we tweak how we use $:/config/ui/ViewTemplate in 
>>>>    $:/core/ui/PageTemplate/story to also allow subfilters, allowing us to 
>>>> use 
>>>>    filters in that tiddler?  template={{{ 
>>>>    [subfilter{$:/config/ui/ViewTemplate}] }}}
>>>>
>>>> Hope some or any of that is helpful!
>>>> Saq
>>>>
>>>> On Sunday, May 24, 2020 at 9:34:06 PM UTC+2, Joshua Fontany wrote:
>>>>>
>>>>> So I have decided to edit a core system tiddler (gasp) for my current 
>>>>> 2 projects. One is a Martial Arts Wiki, with a glossary of over 500 
>>>>> Indonesian, Malay, Sundanese, Filipino, Javanese, Hawaiian, and Chinese 
>>>>> terms with special martial-arts context-specific meanings, and a ton of 
>>>>> Bookmarks (YouTube, etc). The other project is the every-growing UnNamed 
>>>>> RPG Campaign Manager, and one of the biggest roadblocks there was "custom 
>>>>> character/ship/etc sheets".
>>>>>
>>>>> I think I have a solution for this one. Will it be PR worthy? Let's 
>>>>> find out. The ability to hide/replace the default text field is a bit 
>>>>> cumbersome atm. You can hide the text-body by setting the `hide-body` 
>>>>> field 
>>>>> to "yes". And we can add new "sections" with `$/tags/ViewTemplate`, but 
>>>>> unless we dig around and copy the $reveal code from another template 
>>>>> section that will not be consistent with the Collapse state.... Yeah. 
>>>>> Complicated.
>>>>>
>>>>> If I change the `$:/core/ui/ViewTemplate/body` tiddler slightly, we 
>>>>> can move the "tiddler-body-default" wikitext to a macro in the same 
>>>>> tiddler:
>>>>> ```
>>>>> \define tiddler-body-default()
>>>>> <$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]]">
>>>>>
>>>>>
>>>>> <$transclude>
>>>>>
>>>>>
>>>>> <$transclude tiddler="$:/language/MissingTiddler/Hint"/>
>>>>>
>>>>>
>>>>> </$transclude>
>>>>>
>>>>>
>>>>> </$list>
>>>>> \end
>>>>>
>>>>> ```
>>>>> And re-write the body of the tiddler like so:
>>>>> ```
>>>>> <$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<
>>>>> <folded-state>> text="hide" retain="yes" animate="yes">
>>>>>
>>>>>
>>>>> <$list variable="bodyTemplate" 
>>>>> filter="[all[current]subfilter{$:/config/ViewTemplate/Body}]" 
>>>>> emptyMessage=<
>>>>> <tiddler-body-default>> >
>>>>>
>>>>>
>>>>> <$transclude tiddler=<<bodyTemplate>> >
>>>>>
>>>>>
>>>>> <$tiddler tiddler=<<bodyTemplate>> >
>>>>>
>>>>>
>>>>> <$transclude tiddler="$:/language/MissingTiddler/Hint"/>
>>>>>
>>>>>
>>>>> </$tiddler>
>>>>>
>>>>>
>>>>> </$transclude>
>>>>>
>>>>>
>>>>> </$list>
>>>>>
>>>>>
>>>>> </$reveal>
>>>>>
>>>>> ```
>>>>> Then we can use an array of filters to check for tags, type, or any 
>>>>> other way you want to trigger a custom view template, and you can have 
>>>>> more 
>>>>> than one resulting bodyTemplate titles output and it's all nested in the 
>>>>> correct $reveal widget, etc. Even better, you can use the 
>>>>> `<<tiddler-body-default>> macro ANYWHERE in your own templates to get the 
>>>>> default text-field to show up in that spot. Here is my current 
>>>>> `$:/config/ViewTemplate/Body`:
>>>>> ```
>>>>> [tag[$:/tags/Macro]then[$:/plugins/joshuafontany/core/ui/ViewTemplate/
>>>>> body/macro]]
>>>>> [tag[Glossary]then[$:/plugins/joshuafontany/silatglossary/ui/
>>>>> ViewTemplate/body]]
>>>>> [match[Test]then[$/plugins/joshuafontany/core/ui/ViewTemplate/body/
>>>>> TEST]]
>>>>>
>>>>> ```
>>>>> Which as you can see, uses the 
>>>>> `$:/plugins/joshuafontany/core/ui/ViewTemplate/body/macro` tiddler as the 
>>>>> body-template for all Global Macro tiddlers. This template looks like:
>>>>> ```
>>>>> <pre><code language={{!!type}}><$view field="text"/></code></pre>
>>>>>
>>>>>
>>>>> ```
>>>>>
>>>>> Which is a bit overkill, but is exactly how, internally, the 
>>>>> `application.javascript` tiddlers are rendered. But this means I no 
>>>>> longer 
>>>>> have to click edit on every Macro tiddler just to re-read it for bug, 
>>>>> etc. 
>>>>> I'm going to expand this technique to render other custom tiddler types 
>>>>> for 
>>>>> other projects.
>>>>>
>>>>> Oh, yes, final note. The Type field can and will definitely over-ride 
>>>>> this custom rendering, as that's done internally using the wiki's Parser 
>>>>> methods. Also, I'm not sure if this is 100% backwards compatible, but the 
>>>>> only thing I can possibly think of it changing are the Numeric Values 
>>>>> output by the Qualify Macro (as these depend on how many and which 
>>>>> tiddlers 
>>>>> the current content is being rendered "through").
>>>>>
>>>>> I think I will expand this to allow for a tabbed interface in the 
>>>>> Draft Mode UI, with the standard Text Editor in one tab, and other 
>>>>> content 
>>>>> in other tabs. I can also use this to extent the Title field to allow for 
>>>>> a 
>>>>> custom Name (short & human readable, see plugins) that will display full 
>>>>> size (if present) and which pushes the full Title down to a line of 
>>>>> smaller 
>>>>> text.
>>>>>
>>>>> Best,
>>>>>
>>>>> Joshua Fontany
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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/tiddlywikidev/9b494a3d-e151-44db-9435-555b7dcb47f3%40googlegroups.com.

Attachment: custom_templates_edit_test.json
Description: application/json

Reply via email to