/[webpac]/trunk2/filter/swish_years.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk2/filter/swish_years.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (hide annotations)
Sun Nov 23 15:37:43 2003 UTC (20 years, 4 months ago) by dpavlin
Original Path: trunk/filter/swish_years.pm
File size: 559 byte(s)
added years filter for swish to support 1983- notation

1 dpavlin 168 # rewrite interval years into separate values for indexing
2     #
3     # e.g. 1998- will be indexed as 1998 1999 2000 2001 2002 2003
4     # 1993-1995 will be 1993 1994 1995
5    
6     sub swish_years {
7     my $out = "";
8     foreach (@_) {
9     if (/(\d{4})\s*-\s*(\d{4})/) {
10     my ($from,$to) = ($1,$2);
11     for (my $i=$from; $i<=$to; $i++) {
12     $out .= $i." ";
13     }
14     } elsif (/(\d{4})-/) {
15     my $from = $1;
16     my @t = localtime(time);
17     my $to = $t[5];
18     $to += 1900;
19     for (my $i=$from; $i<=$to; $i++) {
20     $out .= $i." ";
21     }
22     } else {
23     $out .= "$_ ";
24     }
25     }
26     return $out;
27     }
28    
29     1;

Properties

Name Value
cvs2svn:cvs-rev 1.1

  ViewVC Help
Powered by ViewVC 1.1.26