Macros inside Code? Is that possible?

64 views
Skip to first unread message

Stephan Hradek

unread,
Nov 28, 2012, 4:48:03 AM11/28/12
to tiddl...@googlegroups.com
Hi!

I just tried this:

{{{host <<tiddler [[General Information::Cname]]>>}}}

and of course it does not work. It's simply displaying all the stuff as code.

Is there any way to get something inside a code-section?

PMario

unread,
Nov 28, 2012, 10:21:25 AM11/28/12
to TiddlyWiki

TW core uses the following CSS definition defined in the shadow
tiddler: StyleSheetLayout

.viewer pre {
padding:0.5em;
margin-left:0.5em;
font-size:1.2em;
line-height:1.4em;
overflow:auto;
}

If you define the following within your StyleSheet tiddler

.myCodeStyle {
font-family: monospace; /*<-*/
padding:0.5em;
margin-left:0.5em;
font-size:1.2em;
line-height:1.4em;
overflow:auto;
}

(Additional changes may be needed. This depends on your requirements)

and use

{{myCodeStyle{ host <<tiddler [[General Information::Cname]]>>}}}

see: {{myCodeStyle{ <- the difference

it should produce what you want.

if it doesn't work, try
{{myCodeStyle{ host <<tiddler [["General Information::Cname"]]>>}}}


====
Additional info, that may or may not be important for you:

TW core renderer creates a html <pre> element if you use {{{ some
text }}} in your tiddler.

a construction like
{{myCssStyle{ some text}}}
creates a html <span class="myCssStyle"> element

a construction like
{{myCssStyle{some text
}}}

creates a html <div class="myCssStyle"> element


hope this helps
-mario

Stephan Hradek

unread,
Nov 29, 2012, 3:50:43 AM11/29/12
to tiddl...@googlegroups.com
Thanks a lot PMario!

I haven't tried it yet, but it looks promising!

Stephan Hradek

unread,
Nov 29, 2012, 6:57:24 AM11/29/12
to tiddl...@googlegroups.com
I added now this to my StyleSheet:
.Code {

font-family: monospace; /*<-*/
padding:0.5em;
margin-left:0.5em;
font-size:1.2em;
line-height:1.4em;
overflow:auto;
}

div.Code {
background: none repeat scroll 0 0 #FFFFCC;
border: 1px solid #FFEE88;
white-space: pre;
}

It looks quite good

TonyM

unread,
Dec 1, 2012, 12:22:08 AM12/1/12
to tiddl...@googlegroups.com
For in line Javascript see
http://www.TiddlyTools.com/#InlineJavascriptPlugin

and look for other development tools at the above site.

Tony
Reply all
Reply to author
Forward
0 new messages