--- /dev/null
+# rewrite interval years into separate values for indexing
+#
+# e.g. 1998- will be indexed as 1998 1999 2000 2001 2002 2003
+# 1993-1995 will be 1993 1994 1995
+
+sub swish_years {
+ my $out = "";
+ foreach (@_) {
+ if (/(\d{4})\s*-\s*(\d{4})/) {
+ my ($from,$to) = ($1,$2);
+ for (my $i=$from; $i<=$to; $i++) {
+ $out .= $i." ";
+ }
+ } elsif (/(\d{4})-/) {
+ my $from = $1;
+ my @t = localtime(time);
+ my $to = $t[5];
+ $to += 1900;
+ for (my $i=$from; $i<=$to; $i++) {
+ $out .= $i." ";
+ }
+ } else {
+ $out .= "$_ ";
+ }
+ }
+ return $out;
+}
+
+1;