Subject: | %{ and %} do not work as the documentation says they should |
Hello,
The documentation for strftime says that %{ and %} are used to enclose
the part of the string which is to be replaced with the words "St.
Tib's
Day" if the current day is St. Tib's Day.
I used the format "%{%A, the %e day of %B%} in the YOLD
%Y%N%nCelebrate %H",
which using 'strings ddate', and it the result is " in the YOLD 3172".
Which looks wrong.
I've attached to this message a patch for Discordian.pm that does what
I understand the documenation says, and a patch for the test script.
Let me know if I was wrong,
Thanks!
Philippe "BooK" Bruhat
Subject: | Discordian.pm.diff |
--- Discordian.pm.orig 2006-01-23 22:13:49.057238664 +0100
+++ Discordian.pm 2006-01-23 22:35:51.229237968 +0100
@@ -222,7 +222,7 @@
{
($self->{day} eq "St. Tib's Day" ||
($self->{day} != 5 && $self->{day} != 50)) ? s/%N.+$// : s/%N//g;
- ($self->{day} ne "St. Tib's Day") ? s/%\{.+?%\}//g : s/%[\{|\}]//g;
+ ($self->{day} eq "St. Tib's Day") ? s/%\{.+?%\}/%d/g : s/%[{}]//g;
s/%([%*A-Za-z])/ $formats{$1} ? $formats{$1}->($self) : $1 /ge;
return $_ unless wantarray;
Subject: | 8-strftime.t.diff |
--- 8-strftime.t.orig 2004-10-07 00:48:09.000000000 +0200
+++ 8-strftime.t 2006-01-23 22:34:09.386720384 +0100
@@ -12,11 +12,11 @@
is(DateTime::Calendar::Discordian->from_object(
object => DateTime->new(day => 29, month => 2, year =>, 2000,)
- )->strftime("%{Happy St. Tib's Day!%}"), "Happy St. Tib's Day!", 'date 3');
+ )->strftime("%{%A, the %e day of %B%} in the YOLD %Y"), "St. Tib's Day in the YOLD 3166", 'date 3');
is(DateTime::Calendar::Discordian->from_object(
object => DateTime->new(day => 28, month => 2, year =>, 2000,)
- )->strftime("%{Happy St. Tib's Day!%}"), "", 'date 4');
+ )->strftime("%{%A, the %e day of %B%} in the YOLD %Y"), "Prickle-Prickle, the 59th day of Chaos in the YOLD 3166", 'date 4');
is(DateTime::Calendar::Discordian->new(day => 50, season => 'Discord',
year => 3170,)->strftime("%NHappy %H"), "Happy Discoflux", 'date 5');