Textpattern CMS support forum
Bloke wrote #320168:
Just playing devil’s advocate here, but have we got any concrete use cases in mind where we, or someone using Textpattern, might legitimately use ranges with negative numbers?
Interesting question (more from a theoretical POV), because I don’t think it would be frequent in everyday usage. Hmm, maybe as the result of a
<txp:evaluate /> calculation? I don’t know, just thinking aloud.
I kinda like the
[ ] suggestion that came later in the thread. Still quite readable and understandable.
Last edited by phiw13 (2019-11-21 11:44:40)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
gaekwad wrote #320169:
Out of curiosity: what’s a real-world example of a negative range in Textpattern terms? Bullet point is fine, I’m clearly missing something obvious.
Negative values are rare animals in txp word, but do exist. For example,
shift attribute of
<txp:older /> can be a range of negative values:
<txp:older link shift="-3,-2,-1"> Page <txp:yield item="page" /> </txp:older>
will output three oldest pages (4.8 only). But I agree, that’s an exotic usage and large negative ranges are unlikely to be ever needed. So we could stay with the standard
1-9 notation and add
-9- -1-ish patterns parsing as Stef suggests just in case.