-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to repeat items with no new line inserted #110
Comments
I have actually experimented quite a bit with this, but got stuck in details and issues. It's not impossible to pull it off, and your syntax is pretty good I think. |
An alternative to the above syntax might be:
|
@malthe @anthonygerrard When I do
I always get:
I need to generate a continuos line with spans adjustent and I can not seem to do that in anyway in Chameleon |
Potential fix here: https://bugs.launchpad.net/zope3/+bug/229931/comments/8 |
What happens if you do e.g. |
So this:
Produces this (with newlines):
|
@malthe In short, insteat if "hello" I always get "h e l l o" |
Also based on this https://mail.zope.org/pipermail/zpt/2002-November/004078.html it appears that zpt supported that as functionality way back |
@malthe
test.pt
test.py
output:
|
so the question is whether to implement "tal:whitespace=false" fix described in the ubuntu bug or to fix the Chameleon tal:block behaviour. Btw, I've looked over the block code and I have no clue how to do the latter. Meanwhile I have a patched code chameleon, but I am really at a loss how what to do next. Do you think this is something you can address? |
Sure, I just have to fit it into my schedule. I think Zope's behavior is On Monday, November 11, 2013, goodwillcoding wrote:
Malthe Borch |
The fix does work for "tal" namespace. However I did miss a scenario in the original test. As it appears zope.tal might be doing this for any "tal:repeat" test.pt:
test.py:
output:
|
Expanding on the test a little more, seem the logic is conditional: test.pt
output:
|
As you said this was tricky as shown by more tests: test.pt:
output:
|
Zope also has this HTML mode where it behaves differently depending on the tag. We do support some of that via configuration options but obviously not all of it. |
The question is whether the current fix is enough to let you do what you want. It doesn't always make sense to replicate every last Zopeism out there. |
Ok the commonality seems to be presence of tal:content so far in every use case I have thought off. Basically the conditionally the conditional here : chameleon/src/chameleon/zpt/program.py Line 398 in 8d2e415
This also passes all the current tests, though I am sure if this is the fix a few more tests can be added. If you are ok with the fix I'll try to do a PR with proper tests. |
That said its possible the bug wih zope.tal because the fix you did actually has greater flexibility IMHO, so I am ok with keeping it. |
I feel that we do need a few more tests, but yes, what I like about "my" fix is that it's fairly easy to explain the rule, i.e. if it's the |
Hi Malthe,
|
I think this is fixed or at least resolved. |
tal:repeat always inserts a new line inbetween repeating elements. Whitespace is sometimes important in HTML and unnecessary whitespace can cause styling problems in some older browsers.
It would be great if Chameleon could support repeating elements, or text, all on the same line.
The equivalent bug in zope.tal project is https://bugs.launchpad.net/zope3/+bug/229931
It seems tricky to do this in a backwards compatible way. A rule that would make sense to me would be that if the repeating element is the first non white space element on its line then add a new line otherwise don't.
e.g.
would result in
but
would result in
The text was updated successfully, but these errors were encountered: