Categories > TinyButStrong general >

No newline between occurrences of a block

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: fpierrat
Date: 2011-10-28
Time: 14:06

No newline between occurrences of a block

Hi,

Given the following template extract:
<ul>
    <li>[tpl_bloc_navi;block=li]<a href="[tpl_bloc_navi.link]">[tpl_bloc_navi.text]</a></li>
</ul>

it gives following result:
<ul>
    <li><a href="http://google.com">Google</a></li><li><a href="http://yahoo.com">Yahoo</a></li><li><a href="http://hotmail.com">Hotmail</a></li>
</ul>

But I would like it like this:
<ul>
    <li><a href="http://google.com">Google</a></li>
    <li><a href="http://yahoo.com">Yahoo</a></li>
    <li><a href="http://hotmail.com">Hotmail</a></li>
</ul>

I don't know what to do to get a newline+tabs between each new occurrence of the printed array.

Thanks in advance.

Nota bene: in this short example, it would be possible with "bloc=_" instead of "block=li".
But I'd like a solution that works even if the block is bigger than one single line.
The only solution I found is to use the syntax [blocname;block=begin].....[blocname;block=end], with the return char included between both. But I prefer the [block=htmltag] syntax...
Is there a solution?
By: Skrol29
Date: 2011-10-29
Time: 22:41

Re: No newline between occurrences of a block

Hi,

It's not so easy because you'd like a block relative to tag and line-breaks in the same time.
You should try with something like : "block=li+_"
By: fpierrat
Date: 2011-11-05
Time: 14:33

Re: No newline between occurrences of a block

Hi,
Thanks for your answer.
It half works like you said; it takes the newline with (the one after the closing </li>, but not the tabulations (the ones before the opening <li>).
So it looks like this:
<div>
    <ul>
        <li><a href="http://google.com">Google</a></li>
<li><a href="http://yahoo.com">Yahoo</a></li>
<li><a href="http://hotmail.com">Hotmail</a></li>
    </ul>
    ...
</div>
The working solution based on your answer: "block=_+(li)+_".
Maybe it doesn't look very smart, but it looks still better than a "block=begin / block=end" for short blocks !