Permalink
Browse files

Throw L<> out for now

I can't figure out a way to parse things with '|' in them sanely, as they can be
a mixed parse tree as well as text.
  • Loading branch information...
1 parent 9e4a89c commit 3a7498fb8ec25e526dfc61c0cd6e8b06d8a5bd9d @flussence flussence committed Aug 28, 2011
Showing with 17 additions and 22 deletions.
  1. +17 −22 lib/Pod/To/HTML.pm
View
@@ -239,41 +239,36 @@ multi sub node2inline(Pod::Block::Para $node) returns Str {
multi sub node2inline(Pod::FormattingCode $node) returns Str {
given $node.type {
+ #= Basis
when 'B' { return '<strong>' ~ node2inline($node.content) ~ '</strong>' }
+
+ #= Code
when 'C' { return '<code>' ~ node2inline($node.content) ~ '</code>' }
+
+ #= Escape
when 'E' {
return $node.content.split(q{;}).map({
# Perl 6 numbers = Unicode codepoint numbers
- when /^ \d+ $/ { q{&#} ~ $_ ~ q{;} }
+ when /^ \d+ $/
+ { q{&#} ~ $_ ~ q{;} }
# Lowercase = HTML5 entity reference
- when /^ <[a..z]>+ $/ { q{&} ~ $_ ~ q{;} }
+ when /^ <[a..z]>+ $/
+ { q{&} ~ $_ ~ q{;} }
# Uppercase = Unicode codepoint names
- default { q{<kbd class="todo">E&lt;} ~ node2text($_) ~ q{&gt;</kbd>} }
+ default
+ { q{<kbd class="todo">E&lt;} ~ node2text($_) ~ q{&gt;</kbd>} }
}).join;
}
- when 'I' { return '<mark>' ~ node2inline($node.content) ~ '</mark>' }
- when 'L' {
- my ($label, $link);
- if $node.content ~~ /^ (<-[|]>+) '|' (.*) $/ {
- ($label, $link) = $/.[0,1];
- }
- else {
- $link = $node.content;
-
- if $node.content.substr(0, 1) eq '#' {
- $label = $node.content.substr(1);
- }
- else {
- $label = $node.content;
- }
- }
+ #= Important
+ when 'I' { return '<mark>' ~ node2inline($node.content) ~ '</mark>' }
- return qq[<a href="{escape_uri($link)}">] ~ node2inline($label) ~ '</a>';
- }
+ #= Unimportant
when 'U' { return '<em>' ~ node2inline($node.content) ~ '</em>' }
+
+ # TODO
default {
- return $node.type ~ q{=} ~ node2inline($node.content);
+ return $node.type ~ q{&lt;} ~ node2inline($node.content) ~ q{&gt;};
}
}
}

0 comments on commit 3a7498f

Please sign in to comment.