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

Commit

Permalink
Browse files Browse the repository at this point in the history
implement footnote display - more work for [Coke]++ and other CSS gurus
  • Loading branch information
moritz committed Jul 25, 2011
1 parent a3b3dc7 commit dddcf99
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 deletions.
29 changes: 24 additions & 5 deletions process.pl
Expand Up @@ -43,9 +43,8 @@
my $i = $abbr_index{$abbr};
die "Multiple data points for abbr '$abbr' at line $. -- possible typo?"
if $sections[-1][-1][$i];
# TODO: don't throw away the comments;
$rating = "\N{U+00B1}" if $rating eq "+-";
$sections[-1][-1][$i] = $rating;
$sections[-1][-1][$i] = [$rating, $comment];
}
}
}
Expand Down Expand Up @@ -77,6 +76,9 @@ sub write_html {
'?' => 'unknown',
);

my $footnote_counter = 0;
my %footnotes;

my @rows;
for my $s (@sections) {
my @sec = @$s;
Expand All @@ -86,15 +88,32 @@ sub write_html {
my @row = @$_;
$ht_row{feature} = shift @row;
$ht_row{compilers} = [ map {
{
status => $row[$_] // '?',
class => $status_map{$row[$_] // '?'},
my $h = {
status => $row[$_][0] // '?',
class => $status_map{$row[$_][0] // '?'},
};
if (my $f = $row[$_][1]) {
$h->{footnote} = ($footnotes{$f} //= ++$footnote_counter);
}
$h;
} 0..($index - 1) ];
push @rows, \%ht_row;
}
}
$t->param(rows => \@rows);

{
my @footnotes = sort { $footnotes{$a} <=> $footnotes{$b} }
keys %footnotes;
my @f = map {
{
id => $footnotes{$_},
text => $_,
}
} @footnotes;
$t->param(footnotes => \@f);
}

if (@ARGV) {
my $filename = shift @ARGV;
open my $out, '>:encoding(UTF-8)', $filename;
Expand Down
22 changes: 16 additions & 6 deletions template.html
Expand Up @@ -3,22 +3,22 @@

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Feature comparison blah</title>
<title>Feature comparison of Perl 6 compilers</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<style type="text/css">
.implemented {
.implemented, .implemented a {
background-color: #3c3;
color: white;
}
.partial {
.partial , .partial a {
background-color: #fb4;
color: #333;
}
.missing {
.missing , .missing a {
background-color: #f55;
color: white;
}
.unknown {
.unknown , .unknown a {
background-color: #ccc;
color: white;
}
Expand All @@ -31,6 +31,9 @@
-moz-border-radius: 15px;
border-radius: 15px;
}
.footnote_link {
font-size: 80%
}

.subsection {
padding-top: 1em;
Expand Down Expand Up @@ -72,14 +75,21 @@ <h2>Features</h2>
<%else%>
<td><%var feature%></td>
<%loop compilers%>
<td><div class="<%var class%>"><%var status%></div></td>
<td><div class="<%var class%>"><%var status%><%if footnote%> <a href="#footnote_<%var footnote%>" class="footnote_link">(<%var footnote%>)</a><%/if%></div></td>
<%/loop%>
<%/if%>
</tr>
<%/loop%>
</tbody>
</table>

<h3>Footnotes</h3>
<ol>
<%loop footnotes%>
<li id="footnote_<%var id%>"><%var text%></li>
<%/loop%>
</ol>

</body>
</html>

0 comments on commit dddcf99

Please sign in to comment.