Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-12-07 14:23:48

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Empty 'break' attr causing a comma to act as a list item separator?

Adding an empty string as break attribute to any(?) txp tag apparently causes a comma to be set as the implicit list item separator character. This is a new behaviour to me, which broke a site in the course of a recent Textpattern version upgrade to 4.8.8, methinks.

I believe this behaviour was not present in older versions. Omitting the break attribute results in a different output.

Let me explain with an example.

<txp:evaluate>foo, bar</txp:evaluate> gives the expected output foo, bar.

<txp:evaluate break="">foo, bar</txp:evaluate> results in the rather unexpected output foobar. The comma is eaten alive.

I wonder if this is the intended behaviour and if I could find it somewhere in the Textbook to improve my txp:knowledge.

Offline

#2 2023-12-07 15:43:58

etc
Developer
Registered: 2010-11-11
Posts: 5,054
Website GitHub

Re: Empty 'break' attr causing a comma to act as a list item separator?

Hi Robert,

My intentions were good, but nothing is bug-free. Could you tell me what tag was broken by this break behaviour? I guess it was not <txp:evaluate />, since it does (did) not accept break attribute.

Offline

#3 2023-12-07 16:13:45

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Empty 'break' attr causing a comma to act as a list item separator?

I had <txp:excerpt break="" escape="tags" /> in the site but now I need <txp:excerpt break="," escape="tags" /> to preserve the commas in the excerpt (which separate the individual items in the messages typed over the heroine image).

Offline

#4 2023-12-07 16:54:12

etc
Developer
Registered: 2010-11-11
Posts: 5,054
Website GitHub

Re: Empty 'break' attr causing a comma to act as a list item separator?

I see. But what was the purpose of break attribute in <txp:excerpt />? At this time break wasn’t (?) global, and <txp:excerpt /> never had its own attributes (they were silently ignored). Just remove break and everything should be fine.

The idea behind recent break bug/feature is to turn it into a poor man’s list tag (we still have none in txp). Typically, one wouldn’t use break with no purpose in non-listing tags. For example, what <txp:site_slogan break="br" /> is expected to output? Now it has a meaning.

Suppose that the site slogan is veni, vidi, vici. Then the output of <txp:site_slogan break="br" /> will be

veni<br>
vidi<br>
vici

By default, strings are broken by comma, but this can be set via breakby attribute: <txp:site_slogan breakby="v" break="br" /> outputs

<br>
eni, <br>
idi, <br>
ici

Offline

#5 2023-12-08 04:50:43

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Empty 'break' attr causing a comma to act as a list item separator?

Just remove break and everything should be fine.

You are simply right.

I cannot remember when, but once when I built this site I think <txp:excerpt /> split its $thing on commas and I got rid of this unwanted behaviour by issuing an empty-string break attibute.

However, issue resolved in the most appealing way: Just doing nothing.

Offline

#6 2023-12-21 14:53:16

etc
Developer
Registered: 2010-11-11
Posts: 5,054
Website GitHub

Re: Empty 'break' attr causing a comma to act as a list item separator?

Since this has bitten yet another site, the implicit breaking is removed. One has to explicitly set breakby attribute now.

No extra work for Robert required.

Offline

Board footer

Powered by FluxBB