Skip to content

Commit 5d7eac4

Browse files
committed
linkthem: add index generator
1 parent d36ea09 commit 5d7eac4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

linkthem.pl

+35
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ sub fixup {
4646
my $f = $a[$i];
4747
my @n;
4848
my $blank;
49+
my $title;
4950
open(F, "<$f");
5051
while(<F>) {
5152
chomp;
53+
if(/^# (.*)/ && !$title) {
54+
$name{$f} = $1;
55+
$title = 1;
56+
}
5257
if(/^## Links/) {
5358
last;
5459
}
@@ -73,3 +78,33 @@ sub fixup {
7378
for $i (0 .. $#a) {
7479
fixup($i);
7580
}
81+
82+
sub dateit {
83+
my ($path) = @_;
84+
# remove the leading year dir
85+
$path =~ s/\d\d\d\d\///;
86+
# remove the extension
87+
$path =~ s/\.md\z//;
88+
return $path;
89+
}
90+
91+
print <<HEAD
92+
# All emails listed
93+
94+
This is the full index of the emails in the collection.
95+
96+
|num|name|date|
97+
|---|----|----|
98+
HEAD
99+
;
100+
for $i (0 .. $#a) {
101+
my $f = $a[$i];
102+
printf "|%d|[%s](%s)|%s|\n", $i + 1, $name{$f}, $f, dateit($f);
103+
}
104+
105+
106+
print <<HEAD
107+
108+
[back to main page](../)
109+
HEAD
110+
;

0 commit comments

Comments
 (0)