Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Extract title contents in its own routine
  • Loading branch information
Paul Cochrane committed Mar 11, 2015
1 parent 2b1bc9b commit 868d277
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions htmlify.pl
Expand Up @@ -91,13 +91,8 @@
));
}
else {
my $title-element = $pod[0].contents[0];
if $title-element ~~ Pod::Block::Named && $title-element.name eq "TITLE" {
my $title = $title-element.contents[0].contents[0];
}
else {
say "$file lacks a TITLE";
}
# XXX: $file should be part of $pod metadata
pod-title-contents($pod, $file);
}
$pod.push: source-reference($file, $category);
my $html-file = $file.subst(/\.p(l|6)/, ".html");
Expand All @@ -106,6 +101,19 @@
}
}

sub pod-title-contents($pod, $file) {
my $title-element = $pod[0].contents[0];
my $title;
if $title-element ~~ Pod::Block::Named && $title-element.name eq "TITLE" {
$title = $title-element.contents[0].contents[0];
}
else {
say "$file lacks a TITLE";
}

return $title;
}

sub source-reference($file, $category) {
pod-block("Source code: ",
pod-link($file.basename,
Expand Down

0 comments on commit 868d277

Please sign in to comment.