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 then 
one resulting templateTitle 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/14d89d50-420d-49eb-9b59-6f03a0bf96c1%40googlegroups.com.

Reply via email to