termcol: declare palette titles in extensible metadata hashes
[sheet.git] / termcol.plp
index 9411ba436523b7bc965b8b99ccaa947b4cd95b60..686316cf8f8f1cb9b3cb6734913147991c001f9b 100644 (file)
@@ -75,8 +75,17 @@ if ($get{v}) {
 my @termlist = qw( cga xterm tango app html xkcd );
 push @termlist, qw( c64 msx2 mac2 risc arnegame ) if exists $get{v};
 for my $term (@termlist) {
-       my ($name, @index) = @{ $palettes->{$term} };
-       my $caption = $name // $term;
+       my ($info, @index) = @{ $palettes->{$term} };
+       my $caption = $info->{name} // $term;
+       $caption = sprintf('<%s %s>%s</%1$s>',
+               $info->{href} ? 'a' : 'span',
+               join(' ',
+                       map { sprintf '%s="%s"', $_, $info->{$_} }
+                       grep { defined $info->{$_} }
+                       qw( href title )
+               ),
+               $caption,
+       ) if $info->{href} or $info->{title};
 
        print '<table>', "\n";
        printf "<caption>%s</caption>\n", $caption;