changeset 1:d17d625d3cdb

tweak
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 10 Nov 2020 19:58:28 +0900
parents b3d63ea31ac9
children f16207a57f9d
files parse.pl
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/parse.pl	Tue Nov 10 19:37:06 2020 +0900
+++ b/parse.pl	Tue Nov 10 19:58:28 2020 +0900
@@ -21,13 +21,11 @@
 
 for my $path (keys %$paths) {
     my $elems = $paths->{$path};
-    print "$path\n";
+    print encode_utf8 "$path\n";
 
-    my @elems = @$elems;
-    if (@elems != 1) {
-      @elems = sort { $b->{createdAt} cmp $a->{createdAt}}  @elems;
-    }
-    my $latest_elem = shift @elems;
+    my @sorted_elems   = sort { $b->{createdAt} cmp $a->{createdAt}}  @$elems;
+    my $latest_elem    = shift @sorted_elems;
+
     my $emit_file_path = path("./emit/$path.md");
     $emit_file_path->parent->mkpath;
     $emit_file_path->spew_utf8($latest_elem->{body});