[TW5] How to wrap transcluded content with <div> tags?

177 views
Skip to first unread message

Martian

unread,
Apr 15, 2016, 12:34:20 PM4/15/16
to TiddlyWiki
Hello, 

I am trying to get in target tiddler not just a content on transcluded {{}}, but wrapped with <div id={{!!title}}>{{}}</div>

It seems, that these ways doesn't work
@@.{{source!!title}}
{{source}}
@@

<$set name="myVariable" value={{!!title}}>
<div id='<
<myVariable>>'>
div id='<
<myVariable>>'
{{}}
</div>
</$set>

Is it only possible with <$macrocall> like this

\define indiv(divId)
<div id="$divId$">
{{}}
<div>
\end

<$macrocall $name="indiv2" divId={{!!title}}/>

and use this as template in target tiddler?
{{source||indiv}}


Eric Shulman

unread,
Apr 15, 2016, 2:18:43 PM4/15/16
to tiddl...@googlegroups.com
On Friday, April 15, 2016 at 9:34:20 AM UTC-7, Martian wrote:
I am trying to get in target tiddler not just a content on transcluded {{}}, but wrapped with <div id={{!!title}}>{{}}</div>

Ironically, the syntax you wrote above to describe your desired goal is exactly correct:
<div id={{!!title}}>
{{TranscludedTiddler}}
</div>

* The TWCore extends parsing of HTML syntax and expands any TextReferences or Macros/Variables used as attribute values.  Thus, all the following are valid in TW:

<div id="foo">      = standard HTML double quotes (literal value)
<div id='foo'>      = standard HTML single quotes (literal value)
<div id="""foo""">  = TWCore alternative quotes (allows use of " and ' within the value)
<div id=[[foo]]>    = TWCore alternative quotes (literal value... *NOT* a link!)
<div id={{foo}}>    = TWCore TextReference (value from tiddler/field)
<div id=<
<foo>>>    = TWCore Macro/Variable (value from macro/variable)

Thus, for your purposes, you could write a custom macro, like this:
\define mytransclude(source)
<div id="$source$">
<$transclude tiddler="$source$"/>
</div>
\end

<<mytransclude "SomeTiddler">>

enjoy,
-e

Dave

unread,
Apr 15, 2016, 5:46:37 PM4/15/16
to TiddlyWiki
Martian,

If you don't mind my asking, what's the purpose of wrapping that in a <div>?

Eric Shulman

unread,
Apr 15, 2016, 6:10:55 PM4/15/16
to TiddlyWiki
On Friday, April 15, 2016 at 2:46:37 PM UTC-7, Dave wrote:
If you don't mind my asking, what's the purpose of wrapping that in a <div>?

I don't know what Martian has in mind, but one possibility is that it allows you to use CSS rules to style transclusion of specific tiddlers by title.  Thus, if you have a tiddler named "FooBar", and you create a CSS rule, #FooBar { background:gray; }, and then use <<mytransclude FooBar>>, it will have a gray background.

-e

Martian

unread,
Apr 18, 2016, 5:01:06 AM4/18/16
to TiddlyWiki
Yep, my idea was near this way.

I am going to create one big tiddler (FSD) by transcluding many others. And I need to be able to trace back original tiddlers but rather with metadata then with visual links. To be able to work with them stylistically (CSS) and to make some interactive actions with jQuery and CSS-selectors.
Just playing with TW5 now, not clear what to get at the end.

суббота, 16 апреля 2016 г., 1:10:55 UTC+3 пользователь Eric Shulman написал:

Xavier Cazin

unread,
Apr 18, 2016, 8:33:59 AM4/18/16
to tiddl...@googlegroups.com
Hi,

You might want to get further ideas at http://tiddlywiki.com/editions/text-slicer/index.html which gives an example of how to display a gathering of several tiddlers while making each component accessible (slice up Sample Text first, then look at Sliced up Sample Text).

XC.

-- Xavier Cazin

--
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/19d07bff-668d-4bc6-9794-811dbf23c6e8%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages