Skip to content

Commit bbdfc5b

Browse files
committed
Update FormattingCode formatter to use @.meta (needs latest Rakudo)
1 parent ad1bd15 commit bbdfc5b

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

lib/Pod/To/HTML.pm

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,9 @@ multi sub node2inline(Pod::FormattingCode $node) returns Str {
431431
432432
#= Links
433433
when 'L' {
434-
my $url = node2inline($node.content);
435-
my $text = $url;
436-
if $url ~~ /'|'/ {
437-
$text = $/.prematch;
438-
$url = $/.postmatch;
439-
} elsif $text ~~ /^'#'/ {
434+
my $text = node2inline($node.content);
435+
my $url = $node.meta[0] // $text;
436+
if $text ~~ /^'#'/ {
440437
# if we have an internal-only link, strip the # from the text.
441438
$text = $/.postmatch
442439
}
@@ -453,24 +450,17 @@ multi sub node2inline(Pod::FormattingCode $node) returns Str {
453450
}
454451
455452
when 'D' {
456-
# TODO memorise these definitions and display them properly
453+
# TODO memorise these definitions (in $node.meta) and display them properly
457454
my $text = node2inline($node.content);
458-
if $text ~~ /'|'/ {
459-
$text = $/.prematch;
460-
}
461455
return qq[<defn>{$text}</defn>]
462456
}
463457
464458
when 'X' {
465459
# TODO do something with the crossrefs
466460
my $text = node2inline($node.content);
467-
my $defns = $text;
468-
if $text ~~ /'|'/ {
469-
$defns = $/.postmatch;
470-
$text = $/.prematch;
471-
}
472-
my @indices = $defns.split(/\s*';'\s*/).map:
473-
{ .split(/\s*','\s*/).join("--") }
461+
my @indices = $node.meta;
462+
# my @indices = $defns.split(/\s*';'\s*/).map:
463+
# { .split(/\s*','\s*/).join("--") }
474464
%crossrefs{$_} = $text for @indices;
475465
return qq[<span name="@indices[]">$text\</span>];
476466
}

0 commit comments

Comments
 (0)