blob: 6c65eea57739000765980931c725e96c7a6d3eed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
my $page = shift or die 'missing page';
my $outtype = shift or die 'missing output type';
my @pages = ();
while (<>) {
chomp;
@pages = (@pages, $_);
}
my $did = 0;
for (@pages) {
my ($href, $text) = m/^([^\s]*)\s*(.*)$/;
if ($outtype eq 'gemini') {
if ($href ne $page) {
say "=> $href $text";
}
} else {
if (!$did) {
$did = 1;
} else {
print "| ";
}
if ($href eq $page) {
print "$text ";
} else {
print "<a href='$href'>$text</a> ";
}
}
}
say "";
|