Skip to content

Instantly share code, notes, and snippets.

@osamu2001
Created March 23, 2010 01:09
Show Gist options
  • Save osamu2001/340745 to your computer and use it in GitHub Desktop.
Save osamu2001/340745 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/perl
# ref:http://paranoids.sakura.ne.jp/kaworu/2007-12-31-2.php
use strict;
use warnings;
use ChangeLogReader;
my $stop_date = "0";
my $cl = ChangeLogReader->new(stop_date => $stop_date);
my $fname = "ChangeLog";
my $last_y=0;
my $last_m=0;
my $last_d=0;
my %cats;
$cl->store_changelog_file($fname);
foreach my $ymd (sort keys %{$cl->{all}}) {
my $ent = \%{$cl->{all}->{$ymd}};
my $y = substr($ymd,0,4);
my $m = substr($ymd,5,2);
my $d = substr($ymd,8,2);
print "* $y年\n" if($last_y != $y);
print "** $y年$m月\n" if($last_m != $m);
print "*** $y年$m月$d日\n" if($last_d != $d);
for (my $i = $ent->{curid}; $i >= 1; $i--) {
my $h = $ent->{$i}->{ho};
my $c = $ent->{$i}->{co};
print "**** $h\t";
if (defined $ent->{$i}->{cat}){
print ":";
foreach my $cat(@{$ent->{$i}->{cat}}){
print "${cat}:";
$cats{"${cat}"}=1;
}
}
my @list = split(/\n/, $c);
foreach(@list){
print "$_\n";
}
print "\n";
}
$last_y = $y;
$last_m = $m;
$last_d = $d;
}
print "#+TAGS: ";
foreach my $tag (sort keys %cats) {
print "$tag ";
}
print "\n";
#print %cats;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment