diff options
author | Russ Allbery <rra@cpan.org> | 2021-09-14 20:30:22 -0700 |
---|---|---|
committer | Russ Allbery <rra@cpan.org> | 2021-09-14 20:30:22 -0700 |
commit | ddad2fc296bc353265004c5ec3700a7a921888bb (patch) | |
tree | 746db58592b0ebb6832442177939c3ae6f3179b3 | |
parent | dc9ba8b08b01c3793121d11748714fdd4fd3b3d6 (diff) |
Fix localization of RSS dates
Fix unintended localization of dates in RSS output, which are supposed
to be RFC 2822 dates and therefore always use English month and day of
week names. Thanks to Slaven Rezić for testing.
-rw-r--r-- | Changes | 6 | ||||
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | docs/docknot.yaml | 1 | ||||
-rw-r--r-- | lib/App/DocKnot/Command.pm | 12 | ||||
-rw-r--r-- | lib/App/DocKnot/Spin/RSS.pm | 11 | ||||
-rw-r--r-- | t/data/generate/docknot/output/thread | 1 |
7 files changed, 23 insertions, 10 deletions
@@ -1,5 +1,11 @@ Revision history for DocKnot +5.01 - Not Released + + - Fix unintended localization of dates in RSS output, which are supposed + to be RFC 2822 dates and therefore always use English month and day of + week names. Thanks to Slaven Rezić for testing. + 5.00 - 2021-09-12 - Merge spin and spin-rss into this package, making it a full, if highly @@ -51,6 +51,7 @@ REQUIREMENTS Perl 5.24 or later and Module::Build are required to build this module. The following additional Perl modules are required to use it: + * Date::Language (part of TimeDate) * Date::Parse (part of TimeDate) * File::BaseDir * File::ShareDir @@ -56,6 +56,7 @@ for your own purposes. Perl 5.24 or later and Module::Build are required to build this module. The following additional Perl modules are required to use it: +* Date::Language (part of TimeDate) * Date::Parse (part of TimeDate) * File::BaseDir * File::ShareDir diff --git a/docs/docknot.yaml b/docs/docknot.yaml index bf85a81..12b9eb7 100644 --- a/docs/docknot.yaml +++ b/docs/docknot.yaml @@ -124,6 +124,7 @@ requirements: | Perl 5.24 or later and Module::Build are required to build this module. The following additional Perl modules are required to use it: + * Date::Language (part of TimeDate) * Date::Parse (part of TimeDate) * File::BaseDir * File::ShareDir diff --git a/lib/App/DocKnot/Command.pm b/lib/App/DocKnot/Command.pm index 093d0b5..50da1cc 100644 --- a/lib/App/DocKnot/Command.pm +++ b/lib/App/DocKnot/Command.pm @@ -293,12 +293,12 @@ App::DocKnot::Command - Run DocKnot commands =head1 REQUIREMENTS -Perl 5.24 or later and the modules Date::Parse (part of TimeDate), -File::BaseDir, File::ShareDir, Git::Repository, Image::Size, IO::Compress::Xz -(part of IO-Compress-Lzma), IO::Uncompress::Gunzip (part of IO-Compress), -IPC::Run, IPC::System::Simple, JSON::MaybeXS, Kwalify, List::SomeUtils, -Perl6::Slurp, Template (part of Template Toolkit), and YAML::XS, all of which -are available from CPAN. +Perl 5.24 or later and the modules Date::Language, Date::Parse (both part of +TimeDate), File::BaseDir, File::ShareDir, Git::Repository, Image::Size, +IO::Compress::Xz (part of IO-Compress-Lzma), IO::Uncompress::Gunzip (part of +IO-Compress), IPC::Run, IPC::System::Simple, JSON::MaybeXS, Kwalify, +List::SomeUtils, Perl6::Slurp, Template (part of Template Toolkit), and +YAML::XS, all of which are available from CPAN. =head1 DESCRIPTION diff --git a/lib/App/DocKnot/Spin/RSS.pm b/lib/App/DocKnot/Spin/RSS.pm index 7599426..dff4665 100644 --- a/lib/App/DocKnot/Spin/RSS.pm +++ b/lib/App/DocKnot/Spin/RSS.pm @@ -18,6 +18,7 @@ use warnings; use App::DocKnot; use App::DocKnot::Spin::Thread; use Cwd qw(getcwd); +use Date::Language (); use Date::Parse qw(str2time); use File::Basename qw(fileparse); use Perl6::Slurp qw(slurp); @@ -405,8 +406,9 @@ sub _rss_output { # Determine the current date and latest publication date of all of the # entries, published in the obnoxious format used by RSS. + my $lang = Date::Language->new('English'); my $format = '%a, %d %b %Y %H:%M:%S %z'; - my $now = strftime($format, localtime()); + my $now = $lang->strftime($format, [localtime()]); my $latest = $now; if ($entries_ref->@*) { $latest = strftime($format, localtime($entries_ref->[0]{date})); @@ -439,7 +441,7 @@ EOC # Output each entry, formatting the contents of the entry as we go. for my $entry_ref ($entries_ref->@*) { - my $date = strftime($format, localtime($entry_ref->{date})); + my $date = $lang->strftime($format, [localtime($entry_ref->{date})]); my $title = _escape($entry_ref->{title}); my $description; if ($entry_ref->{description}) { @@ -813,8 +815,9 @@ App::DocKnot::Spin::RSS - Generate RSS and thread from a feed description file =head1 REQUIREMENTS -Perl 5.006 or later and the modules Date::Parse (part of the TimeDate -distribution) and Perl6::Slurp, both of which are available from CPAN. +Perl 5.006 or later and the modules Date::Language, Date::Parse (both part of +the TimeDate distribution), and Perl6::Slurp, both of which are available from +CPAN. =head1 DESCRIPTION diff --git a/t/data/generate/docknot/output/thread b/t/data/generate/docknot/output/thread index f2044cd..6806bbf 100644 --- a/t/data/generate/docknot/output/thread +++ b/t/data/generate/docknot/output/thread @@ -104,6 +104,7 @@ for your own purposes. Perl 5.24 or later and Module::Build are required to build this module. The following additional Perl modules are required to use it: +\bullet(packed)[Date::Language (part of TimeDate)] \bullet(packed)[Date::Parse (part of TimeDate)] \bullet(packed)[File::BaseDir] \bullet(packed)[File::ShareDir] |