How indent all listed content, not only first paragraph

164 views
Skip to first unread message

twgrp

unread,
Jun 30, 2012, 10:19:57 AM6/30/12
to TiddlyWiki
Via a simple forEach I'm generating a list to show the title and
contents of each listed tiddler.

For each listed item, the first paragraph indents nicely but the
indentation is lost once there is a new paragraph/line break, like
this:

-----------------------------------------
* title1
__paragraph1, nicely indented

paragraph2, shood be indentated too... but, nope, ain't
-----------------------------------------


<<forEachTiddler where 'tiddler.tags.contains("tag1")'
write '"* [["+tiddler.title+"]]\n{{indent{<<tiddler [["+tiddler.title
+"]]$))}}}\n\n"'
>>

I figure there must be a solution because if I use eg. second level
bullets (**) all paragraphs indent properly. I've searched the
archives but I can't quite find anything discussing this particular
aspect.

Thank you!

PMario

unread,
Jun 30, 2012, 10:37:05 AM6/30/12
to TiddlyWiki
How does your .indent CSS look like?

can yout try:

<<forEachTiddler where 'tiddler.tags.contains("tag1")'
write '"* [["+tiddler.title+"]]\n<<tiddler [["+tiddler.title
+"]] "indent">>\n\n"'

Transcluding a tiddler like:
<<tiddler [[tidName]] "indent">>

is very similar to your snippet but imo produces a different HTML DOM
structure.

I didn't test it. so it is a hint only
-m

twgrp

unread,
Jun 30, 2012, 12:45:25 PM6/30/12
to TiddlyWiki
Thank you Mario (as always), but I put up a simple test case
http://tabort4.tiddlyspace.com/#fet (pmario added)

> <<tiddler [[tidName]] "indent">>

yields the same result: second paragraph not indented. BTW, that's a
tiddler macro argument I'm not familiar with and was quite surprised
to see it work at all!

...but maybe it is a ".indent CSS" matter. I find it in
StyleSheetLayout where it says:

#contentWrapper
.indent {margin-left:3em;}

Not sure what to do...

:-)

PMario

unread,
Jul 1, 2012, 10:52:40 AM7/1/12
to TiddlyWiki

> #contentWrapper
> .indent {margin-left:3em;}
it dosn't belong to #contentWrapper it's just near its definition

I did some tests at you space. It seems to be a problem, that TW
paragarphs are text nodes and in this case inside a <span> element,
that is not a block type element. But I'm not sure about this ;)

if you add this to [[StyleSheet]] content

.myIndent {
display: block;
margin-left: 3em;
}

and use myIndent instead of indent it seems to work. I did use a new
class style since .indent display:block may have unknown side effects.

have fun!
-mario

TonyM

unread,
Jul 4, 2012, 1:08:45 AM7/4/12
to tiddl...@googlegroups.com
If you are using a NestedSlider you can use the ">" automatically adds blockquote formatting to slider content whci is similar to indent.

I have done this in a cascading set of ForEachTiddlers

Regards
TonyM

Jacques Turbé

unread,
Jul 4, 2012, 4:31:48 AM7/4/12
to tiddl...@googlegroups.com
Or just use  the ":" dt indent in your format ?
 

<<forEachTiddler where 'tiddler.tags.contains("tag1")'
        write        '"* [["+tiddler.title+"]]\n:<<tiddler [["+tiddler.title
+"]]$))\n\n"'
>>

(hope it works, I haven't tested !)

J.

twgrp

unread,
Jul 8, 2012, 8:40:55 AM7/8/12
to TiddlyWiki
For the record,

pmario's solution does the trick, ie. in StyleSheet, add:

.myIndent {display: block; margin-left: 3em;}

The idea with a > inside the NestedSlider works but gives a vertical
line along the block. Not always desired.
The idea with a : does not work in this context.

@coredev - I find it odd that default {{indent{}}} is not defined to
work for this.

Thank you all!

<:-)

Eric Shulman

unread,
Jul 8, 2012, 9:04:14 AM7/8/12
to TiddlyWiki
> pmario's solution does the trick, ie. in StyleSheet, add:
> .myIndent {display: block; margin-left: 3em;}

Here's another CSS trick that works with bullets at all levels, and
does not need any StyleSheet definition at all: simply put a CSS-
wrapper around the extra lines of indented content, and make sure to
start the wrapper on the end of the first line of the bullet item (the
one with the *). Because the CSS wrapper starts on that first line,
the content within the wrapper is formatted with the same indentation.

Thus, the following TW syntax:

* text for item #1 {{wrapper{
more content

including blank lines as desired}}}
** text for item #1.1{{wrapper{
2nd level extra lines
etc}}
* text for item #2
* text for item #3

results in:

* text for item #1
more content

including blank lines as desired
* text for item #1.1
2nd level extra lines
etc
* text for item #2
* text for item #3

Note how the indent matches the current bullet item regardless of the
level, rather than being a fixed amount (e.g., "margin-left: 3em").
Also note that the CSS classname "wrapper" is a placeholder. It
doesn't need to be defined in the StyleSheet, since it's only purpose
is to create a 'container element' to hold the extra lines of bullet
item content.

In your original fET loop, you wrote:
-----------
<<forEachTiddler where 'tiddler.tags.contains("tag1")'
write '"* [["+tiddler.title+"]]\n{{indent{<<tiddler
[["+tiddler.title
+"]]$))}}}\n\n"'
-----------

Try this:
change the CSS classname (from "indent" to some placeholder) and move
the "\n" to follow the opening of the CSS wrapper, like this:
-----------
<<forEachTiddler where 'tiddler.tags.contains("tag1")'
write '"* [["+tiddler.title+"]]{{wrapper{\n<<tiddler
[["+tiddler.title
+"]]$))}}}\n\n"'
-----------

enjoy,
-e

twgrp

unread,
Jul 8, 2012, 10:55:21 AM7/8/12
to TiddlyWiki
Now that is one even more general solution to an even more recurring
problem (ie. broken bullet lists).
And so simple at that !
Thank you!!

<:-)


P.S Now the mystery arises how the heck Eric can get his indentation
so perfect on the google forum!!? LOL!


(I minor detail for anyone copy-pasting direclty, there's a missing }
Reply all
Reply to author
Forward
0 new messages