Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Type graphs: eliminate prose, add links to SVG (daxim++)
Closes #283
  • Loading branch information
AlexDaniel committed Jun 21, 2016
1 parent c60a60c commit d116737
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
13 changes: 6 additions & 7 deletions htmlify.p6
Expand Up @@ -288,15 +288,14 @@ multi write-type-source($doc) {
}

if $type {
my $tg-preamble = qq[<h1>Type graph</h1>\n<p>Below you should see a
clickable image showing the type relations for $podname that links
to the documentation pages for the related types. If not, try the
<a href="/images/type-graph-{href_escape $podname}.png">PNG
version</a> instead.</p>];
my $graph-contents = slurp 'template/type-graph.html';
$graph-contents .= subst('ESCAPEDPODNAME', uri_escape($podname), :g);
$graph-contents .= subst('PODNAME', $podname);
$graph-contents .= subst('INLINESVG', svg-for-file("html/images/type-graph-$podname.svg"));

$pod.contents.append: Pod::Raw.new(
target => 'html',
contents => $tg-preamble ~ svg-for-file("html/images/type-graph-$podname.svg"),

contents => $graph-contents,
);

my @mro = $type.mro;
Expand Down
10 changes: 10 additions & 0 deletions template/type-graph.html
@@ -0,0 +1,10 @@
<h1>Type graph</h1>
<figure>
<figcaption>Type relations for <code>PODNAME</code></figcaption>
INLINESVG
<p class="fallback">
Stand-alone image:
<a rel="alternate" href="/images/type-graph-ESCAPEDPODNAME.svg" type="image/svg+xml">vector</a>,
<a rel="alternate" href="/images/type-graph-ESCAPEDPODNAME.png" type="image/png">raster</a>
</p>
</figure>

0 comments on commit d116737

Please sign in to comment.