Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 4fcfb53cfd
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (24 sloc) 0.825 kb
use v6;
class Text::Markup::Wiki::MediaWiki {
sub entities(*@words) {
return map { "&$_;" }, @words.values;
}
method format($text, :$link_maker) {
my @result_pars;
for split(/\n ** 2..*/, $text) -> $paragraph {
# RAKUDO: Needed right now due to HLL non-mapping.
$paragraph = $paragraph;
my $cleaned_of_whitespace = $paragraph.trans(
[ /\s+/ => ' ' ]
);
my $xml_escaped = $cleaned_of_whitespace.trans(
[ '<', '>', '&', '\'' ] =>
[ entities < lt gt amp #039> ]
);
#my $xml_escaped = $cleaned_of_whitespace;
push @result_pars, "<p>$xml_escaped</p>";
}
return join "\n\n", @result_pars;
}
}
# vim:ft=perl6
Jump to Line
Something went wrong with that request. Please try again.