Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First humble attempts to parallelize htmlify
currently dies with: Internal Error: Unwound entire stack and missed handler
  • Loading branch information
moritz committed Jan 24, 2015
1 parent cd56de3 commit f17ca34
Showing 1 changed file with 41 additions and 36 deletions.
77 changes: 41 additions & 36 deletions htmlify.p6
Expand Up @@ -554,46 +554,51 @@ sub write-search-file () {
spurt("html/js/search.js", $template.subst("ITEMS", $items));
}

sub write-disambiguation-files () {
say 'Writing disambiguation files ...';
for $*DR.grouped-by('name').kv -> $name, $p is copy {
print '.';
my $pod = pod-with-title("Disambiguation for '$name'");
if $p.elems == 1 {
$p = $p[0] if $p ~~ Array;
if $p.origin -> $o {
$pod.contents.push:
pod-block(
pod-link("'$name' is a $p.human-kind()", $p.url),
' from ',
pod-link($o.human-kind() ~ ' ' ~ $o.name, $o.url),
);
}
else {
$pod.contents.push:
pod-block(
pod-link("'$name' is a $p.human-kind()", $p.url)
);
}
sub write-single-disambiguation-file($name, $p is copy) {
my $pod = pod-with-title("Disambiguation for '$name'");
if $p.elems == 1 {
$p = $p[0] if $p ~~ Array;
if $p.origin -> $o {
$pod.contents.push:
pod-block(
pod-link("'$name' is a $p.human-kind()", $p.url),
' from ',
pod-link($o.human-kind() ~ ' ' ~ $o.name, $o.url),
);
}
else {
$pod.contents.push:
pod-block("'$name' can be anything of the following"),
$p.map({
if .origin -> $o {
pod-item(
pod-link(.human-kind, .url),
' from ',
pod-link($o.human-kind() ~ ' ' ~ $o.name, $o.url),
)
}
else {
pod-item( pod-link(.human-kind, .url) )
}
});
pod-block(
pod-link("'$name' is a $p.human-kind()", $p.url)
);
}
}
else {
$pod.contents.push:
pod-block("'$name' can be anything of the following"),
$p.map({
if .origin -> $o {
pod-item(
pod-link(.human-kind, .url),
' from ',
pod-link($o.human-kind() ~ ' ' ~ $o.name, $o.url),
)
}
else {
pod-item( pod-link(.human-kind, .url) )
}
});
}
my $html = p2h($pod, 'routine');
spurt "html/$name.subst(/<[/\\]>/,'_',:g).html", $html;
}

sub write-disambiguation-files () {
say 'Writing disambiguation files ...';
await do for $*DR.grouped-by('name').kv -> $name, $p {
start {
write-single-disambiguation-file($name, $p);
}
my $html = p2h($pod, 'routine');
spurt "html/$name.subst(/<[/\\]>/,'_',:g).html", $html;
}
say '';
}
Expand Down

0 comments on commit f17ca34

Please sign in to comment.