Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes the problem of links-as-arrays
Which I don't really understand, but that's the way it is. Fixes #34.

Also WIP for Raku/doc#2562, will have to be tested.

Adds a ChangeLog for registering changes in every new version. Writes
tests also for new feature.
  • Loading branch information
JJ committed Jan 13, 2019
1 parent a509c00 commit 92f2e4e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -0,0 +1,4 @@
2019-01-13 Juan J. merelo <jmerelo@penny>

* META6.json: Bumps up after fixing the problem with links-that-were-arrays: https://github.com/perl6/perl6-pod-to-bigpage/issues/34

2 changes: 1 addition & 1 deletion META6.json
@@ -1,7 +1,7 @@
{
"perl" : "6.*",
"name" : "Pod::To::BigPage",
"version" : "0.5.0",
"version" : "0.5.1",
"author" : "Perl 6",
"description" : "Render many pod6-files into one (big) html-file.",
"license" : "Artistic-2.0",
Expand Down
3 changes: 0 additions & 3 deletions lib/Pod/To/BigPage.pm6
Expand Up @@ -543,21 +543,18 @@ multi sub handle (Nil, :$pod-name?, :$part-number?, :$toc-counter?) is export {
#| Rewrites a link if needed
sub rewrite-link($link-target is copy, :$part-number!){
$link-target = $link-target[0] if $link-target ~~ Array; # Hack for when links arrive as an array
say "$link-target starts-with → ", $link-target.starts-with(any('a'..'z'));
given $link-target {
when .starts-with( <http:// https:// irc://>) { succeed }
when .starts-with('#') { $link-target = '#' ~ $part-number ~ '-' ~ $link-target.substr(1) }
when so .starts-with(any('a'..'z')) { $link-target = "/routine/$link-target"; proceed }
when so .starts-with(any('A'..'Z')) { $link-target = "/type/$link-target"; proceed }
when .starts-with('/') {
my @parts = $link-target.split('#');
say @parts;
@parts[0] = '#' ~ @parts[0].subst('/', '_', :g) ~ '.pod6';
$link-target = @parts.join('-');
}
default { say "$link-target failed" }
}
say "Result → $link-target";
$link-target
}

Expand Down
4 changes: 3 additions & 1 deletion t/render.t
Expand Up @@ -6,7 +6,7 @@ use Test;
use Pod::To::BigPage;

# Test the rendering of a full page
plan 7;
plan 8;

=begin pod
Expand All @@ -15,6 +15,8 @@ plan 7;
=head2 More stuff here
And just your average text.
And a link that can go wrong: L<Array|/type/Array>
=end pod

setup();
Expand Down

0 comments on commit 92f2e4e

Please sign in to comment.