Permalink
Browse files

[p6w] successful implementation of XML escaping

  • Loading branch information...
1 parent bcbbc45 commit 17214c92af537051c4480cd305d673dba85338c1 @masak masak committed Nov 13, 2008
Showing with 11 additions and 14 deletions.
  1. +11 −14 p6w/Text/Markup/Wiki/MediaWiki.pm
@@ -7,22 +7,20 @@ class Text::Markup::Wiki::MediaWiki {
}
method format($text, :$link_maker) {
- say $text;
my @result_pars;
- my @split = gather {
- my $text_copy = $text;
- while $text_copy.index("\n\n") -> $ix {
- take $text_copy.substr(0, $ix);
- $text_copy .= substr($ix);
- while $text_copy.substr(0,1) eq "\n" {
- $text_copy .= substr(1);
- }
- }
- if $text_copy {
- take $text_copy;
+ my @split;
+ my $text_copy = $text;
+ while $text_copy.index("\n\n") -> $ix {
+ push @split, $text_copy.substr(0, $ix);
+ $text_copy .= substr($ix);
+ while $text_copy.substr(0,1) eq "\n" {
+ $text_copy .= substr(1);
}
- };
+ }
+ if $text_copy {
+ push @split, $text_copy;
+ }
# RAKUDO: Awaiting HLL type conversion
#for split(/\n ** 2..*/, $text) -> $paragraph {
@@ -54,7 +52,6 @@ class Text::Markup::Wiki::MediaWiki {
my @xml_escaped_new;
for split '', $cleaned_of_whitespace -> $c {
- say $c, '!', %conversions{$c}, '!', entities %conversions{$c};
push @xml_escaped_new, %conversions.exists( $c )
?? entities %conversions{$c}
!! $c;

0 comments on commit 17214c9

Please sign in to comment.