Special formatting of a tiddler with a specific tag

70 views
Skip to first unread message

joearms

unread,
Dec 9, 2018, 5:27:51 AM12/9/18
to TiddlyWikiDev
I want to format tiddlers with a specific tag in a particular way.

I have made two tiddlers
 
   1) called mod:lists:reverse:2

With tag 'erlang_code' and content

   %% reverse a list

   reverse([], L) -> L;
   reverse([H|T], L) -> reverse(T, [H|L]).

    2) a tiddler called  test_formatting with tag $:/tags/ViewTemplate
and content

    <$list filter="[is[current]tag[erlang_code]]">
      <button>Compile</button>
      <pre>
      {{!!text}}
      </pre>
     </$list>

When I do this the text of the tiddler 1 is rendered twice
(as in the attachment)

How can I get the content to be rendered once inside the body of the $list macro?

Cheers

/Joe

tiddler.png

TonyM

unread,
Dec 9, 2018, 6:17:28 AM12/9/18
to TiddlyWikiDev
joe,

I don't follow the whole story here, but you should only see this twice in the tiddler that is tagged viewtemplate, any other tiddler that has the tag should only show it once.

The view templated tiddler shows its content and itself as a result of the view template. So you see it twice.

Have you tripped over yourself?

Regards
Tony

joearms

unread,
Dec 9, 2018, 6:59:34 AM12/9/18
to TiddlyWikiDev


On Sunday, 9 December 2018 12:17:28 UTC+1, TonyM wrote:
joe,

I don't follow the whole story here, but you should only see this twice in the tiddler that is tagged viewtemplate, any other tiddler that has the tag should only show it once.

That's what I thought :-)

The enclosed file tiddler.png is the rendered version of mod:lists:reverse:2 and show the content TWICE first the content then the content processed inside
by the tiddler with the viewTemplate tag

/Joe

Eric Shulman

unread,
Dec 9, 2018, 11:05:02 AM12/9/18
to TiddlyWikiDev
On Sunday, December 9, 2018 at 2:27:51 AM UTC-8, joearms wrote:
I want to format tiddlers with a specific tag in a particular way.

I have made...a tiddler called  test_formatting with tag $:/tags/ViewTemplate
and content... When I do this the text of the tiddler 1 is rendered twice

How can I get the content to be rendered once inside the body of the $list macro?

The problem is that the custom ViewTemplate doesn't *replace* the standard view... it ADDS to it to the end of the standard view.  Thus, you see the tiddler content twice: first as standard wikitext output (the normal tiddler display) then followed by your custom-formatted output.

To get the results you want, you need to suppress the standard output... but only when the tiddler is tagged "erlang_code".

One quick way to achieve this is to use CSS to hide the standard tiddler "body" element.  Just put the following CSS into a tiddler tagged with "$:/tags/Stylesheet":

[data-tags*="erlang_code"] .tc-tiddler-body { display:none; }

That should fix your problem.  Let me know how it goes.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals



Cheers

/Joe

joearms

unread,
Dec 9, 2018, 12:09:38 PM12/9/18
to TiddlyWikiDev
Thank you very much Eric,

comments in-line

Cheers

/Joe



On Sunday, 9 December 2018 17:05:02 UTC+1, Eric Shulman wrote:
On Sunday, December 9, 2018 at 2:27:51 AM UTC-8, joearms wrote:
I want to format tiddlers with a specific tag in a particular way.

I have made...a tiddler called  test_formatting with tag $:/tags/ViewTemplate
and content... When I do this the text of the tiddler 1 is rendered twice

How can I get the content to be rendered once inside the body of the $list macro?

The problem is that the custom ViewTemplate doesn't *replace* the standard view... it ADDS to it to the end of the standard view.  Thus, you see the tiddler content twice: first as standard wikitext output (the normal tiddler display) then followed by your custom-formatted output.

How do you know this? - did you read some code (which?) or is this documented someplace???

 

To get the results you want, you need to suppress the standard output... but only when the tiddler is tagged "erlang_code".

One quick way to achieve this is to use CSS to hide the standard tiddler "body" element.  Just put the following CSS into a tiddler tagged with "$:/tags/Stylesheet":

[data-tags*="erlang_code"] .tc-tiddler-body { display:none; }

That should fix your problem.  Let me know how it goes.


It worked - 
 
enjoy,

I did :-)

Mohammad Rahmani

unread,
Dec 9, 2018, 12:38:16 PM12/9/18
to TiddlyWikiDev
Eric,
 Your solution is always with full description, thank you!

-Mohammad
Reply all
Reply to author
Forward
0 new messages