Skip to content
This repository was archived by the owner on Nov 16, 2020. It is now read-only.

Commit dddcf99

Browse files
committed
implement footnote display - more work for [Coke]++ and other CSS gurus
1 parent a3b3dc7 commit dddcf99

File tree

2 files changed

+40
-11
lines changed

2 files changed

+40
-11
lines changed

process.pl

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@
4343
my $i = $abbr_index{$abbr};
4444
die "Multiple data points for abbr '$abbr' at line $. -- possible typo?"
4545
if $sections[-1][-1][$i];
46-
# TODO: don't throw away the comments;
4746
$rating = "\N{U+00B1}" if $rating eq "+-";
48-
$sections[-1][-1][$i] = $rating;
47+
$sections[-1][-1][$i] = [$rating, $comment];
4948
}
5049
}
5150
}
@@ -77,6 +76,9 @@ sub write_html {
7776
'?' => 'unknown',
7877
);
7978

79+
my $footnote_counter = 0;
80+
my %footnotes;
81+
8082
my @rows;
8183
for my $s (@sections) {
8284
my @sec = @$s;
@@ -86,15 +88,32 @@ sub write_html {
8688
my @row = @$_;
8789
$ht_row{feature} = shift @row;
8890
$ht_row{compilers} = [ map {
89-
{
90-
status => $row[$_] // '?',
91-
class => $status_map{$row[$_] // '?'},
91+
my $h = {
92+
status => $row[$_][0] // '?',
93+
class => $status_map{$row[$_][0] // '?'},
94+
};
95+
if (my $f = $row[$_][1]) {
96+
$h->{footnote} = ($footnotes{$f} //= ++$footnote_counter);
9297
}
98+
$h;
9399
} 0..($index - 1) ];
94100
push @rows, \%ht_row;
95101
}
96102
}
97103
$t->param(rows => \@rows);
104+
105+
{
106+
my @footnotes = sort { $footnotes{$a} <=> $footnotes{$b} }
107+
keys %footnotes;
108+
my @f = map {
109+
{
110+
id => $footnotes{$_},
111+
text => $_,
112+
}
113+
} @footnotes;
114+
$t->param(footnotes => \@f);
115+
}
116+
98117
if (@ARGV) {
99118
my $filename = shift @ARGV;
100119
open my $out, '>:encoding(UTF-8)', $filename;

template.html

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33

44
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
55
<head>
6-
<title>Feature comparison blah</title>
6+
<title>Feature comparison of Perl 6 compilers</title>
77
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
88
<style type="text/css">
9-
.implemented {
9+
.implemented, .implemented a {
1010
background-color: #3c3;
1111
color: white;
1212
}
13-
.partial {
13+
.partial , .partial a {
1414
background-color: #fb4;
1515
color: #333;
1616
}
17-
.missing {
17+
.missing , .missing a {
1818
background-color: #f55;
1919
color: white;
2020
}
21-
.unknown {
21+
.unknown , .unknown a {
2222
background-color: #ccc;
2323
color: white;
2424
}
@@ -31,6 +31,9 @@
3131
-moz-border-radius: 15px;
3232
border-radius: 15px;
3333
}
34+
.footnote_link {
35+
font-size: 80%
36+
}
3437

3538
.subsection {
3639
padding-top: 1em;
@@ -72,14 +75,21 @@ <h2>Features</h2>
7275
<%else%>
7376
<td><%var feature%></td>
7477
<%loop compilers%>
75-
<td><div class="<%var class%>"><%var status%></div></td>
78+
<td><div class="<%var class%>"><%var status%><%if footnote%> <a href="#footnote_<%var footnote%>" class="footnote_link">(<%var footnote%>)</a><%/if%></div></td>
7679
<%/loop%>
7780
<%/if%>
7881
</tr>
7982
<%/loop%>
8083
</tbody>
8184
</table>
8285

86+
<h3>Footnotes</h3>
87+
<ol>
88+
<%loop footnotes%>
89+
<li id="footnote_<%var id%>"><%var text%></li>
90+
<%/loop%>
91+
</ol>
92+
8393
</body>
8494
</html>
8595

0 commit comments

Comments
 (0)