Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2019-11-21 10:26:10
+1 for square brackets, but I’m not in a position to know where negative ranges would be used on my fleet, so it’s a heavy pencil +1. Looks clean, too.
#14 2019-11-21 10:28:12
Bloke wrote #320174:
I’m a bit light on sleep in recent days, it must be said. I don’t think the chocolate-covered coffee beans I munched a few minutes ago were the smartest idea, but they’re getting the job done!
#15 2019-11-21 11:44:04
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 ?
#16 2019-11-21 11:59:55
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.