From b26ef270f151c78c489aade4444ccb5fa5f8d4cc Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Fri, 9 Apr 2010 16:46:52 +0200 Subject: [PATCH 01/12] adaptations for building on the new Rakudo master - reordered modules in the Makefile to build in dependency order. makes things faster and less confusing. - removed 'Object' in for loop signature. this should be 'Mu' nowadays, but 'Mu' in pointy blocks is the default anyway, so no need to say it explicitly. - added now-mandatory '()' after interpolated method name. - replaced PIR closure in token with Perl 6 closure. - removed a parsing ambiguity "$0li" which alpha didn't catch. --- Makefile | 12 +++++++----- lib/Dispatcher/Rule.pm | 4 ++-- lib/November/URI/Grammar.pm | 8 +------- lib/Text/Markup/Wiki/MediaWiki.pm | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index c81e4c0..4c41691 100755 --- a/Makefile +++ b/Makefile @@ -1,11 +1,13 @@ PERL6=perl6 -SOURCES=lib/November/CGI.pm lib/Text/Markup/Wiki/Minimal.pm \ +SOURCES=lib/November/URI/Grammar.pm lib/November/URI.pm \ + lib/November/CGI.pm lib/Text/Markup/Wiki/Minimal.pm \ lib/Text/Markup/Wiki/MediaWiki.pm lib/Digest.pm \ - lib/November/Storage.pm lib/November/Storage/File.pm lib/November/Tags.pm \ - lib/November/URI.pm lib/November/URI/Grammar.pm lib/Dispatcher.pm \ - lib/Dispatcher/Rule.pm lib/November/Session.pm lib/November/Utils.pm \ - lib/November/Config.pm lib/Test/InputOutput.pm lib/Test/CGI.pm \ + lib/November/Storage.pm lib/November/Utils.pm \ + lib/November/Config.pm lib/November/Storage/File.pm lib/November/Tags.pm \ + lib/Dispatcher/Rule.pm lib/Dispatcher.pm \ + lib/November/Session.pm lib/November/Utils.pm \ + lib/Test/InputOutput.pm lib/Test/CGI.pm \ lib/November/Cache.pm lib/November.pm PIRS=$(SOURCES:.pm=.pir) diff --git a/lib/Dispatcher/Rule.pm b/lib/Dispatcher/Rule.pm index 2a641b2..96de426 100644 --- a/lib/Dispatcher/Rule.pm +++ b/lib/Dispatcher/Rule.pm @@ -9,14 +9,14 @@ has Code $.code; method match (@chunks) { return False if @chunks != @!pattern; - for @chunks Z @!pattern -> $chunk, Object $rule is copy { + for @chunks Z @!pattern -> $chunk, $rule is copy { my $param; if $rule ~~ Pair { ($param, $rule) = $rule.kv } if ~$chunk ~~ $rule { if $param { - self."$param" = (~$/ || ~$chunk); + self."$param"() = (~$/ || ~$chunk); } else { # RAKUDO: /./ ~~ Regex us false, but /./ ~~ Code is true @!args.push($/ || $chunk) if $rule ~~ Code | Whatever; # should by Regex | Whatever diff --git a/lib/November/URI/Grammar.pm b/lib/November/URI/Grammar.pm index 6adadc7..6851619 100644 --- a/lib/November/URI/Grammar.pm +++ b/lib/November/URI/Grammar.pm @@ -5,13 +5,7 @@ grammar November::URI::Grammar { token authority { [':' ]? }; token host { <-[/&?#:]>* }; token port { (\d**1..5) - 65535 goto fail - $I1 = 1 - fail: - .return ($I1) - }}> + }; token path { ? [ '/'?]* }; # * mb wrong, because that allow '' URI token slash { '/' }; diff --git a/lib/Text/Markup/Wiki/MediaWiki.pm b/lib/Text/Markup/Wiki/MediaWiki.pm index d7780ac..898bfc8 100644 --- a/lib/Text/Markup/Wiki/MediaWiki.pm +++ b/lib/Text/Markup/Wiki/MediaWiki.pm @@ -42,7 +42,7 @@ class Text::Markup::Wiki::MediaWiki { } my &strip_prefix = { - .subst(/'<' ('/'?) <[uo]> 'li>'/, { "<$0li>" }, :g) + .subst(/'<' ('/'?) <[uo]> 'li>'/, { '<' ~ $0 ~ 'li>' }, :g) }; my &surround_with_list = { From d5b14b3c3ea9771e5160ef977c226f523ad81631 Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Tue, 16 Nov 2010 00:34:13 +0100 Subject: [PATCH 02/12] [November] stubbed the class for #73912 --- lib/November.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/November.pm b/lib/November.pm index f00eb93..c0b217a 100644 --- a/lib/November.pm +++ b/lib/November.pm @@ -1,5 +1,8 @@ use v6; +# RAKUDO: Needed because of [perl #73912] +class November { ... } + use November::Session; use November::Cache; use Digest; From 590d5a74a3f0381d0449dc7eef221251e18488be Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Tue, 16 Nov 2010 00:40:44 +0100 Subject: [PATCH 03/12] [wiki] chased after hierarchical changes This file still contained some of the old module names. Fixed that. --- wiki | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wiki b/wiki index 12c0de9..0237df6 100644 --- a/wiki +++ b/wiki @@ -1,17 +1,17 @@ #!perl6 use v6; -use CGI; +use November::CGI; use November; -use Config; +use November::Config; use Text::Markup::Wiki::MediaWiki; -my $c = Config.new( +my $c = November::Config.new( markup => Text::Markup::Wiki::MediaWiki.new(), skin => 'CleanAndSoft' ); my November $wiki = November.new( config => $c, ); -my $cgi = CGI.new; +my $cgi = November::CGI.new; $wiki.handle_request($cgi); From 57a5c0e1ceab1e53711700f3bbb1249aa84ada3f Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Tue, 16 Nov 2010 23:23:56 +0100 Subject: [PATCH 04/12] [November] `is rw` should be `is copy` Seems that nowadays, setting defaults makes paramters readonly despite having an `is rw` trait. Whether this is correct or not is open for debate. Marking with a '# RAKUDO' comment until we know more. --- lib/November.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/November.pm b/lib/November.pm index c0b217a..fce47de 100644 --- a/lib/November.pm +++ b/lib/November.pm @@ -50,7 +50,8 @@ class November does November::Session does November::Cache { $d.dispatch(@chunks); } - method view_page($page is rw='Main_Page') { + # RAKUDO: Should `is rw` work with constant defaults? (It doesn't.) + method view_page($page is copy = 'Main_Page') { $page .= subst('%20', '_', :g); unless $.storage.wiki_page_exists($page) { From d157b1e59d06df794cae9f4a1a2b72d4889f1588 Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Tue, 16 Nov 2010 23:27:15 +0100 Subject: [PATCH 05/12] [November::Cache, November::Storage::File] :e It's C<$file.IO ~~ :e> nowadays, not C<$file ~~ :e>. --- lib/November/Cache.pm | 4 ++-- lib/November/Storage/File.pm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/November/Cache.pm b/lib/November/Cache.pm index 7b0b19f..66fad3b 100644 --- a/lib/November/Cache.pm +++ b/lib/November/Cache.pm @@ -15,14 +15,14 @@ method set-cache-entry( $key, $value ) { method get-cache-entry( $key ) { my $file = self.cache-dir ~ '/' ~ $key; - return Nil unless $file ~~ :e; + return Nil unless $file.IO ~~ :e; my $string = slurp( $file ); return $string; } method remove-cache-entry( $key ) { my $file = self.cache-dir ~ '/' ~ $key; - return unless $file ~~ :e; + return unless $file.IO ~~ :e; unlink( $file ); } diff --git a/lib/November/Storage/File.pm b/lib/November/Storage/File.pm index eafedbf..83d3d89 100644 --- a/lib/November/Storage/File.pm +++ b/lib/November/Storage/File.pm @@ -26,11 +26,11 @@ class November::Storage::File is November::Storage { } method wiki_page_exists($page) { - return ($.content_path ~ $page) ~~ :e; + return ($.content_path ~ $page).IO ~~ :e; } method read_recent_changes { - return [] unless $.recent_changes_path ~~ :e; + return [] unless $.recent_changes_path.IO ~~ :e; return eval( slurp( $.recent_changes_path ) ); } @@ -42,7 +42,7 @@ class November::Storage::File is November::Storage { method read_page_history($page) { my $file = $.content_path ~ $page; - return [] unless $file ~~ :e; + return [] unless $file.IO ~~ :e; my $page_history = eval( slurp($file) ); return $page_history; } @@ -56,7 +56,7 @@ class November::Storage::File is November::Storage { method read_modification($modification_id) { my $file = $.modifications_path ~ $modification_id; - return [] unless $file ~~ :e; + return [] unless $file.IO ~~ :e; return eval( slurp($file) ); } From 96527a7beacf4078a39181347b93bcd5e8659556 Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Sat, 20 Nov 2010 23:24:42 +0100 Subject: [PATCH 06/12] [Text::Markup::Wiki::MediaWiki] fixed .trans call --- lib/Text/Markup/Wiki/MediaWiki.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Text/Markup/Wiki/MediaWiki.pm b/lib/Text/Markup/Wiki/MediaWiki.pm index 898bfc8..f951e0e 100644 --- a/lib/Text/Markup/Wiki/MediaWiki.pm +++ b/lib/Text/Markup/Wiki/MediaWiki.pm @@ -99,7 +99,7 @@ class Text::Markup::Wiki::MediaWiki { $trimmed .= subst( / ^ \s+ /, '' ); $trimmed .= subst( / \s+ $ /, '' ); - my $cleaned_of_whitespace = $trimmed.trans( [ /\s+/ => ' ' ] ); + my $cleaned_of_whitespace = $trimmed.trans( / \s+ / => ' ' ); my $xml_escaped = $cleaned_of_whitespace.trans( [ '<', '>', '&', '\'' ] => From 39ea975ced8ee0509b8f050574b292fc676d57b5 Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Tue, 23 Nov 2010 00:11:14 +0100 Subject: [PATCH 07/12] [November] fixed string interpolation bug See http://strangelyconsistent.org/blog/november-21-2010-just-a-few-wrinkles-to-iron-out --- lib/November.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/November.pm b/lib/November.pm index fce47de..7368834 100644 --- a/lib/November.pm +++ b/lib/November.pm @@ -409,9 +409,9 @@ class November does November::Session does November::Cache { method make_extlink($url, $title) { if $title { - return qq|$title|; + return qq|{$title}|; } else { - return qq|$url|; + return qq|{$url}|; } } } From 0d56401f5f29db0e042d5ddf925e0832511475aa Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Tue, 23 Nov 2010 01:23:12 +0100 Subject: [PATCH 08/12] [November::Tags] remove use of class variables It doesn't seem necessary, and it's not yet implemented in Rakudo. --- lib/November/Tags.pm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/November/Tags.pm b/lib/November/Tags.pm index 3d03340..55b476c 100644 --- a/lib/November/Tags.pm +++ b/lib/November/Tags.pm @@ -4,9 +4,9 @@ use November::Config; class November::Tags { my $server_root = November::Config.new.server_root; - my $.page_tags_path is rw = $server_root ~ 'data/page_tags/'; - my $.tags_count_path is rw = $server_root ~ 'data/tags_count'; - my $.tags_index_path is rw = $server_root ~ 'data/tags_index'; + my $page_tags_path = $server_root ~ 'data/page_tags/'; + my $tags_count_path = $server_root ~ 'data/tags_count'; + my $tags_index_path = $server_root ~ 'data/tags_index'; method update_tags($_: Str $page, Str $new_tags) { my $old_tags = .read_page_tags($page).chomp; @@ -71,39 +71,39 @@ class November::Tags { } method read_page_tags(Str $page) { - my $file = $.page_tags_path ~ $page; - return '' unless $file ~~ :e; + my $file = $page_tags_path ~ $page; + return '' unless $file.IO ~~ :e; return slurp($file); } method write_page_tags(Str $page, Str $tags) { - my $file = $.page_tags_path ~ $page; + my $file = $page_tags_path ~ $page; my $fh = open( $file, :w ); $fh.say($tags); $fh.close; } method read_tags_count() { - my $file = $.tags_count_path; - return {} unless $file ~~ :e; + my $file = $tags_count_path; + return {} unless $file.IO ~~ :e; return eval slurp $file; } method write_tags_count(Hash $counts) { - my $file = $.tags_count_path; + my $file = $tags_count_path; my $fh = open( $file, :w ); $fh.say( $counts.perl ); $fh.close; } method read_tags_index() { - my $file = $.tags_index_path; - return {} unless $file ~~ :e; + my $file = $tags_index_path; + return {} unless $file.IO ~~ :e; return eval slurp $file; } method write_tags_index(Hash $index) { - my $file = $.tags_index_path; + my $file = $tags_index_path; my $fh = open( $file, :w ); $fh.say( $index.perl ); $fh.close; From cab63ddded11183ba7a3aa77c5a2191bc4ea386e Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Tue, 23 Nov 2010 01:24:19 +0100 Subject: [PATCH 09/12] [November::Session] fixed $file ~~ :e It's $file.IO ~~ :e nowadays. --- lib/November/Session.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/November/Session.pm b/lib/November/Session.pm index e2a9436..be4c94a 100644 --- a/lib/November/Session.pm +++ b/lib/November/Session.pm @@ -17,7 +17,7 @@ method remove_session($id) { } method read_sessions { - return {} unless self.sessionfile-path ~~ :e; + return {} unless self.sessionfile-path.IO ~~ :e; my $string = slurp( self.sessionfile-path ); my $stuff = eval( $string ); return $stuff; From 86acff6014e03f5941f4f75ef64a151b6867f3cd Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Tue, 23 Nov 2010 01:24:51 +0100 Subject: [PATCH 10/12] [November] added workaround For [perl #79642], which causes optional hash params to behave strangely when not bound to anything. --- lib/November.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/November.pm b/lib/November.pm index 7368834..afa9dba 100644 --- a/lib/November.pm +++ b/lib/November.pm @@ -371,8 +371,9 @@ class November does November::Session does November::Cache { self.response('list_all_pages.tmpl', %params); } - # RAKUDO: die at hash merge if %params undef, so I use default value - method response ($tmpl, %params?={}, %opts?) { + # RAKUDO: Instead of %params? we do %params = {}, because the former + # doesn't quite work. [perl #79642] + method response ($tmpl, %params = {}, %opts = {}) { my $template = HTML::Template.from_file($.config.template_path ~ $tmpl); $template.with_params( From 932b4b30a02e1cf3b7b6d5ee9c789ef6b3f51180 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 7 Jul 2011 05:38:12 -0600 Subject: [PATCH 11/12] Get test suite running on current rakudo master Many changes to get test suite running under Rakudo master branch. Some general issues: - "

$foo

" now tries to call $foo{'/p'} - Some list flattening behavior is different - Scoping in modules is different - Quantified rules that match 0 times show up as [] now - A Digest::SHA module is needed And a bunch of other random stuff, too. A goal was to keep the changes minimal for now. Just get everything working first, and then bring the code up to current usage. --- lib/Digest.pm | 54 ++++-------------------- lib/Digest/SHA.pm | 22 ++++++++++ lib/Dispatcher/Rule.pm | 14 +++--- lib/November/CGI.pm | 2 +- lib/November/Tags.pm | 29 +++++++------ lib/November/URI.pm | 24 ++++++----- lib/November/Utils.pm | 2 +- lib/Test/InputOutput.pm | 2 +- lib/Text/Markup/Wiki/MediaWiki.pm | 12 ++++-- lib/Text/Markup/Wiki/Minimal.pm | 4 +- t/cgi/01-cgi.t | 10 ++--- t/digest/01-digest.t | 26 ++++++------ t/dispatcher/01-basics.t | 5 ++- t/dispatcher/04-regex.t | 2 +- t/dispatcher/06-set-param.t | 5 +-- t/integration/01-view_page.t | 2 +- t/markup/mediawiki/04-paragraphs.t | 2 +- t/markup/mediawiki/06-links.t | 8 ++-- t/markup/mediawiki/07-italic-and-bold.t | 2 + t/markup/mediawiki/12-unordered-lists.t | 2 + t/markup/mediawiki/13-numbered-lists.t | 2 + t/markup/mediawiki/14-definition-lists.t | 2 + t/markup/mediawiki/15-mixed-lists.t | 2 + t/markup/mediawiki/16-pre.t | 2 + t/markup/minimal/03-escaping.t | 2 +- t/markup/minimal/04-paragraphs.t | 2 +- t/markup/minimal/06-links.t | 4 +- t/storage/index.t | 2 +- t/tags/norm.t | 19 +++------ 29 files changed, 141 insertions(+), 125 deletions(-) create mode 100644 lib/Digest/SHA.pm diff --git a/lib/Digest.pm b/lib/Digest.pm index 1d5eed9..08593f8 100644 --- a/lib/Digest.pm +++ b/lib/Digest.pm @@ -1,49 +1,13 @@ module Digest; -# Known digests: md5, sha1, sha256, sha512, ripemd160 -sub digest(Str $text, Str $algo is copy = 'md5') is export { - $algo = uc $algo; - my $binary = Q:PIR { - .local string text - .local string algo - .local pmc digest - - # Input - $P0 = find_lex '$text' - text = $P0 - $P0 = find_lex '$algo' - algo = $P0 - - # Choose the right digest. - $P1 = loadlib 'digest_group' - if algo == 'MD5' goto MD5 - if algo == 'SHA1' goto SHA1 - if algo == 'SHA256' goto SHA256 - if algo == 'SHA512' goto SHA512 - if algo == 'RIPEMD160' goto RIPEMD160 - MD5: - digest = new 'MD5' - goto COMPUTE - SHA1: - digest = new 'SHA1' - goto COMPUTE - SHA256: - digest = new 'SHA256' - goto COMPUTE - SHA512: - digest = new 'SHA512' - goto COMPUTE - RIPEMD160: - digest = new 'RIPEMD160' +use Digest::MD5; +use Digest::SHA; - COMPUTE: - # Calculate the digest. - digest.'Init'() - digest.'Update'(text) - $S0 = digest.'Final'() - - %r = box $S0 - }; - # Convert to hex. - return [~] map { sprintf '%02x', .ord }, $binary.comb; +# Known digests: md5, sha1, sha256, sha512, ripemd160 +sub digest(Str $text, Str $algo = 'md5') is export { + given $algo { + when 'md5' { return Digest::MD5.md5_hex($text) } + when 'sha256' { return Digest::SHA.sha256_hex($text) } + default { !!! "digest for $algo not yet implemented" } + } } diff --git a/lib/Digest/SHA.pm b/lib/Digest/SHA.pm new file mode 100644 index 0000000..8b1104a --- /dev/null +++ b/lib/Digest/SHA.pm @@ -0,0 +1,22 @@ +class Digest::SHA:auth:ver<0.01> { + pir::load_bytecode('Digest/sha256.pbc'); + + multi method sha256_hex (Str $str) { + my $sha256_hex = Q:PIR { + .local pmc f, g, str + str = find_lex '$str' + f = get_root_global ['parrot'; 'Digest'], '_sha256sum' + $P1 = f(str) + g = get_root_global ['parrot'; 'Digest'], '_sha256_hex' + $S0 = g($P1) + %r = box $S0 + }; + + return $sha256_hex; + } + + multi method sha256_hex (@strs) { + return self.sha256_hex(@strs.join("")); + } +} + diff --git a/lib/Dispatcher/Rule.pm b/lib/Dispatcher/Rule.pm index 96de426..280629c 100644 --- a/lib/Dispatcher/Rule.pm +++ b/lib/Dispatcher/Rule.pm @@ -9,17 +9,21 @@ has Code $.code; method match (@chunks) { return False if @chunks != @!pattern; - for @chunks Z @!pattern -> $chunk, $rule is copy { + # RAKUDO: Z seems to have a bug (fixed in nom), where [1,2] Z [*,*] yields (1, Any, 2, Any): the Whatever is lost + #for @chunks Z @!pattern -> $chunk, $rule is copy { + for ^@chunks -> $i { + my $chunk = @chunks[$i]; + my $rule = @!pattern[$i]; + #note "- chunk ({$chunk.perl}), rule ({$rule.perl})"; my $param; if $rule ~~ Pair { ($param, $rule) = $rule.kv } if ~$chunk ~~ $rule { if $param { - self."$param"() = (~$/ || ~$chunk); + self."$param"() = ~($/ // $chunk); } else { - # RAKUDO: /./ ~~ Regex us false, but /./ ~~ Code is true - @!args.push($/ || $chunk) if $rule ~~ Code | Whatever; # should by Regex | Whatever + @!args.push($/ || $chunk) if $rule ~~ Regex | Whatever; } } else { @@ -35,7 +39,7 @@ method apply { #$!code(| @!args, controller => $.controller, action => $.action ); # workaround: if $!controller and $!action { - $!code(| @!args,action => $.action, controller => $.controller ); + $!code(| @!args, action => $.action, controller => $.controller ); } elsif $!action { $!code(| @!args, action => $.action ); } elsif $!controller { diff --git a/lib/November/CGI.pm b/lib/November/CGI.pm index fce6bf7..f148b9a 100644 --- a/lib/November/CGI.pm +++ b/lib/November/CGI.pm @@ -112,7 +112,7 @@ class November::CGI { } } - sub unescape($string is rw) { + our sub unescape($string is copy) { $string .= subst('+', ' ', :g); # RAKUDO: This could also be rewritten as a single .subst :g call. # ...when the semantics of .subst is revised to change $/, diff --git a/lib/November/Tags.pm b/lib/November/Tags.pm index 55b476c..a4e341f 100644 --- a/lib/November/Tags.pm +++ b/lib/November/Tags.pm @@ -4,9 +4,10 @@ use November::Config; class November::Tags { my $server_root = November::Config.new.server_root; - my $page_tags_path = $server_root ~ 'data/page_tags/'; - my $tags_count_path = $server_root ~ 'data/tags_count'; - my $tags_index_path = $server_root ~ 'data/tags_index'; + # TODO Nasty hack to enable testing to use different paths + has $.page_tags_path is rw = $server_root ~ 'data/page_tags/'; + has $.tags_count_path is rw = $server_root ~ 'data/tags_count'; + has $.tags_index_path is rw = $server_root ~ 'data/tags_index'; method update_tags($_: Str $page, Str $new_tags) { my $old_tags = .read_page_tags($page).chomp; @@ -37,7 +38,9 @@ class November::Tags { } unless any($index{$t}.values) eq $page { $index{$t}.push($page); - $index{$t} = grep { $_ ne '' }, $index{$t}.values; + # RAKUDO: bug w/ var on both lhs and rhs + my @tmp = grep { $_ ne '' }, $index{$t}.values; + $index{$t} = @tmp; } } @@ -64,48 +67,50 @@ class November::Tags { # RAKUDO: @ not implemented yet #if $index{$t} && any(@ $index{$t}) eq $page { if $index{$t} && any($index{$t}.values) eq $page { - $index{$t} = grep { $_ ne $page }, $index{$t}.values; + # RAKUDO: bug w/ var on both lhs and rhs + my @tmp = grep { $_ ne $page }, $index{$t}.values; + $index{$t} = @tmp; } } self.write_tags_index($index); } method read_page_tags(Str $page) { - my $file = $page_tags_path ~ $page; + my $file = $.page_tags_path ~ $page; return '' unless $file.IO ~~ :e; return slurp($file); } method write_page_tags(Str $page, Str $tags) { - my $file = $page_tags_path ~ $page; + my $file = $.page_tags_path ~ $page; my $fh = open( $file, :w ); $fh.say($tags); $fh.close; } method read_tags_count() { - my $file = $tags_count_path; + my $file = $.tags_count_path; return {} unless $file.IO ~~ :e; return eval slurp $file; } method write_tags_count(Hash $counts) { - my $file = $tags_count_path; + my $file = $.tags_count_path; my $fh = open( $file, :w ); $fh.say( $counts.perl ); $fh.close; } method read_tags_index() { - my $file = $tags_index_path; + my $file = $.tags_index_path; return {} unless $file.IO ~~ :e; return eval slurp $file; } method write_tags_index(Hash $index) { - my $file = $tags_index_path; + my $file = $.tags_index_path; my $fh = open( $file, :w ); - $fh.say( $index.perl ); +- $fh.say( $index.perl ); $fh.close; } diff --git a/lib/November/URI.pm b/lib/November/URI.pm index fc75b5e..8dc1877 100644 --- a/lib/November/URI.pm +++ b/lib/November/URI.pm @@ -25,17 +25,17 @@ submethod BUILD(:$uri) { unless $/ { die "Could not parse URI: $uri" } $!uri = $/; - @!chunks = $/ // (''); + @!chunks = @($) || (''); } method scheme { - my $s = $.uri // ''; + my $s = $.uri || ''; # RAKUDO: return 1 if use ~ below die because can`t do lc on Math after return ~$s.lc; } method authority { - my $a = $.uri // ''; + my $a = $.uri || ''; # RAKUDO: return 1 if use ~ below die because can`t do lc on Math after return ~$a.lc; } @@ -43,34 +43,38 @@ method authority { method host { #RAKUDO: $.uri[0] return full now my $h = ~$.uri[0]; - return $h.lc // ''; + return $h.lc || ''; } method port { # TODO: send rakudobug # RAKUDO: $.uri return full now # workaround: - item $.uri[0] // ''; + item $.uri[0] || ''; } method path { - my $p = ~$.uri // ''; + my $p = ~$.uri || ''; return $p.lc; } method absolute { - return ?($.uri // $.scheme); + # RAKUDO: The grammar uses ?, so this should be either Nil or a + # Match object. But Rakudo returns [] or [Match] instead, so we must use + # || instead of // to test. + return ?($.uri || $.scheme); } method relative { - return !($.uri // $.scheme); + # Rakudo: Must use || instead of //, see above. + return !($.uri || $.scheme); } method query { - item $.uri // ''; + item $.uri || ''; } method frag { - my $f = $.uri // ''; + my $f = $.uri || ''; return ~$f.lc; } diff --git a/lib/November/Utils.pm b/lib/November/Utils.pm index 2303c29..dd31c56 100644 --- a/lib/November/Utils.pm +++ b/lib/November/Utils.pm @@ -1,4 +1,4 @@ -use v6; +module November::Utils; sub r_remove( $str is rw ) is export { $str .= subst( /\\r/, '', :g ); diff --git a/lib/Test/InputOutput.pm b/lib/Test/InputOutput.pm index de3156a..b81caae 100644 --- a/lib/Test/InputOutput.pm +++ b/lib/Test/InputOutput.pm @@ -1,5 +1,5 @@ use v6; -use Test; +use Test :EXPORT; class Test::InputOutput { has $.filter; diff --git a/lib/Text/Markup/Wiki/MediaWiki.pm b/lib/Text/Markup/Wiki/MediaWiki.pm index f951e0e..db0e4fa 100644 --- a/lib/Text/Markup/Wiki/MediaWiki.pm +++ b/lib/Text/Markup/Wiki/MediaWiki.pm @@ -8,7 +8,9 @@ grammar Tokenizer { regex italic_marker { '''' } regex wikilink { '[[' \s* \s* ']]' } - regex page { [ \N]+ } + # RAKUDO is not implemented + #regex page { [ \N]+ } + regex page { \N+? } regex extlink { '[' \s* [\s+ ]? \s* ']' } regex url { [<!before ']'> \S]+ } @@ -42,7 +44,9 @@ class Text::Markup::Wiki::MediaWiki { } my &strip_prefix = { - .subst(/'<' ('/'?) <[uo]> 'li>'/, { '<' ~ $0 ~ 'li>' }, :g) + # RAKUDO: -> $/ hack is nonportable; rakudo can't directly use match + # vars in subst closures + .subst(/'<' ('/'?) <[uo]> 'li>'/, -> $/ { '<' ~ $0 ~ 'li>' }, :g) }; my &surround_with_list = { @@ -134,7 +138,9 @@ class Text::Markup::Wiki::MediaWiki { my $url = ~$token<extlink><url>; my $title; - if defined $token<extlink><title> { + # RAKUDO: <foo>? should be Nil if no match, but is [] + #if defined $token<extlink><title> { + if $token<extlink><title> { # RAKUDO: return 1 from ~$token<extlink><title> if title defined, # but thats works: $title = ~$token<extlink><title>[0]; diff --git a/lib/Text/Markup/Wiki/Minimal.pm b/lib/Text/Markup/Wiki/Minimal.pm index be14601..7ac02f8 100644 --- a/lib/Text/Markup/Wiki/Minimal.pm +++ b/lib/Text/Markup/Wiki/Minimal.pm @@ -18,12 +18,12 @@ method format($text, :$link_maker, :$extlink_maker) { my $heading = ~$/<heading><parchunk>[0]; $heading .= subst( / ^ \s+ /, '' ); $heading .= subst( / \s+ $ /, '' ); - $result = "<h1>$heading</h1>"; + $result = "<h1>{$heading}</h1>"; } else { $result = '<p>'; - for $/<parchunk> { + for $/<parchunk>.list { if $_<twext> { $result ~= $_<twext>; } diff --git a/t/cgi/01-cgi.t b/t/cgi/01-cgi.t index 160b25c..ef35437 100644 --- a/t/cgi/01-cgi.t +++ b/t/cgi/01-cgi.t @@ -24,7 +24,7 @@ my @queries = ( 'test=5¶ms=3&words=first%0Asecond', { :test<5>, :params<3>, :words("first\nsecond") }, 'test=foo&test=bar', - { :test<foo bar> }, + { test => [<foo bar>] }, 'test=2;params=2', { :test<2>, :params<2> }, 'test=3;params=3;words=first+second', @@ -56,9 +56,9 @@ $cgi = November::CGI.new(); my @add_params = ( :key1<val> , { :key1<val> }, :key2<val> , { :key1<val>, :key2<val> }, - :key1<val2>, { :key1<val val2>, :key2<val> }, - :key3<4> , { :key1<val val2>, :key2<val>, :key3<4> }, - :key4<4.1> , { :key1<val val2>, :key2<val>, :key3<4>, :key4<4.1> }, + :key1<val2>, { key1 => [<val val2>], :key2<val> }, + :key3<4> , { key1 => [<val val2>], :key2<val>, :key3<4> }, + :key4<4.1> , { key1 => [<val val2>], :key2<val>, :key3<4>, :key4<4.1> }, # Do not consistency :( but we don`t have adverbial syntax to set pairs # with undefined value @@ -71,7 +71,7 @@ for @add_params -> $in, $expected { my $key = $in.key; my $val = $in.value; $cgi.add_param($key, $val); - is_deeply( $cgi.params, $expected, "Add kv: :$key<" ~ ($val or '') ~ ">" ); + is_deeply( $cgi.params, $expected, "Add kv: :{$key}<" ~ ($val or '') ~ ">" ); } is( $cgi.param('key3'), '4', 'Test param' ); diff --git a/t/digest/01-digest.t b/t/digest/01-digest.t index fc5a557..e066a2b 100644 --- a/t/digest/01-digest.t +++ b/t/digest/01-digest.t @@ -2,25 +2,25 @@ use Test; use Digest; -plan 6; +plan 3; my $text = "The quick brown fox jumps over the lazy dog"; -ok(Digest::digest($text) +ok(digest($text) eq "9e107d9d372bb6826bd81d3542a419d6", 'Default is MD5'); -ok(Digest::digest($text, "md5") +ok(digest($text, "md5") eq "9e107d9d372bb6826bd81d3542a419d6", 'MD5 is correct'); -ok(Digest::digest($text, "sha1") - eq "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12", - 'SHA1 is correct'); -ok(Digest::digest($text, "sha256") +#ok(Digest::digest($text, "sha1") +# eq "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12", +# 'SHA1 is correct'); +ok(digest($text, "sha256") eq "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592", 'SHA256 is correct'); -ok(Digest::digest($text, "sha512") - eq "07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6", - 'SHA512 is correct'); -ok(Digest::digest($text, "ripemd160") - eq "37f332f68db77bd9d7edd4969571ad671cf9dd3b", - 'ripemd160 is correct'); +#ok(Digest::digest($text, "sha512") +# eq "07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6", +# 'SHA512 is correct'); +#ok(Digest::digest($text, "ripemd160") +# eq "37f332f68db77bd9d7edd4969571ad671cf9dd3b", +# 'ripemd160 is correct'); diff --git a/t/dispatcher/01-basics.t b/t/dispatcher/01-basics.t index 50479a2..109d505 100644 --- a/t/dispatcher/01-basics.t +++ b/t/dispatcher/01-basics.t @@ -24,7 +24,10 @@ is( $d.dispatch(['']), ok( $d.add( ['foo', 'bar'], { "Yay" } ), '.add(@pattern, $code) -- shortcut for fast add Rule object' ); -nok( $d.dispatch(['foo']), +# RAKUDO: dispatch() returns Failure here, and rakudo gives Null PMC access +# when converting that to Bool; this works around it somehow +#nok( $d.dispatch(['foo']), +nok( $d.dispatch(['foo']) ?? True !! False, 'Dispatcher return False if can`t find matched Rule and do not have default' ); diff --git a/t/dispatcher/04-regex.t b/t/dispatcher/04-regex.t index 7f49aa6..c3f8502 100644 --- a/t/dispatcher/04-regex.t +++ b/t/dispatcher/04-regex.t @@ -17,7 +17,7 @@ $d.add: [ is( $d.dispatch(['foo']), 'Yep!', - "Pattern with regex \w+, put Match in args" + 'Pattern with regex \w+, put Match in args' ); is( $d.dispatch(['foo', '50']), diff --git a/t/dispatcher/06-set-param.t b/t/dispatcher/06-set-param.t index 8b68cdc..1d835d6 100644 --- a/t/dispatcher/06-set-param.t +++ b/t/dispatcher/06-set-param.t @@ -9,7 +9,7 @@ my $d = Dispatcher.new; $d.add: [ [:controller(*), :action(*) ], { 'c:' ~ $:controller ~ ' a:' ~ $:action }, [:controller(*), / \d / ], { $:controller ~ '/' ~ $^a }, - [:controller(*), *, * ], { my $c = $:controller; use "$c"; is($^a, $^b, 'Test within Rule') }, + [:controller(*), *, * ], { my $c = $:controller; require "$c"; is($^a, $^b, 'Test within Rule') }, ]; is( $d.dispatch(['one', 5]), @@ -23,8 +23,7 @@ is( $d.dispatch(['one', 'two']), ); is( $d.dispatch(['Test', 3, 3]), - Bool::False, # But this value hinges on Test.pm behaving wrongly; - # should be changed to Bool::True once Test.pm is fixed. + Bool::True, 'Pattern set controller and action' ); diff --git a/t/integration/01-view_page.t b/t/integration/01-view_page.t index da908d8..c100406 100644 --- a/t/integration/01-view_page.t +++ b/t/integration/01-view_page.t @@ -26,7 +26,7 @@ for @markups X @skins -> $m, $s { my $c = November::Config.new( markup => $m, skin => $s ); my $w = November.new( config => $c ); for %gets.kv -> $page, $description { - my $uri = November::URI.new( 'http://testserver' ~ $page ); + my $uri = November::URI.new( uri => 'http://testserver' ~ $page ); my $cgi = Test::CGI.new( uri => $uri ); $cgi.parse_params( $page ); lives_ok( { $w.handle_request( $cgi ) }, "$m, $s, $description" ); diff --git a/t/markup/mediawiki/04-paragraphs.t b/t/markup/mediawiki/04-paragraphs.t index 4967d70..6cf17c1 100644 --- a/t/markup/mediawiki/04-paragraphs.t +++ b/t/markup/mediawiki/04-paragraphs.t @@ -12,7 +12,7 @@ my @pars = "par 2\nwith\nnewlines in it", "par 3"; my $input = join "\n\n", @pars; -my $expected_output = join "\n\n", map { "<p>$_</p>" }, +my $expected_output = join "\n\n", map { "<p>{$_}</p>" }, "par 1", "par 2 with newlines in it", "par 3"; my $actual_output = $converter.format($input); diff --git a/t/markup/mediawiki/06-links.t b/t/markup/mediawiki/06-links.t index e107000..5b63c35 100644 --- a/t/markup/mediawiki/06-links.t +++ b/t/markup/mediawiki/06-links.t @@ -10,9 +10,11 @@ my $link_maker = { my $l = $^page.ucfirst; my $t = $^title // $^page; $l .= subst(' ', '_', :g); - "<a href=\"/?page=$l\">$t</a>" + qq[<a href="/?page=$l">{$t}</a>]; +} +my $extlink_maker = -> $href, $title { + qq[<a href="$href">{$title}</a>] } -my $extlink_maker = { "<a href=\"$^href\">$^title</a>" } { my $input = 'An example of a [[link]]'; @@ -104,7 +106,7 @@ my $extlink_maker = { "<a href=\"$^href\">$^title</a>" } { my $input = 'This is an [http://example.com] external link'; - my $expected_output = "<p>$input</p>"; + my $expected_output = "<p>{$input}</p>"; my $actual_output = $converter.format($input); is( $actual_output, $expected_output, 'no extlink maker, no conversion' ); diff --git a/t/markup/mediawiki/07-italic-and-bold.t b/t/markup/mediawiki/07-italic-and-bold.t index 63404fa..61472e5 100644 --- a/t/markup/mediawiki/07-italic-and-bold.t +++ b/t/markup/mediawiki/07-italic-and-bold.t @@ -86,6 +86,8 @@ my @tests = ], ; +# RAKUDO: Doesn't respect "use Test :EXPORT" +use Test; use Test::InputOutput; plan +@tests; diff --git a/t/markup/mediawiki/12-unordered-lists.t b/t/markup/mediawiki/12-unordered-lists.t index e529a35..32eb579 100644 --- a/t/markup/mediawiki/12-unordered-lists.t +++ b/t/markup/mediawiki/12-unordered-lists.t @@ -26,6 +26,8 @@ my @tests = ], ; +# RAKUDO: Doesn't respect "use Test :EXPORT" +use Test; use Test::InputOutput; plan +@tests; diff --git a/t/markup/mediawiki/13-numbered-lists.t b/t/markup/mediawiki/13-numbered-lists.t index efa362c..d2bfb58 100644 --- a/t/markup/mediawiki/13-numbered-lists.t +++ b/t/markup/mediawiki/13-numbered-lists.t @@ -26,6 +26,8 @@ my @tests = ], ; +# RAKUDO: Doesn't respect "use Test :EXPORT" +use Test; use Test::InputOutput; plan +@tests; diff --git a/t/markup/mediawiki/14-definition-lists.t b/t/markup/mediawiki/14-definition-lists.t index 172bc01..10e3da2 100644 --- a/t/markup/mediawiki/14-definition-lists.t +++ b/t/markup/mediawiki/14-definition-lists.t @@ -32,6 +32,8 @@ my @tests = ], ; +# RAKUDO: Doesn't respect "use Test :EXPORT" +use Test; use Test::InputOutput; plan +@tests; diff --git a/t/markup/mediawiki/15-mixed-lists.t b/t/markup/mediawiki/15-mixed-lists.t index 7f71f41..49a67d7 100644 --- a/t/markup/mediawiki/15-mixed-lists.t +++ b/t/markup/mediawiki/15-mixed-lists.t @@ -22,6 +22,8 @@ my @tests = ], ; +# RAKUDO: Doesn't respect "use Test :EXPORT" +use Test; use Test::InputOutput; plan +@tests; diff --git a/t/markup/mediawiki/16-pre.t b/t/markup/mediawiki/16-pre.t index b6a254c..a600ca3 100644 --- a/t/markup/mediawiki/16-pre.t +++ b/t/markup/mediawiki/16-pre.t @@ -8,6 +8,8 @@ my @tests = ], ; +# RAKUDO: Doesn't respect "use Test :EXPORT" +use Test; use Test::InputOutput; plan +@tests; todo 'Implement pre text'; diff --git a/t/markup/minimal/03-escaping.t b/t/markup/minimal/03-escaping.t index 315621f..f796df0 100644 --- a/t/markup/minimal/03-escaping.t +++ b/t/markup/minimal/03-escaping.t @@ -15,7 +15,7 @@ my $converter = Text::Markup::Wiki::Minimal.new; for %h.kv -> $input, $abbr { my $expected_escape = '&' ~ $abbr ~ ';'; - my $expected_output = "<p>$expected_escape</p>"; + my $expected_output = "<p>{$expected_escape}</p>"; my $actual_output = $converter.format($input); is( $actual_output, $expected_output, "$input -> $expected_escape" ); diff --git a/t/markup/minimal/04-paragraphs.t b/t/markup/minimal/04-paragraphs.t index df94ddc..bbfeed4 100644 --- a/t/markup/minimal/04-paragraphs.t +++ b/t/markup/minimal/04-paragraphs.t @@ -12,7 +12,7 @@ my @pars = "par 2\nwith\nnewlines in it", "par 3"; my $input = join "\n\n", @pars; -my $expected_output = join "\n\n", map { "<p>$_</p>" }, @pars; +my $expected_output = join "\n\n", map { "<p>{$_}</p>" }, @pars; my $actual_output = $converter.format($input); is( $actual_output, $expected_output, diff --git a/t/markup/minimal/06-links.t b/t/markup/minimal/06-links.t index ae38446..81b5293 100644 --- a/t/markup/minimal/06-links.t +++ b/t/markup/minimal/06-links.t @@ -108,9 +108,9 @@ my $converter = Text::Markup::Wiki::Minimal.new( link_maker => &make_link); sub make_link($page, $title?) { if $title { if $page ~~ m/':'/ { - return "<a href=\"$page\">$title</a>"; + return "<a href=\"$page\">{$title}</a>"; } else { - return "<a href=\"?action=view&page=$page\">$title</a>"; + return "<a href=\"?action=view&page=$page\">{$title}</a>"; } } else { diff --git a/t/storage/index.t b/t/storage/index.t index 59736bb..54a2010 100644 --- a/t/storage/index.t +++ b/t/storage/index.t @@ -29,7 +29,7 @@ is($s.read_index.perl, '["Foo"]', 'Add to index one page'); $s.add_to_index('Bar'); is($s.read_index.perl, '["Foo", "Bar"]', 'Add to index another page'); $s.add_to_index('Foo'); -is($s.read_index.perl, '["Foo", "Bar"]', 'Do not add to index page doubble'); +is($s.read_index.perl, '["Foo", "Bar"]', 'Do not add dup to index page'); $s.afterTest; diff --git a/t/tags/norm.t b/t/tags/norm.t index 3ee4afe..5051c24 100644 --- a/t/tags/norm.t +++ b/t/tags/norm.t @@ -1,7 +1,7 @@ use v6; use Test; -plan 1; +plan 2; use November::Tags; @@ -9,27 +9,22 @@ my @counts_to_test = [ 2, 5, 6, 14 ], [ 0, 4, 5, 10 ], -# RAKUDO: yet another bug, see comments below -# [ 5, 5, 2, 1 ], -# [ 10, 10, 4, 0 ] + [ 5, 5, 2, 1 ], + [ 10, 10, 4, 0 ] ; my $t = November::Tags.new; -for @counts_to_test -> $in, $expected { - - # RAKUDO: list assigment do not implemented - # my $min, $max = $in.min, $in.max; - my $min = $in.min; - my $max = $in.max; +for @counts_to_test -> @in, @expected { + my ($min, $max) = @in.minmax.bounds; # debugging # say $in.perl ~ " min:$min, max:$max"; # RAKUDO: min and max there save its values, and I cant reasign it :( # So, second map work with wrong min and max - my $out = map { $t.norm($_, $min, $max) }, $in.values; + my @out = map { $t.norm($_, $min, $max) }, @in.values; - is_deeply( $out, $expected, 'Normalize: ' ~ $in.perl ); + is_deeply( @out, @expected, 'Normalize: ' ~ @in.perl ); } # vim:ft=perl6 From 368e5e20818dd641545484a3ba8a2bdc5df15d1c Mon Sep 17 00:00:00 2001 From: Tim Smith <tim.dolores@gmail.com> Date: Fri, 8 Jul 2011 14:26:11 -0600 Subject: [PATCH 12/12] Get November wiki itself working on rakudo master All the links in the user interface seem to work now. --- lib/November.pm | 18 ++++++++++-------- lib/November/Utils.pm | 2 +- lib/Text/Markup/Wiki/MediaWiki.pm | 2 +- wiki | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/November.pm b/lib/November.pm index afa9dba..c8ba45f 100644 --- a/lib/November.pm +++ b/lib/November.pm @@ -42,7 +42,7 @@ class November does November::Session does November::Cache { ['out'], { self.log_out }, ['register'], { self.register }, ['recent'], { self.list_recent_changes }, - ['history'], { self.view_page_history(~$^page) }, + ['history', /^ <-[?/]>+ $/], { self.view_page_history(~$^page) }, ['all'], { self.list_all_pages }, ]; @@ -96,7 +96,7 @@ class November does November::Session does November::Cache { } - method edit_page($page is rw) { + method edit_page($page is copy) { $page .= subst('%20', '_', :g); my $sessions = self.read_sessions(); @@ -191,7 +191,9 @@ class November does November::Session does November::Cache { } method read_users { - return {} unless $.config.userfile_path ~~ :e; + # RAKUDO: NYI ~~ :X file + #return {} unless $.config.userfile_path ~~ :e; + return {} unless $.config.userfile_path.IO.e; return eval( slurp( $.config.userfile_path ) ); } @@ -285,7 +287,7 @@ class November does November::Session does November::Cache { } method error_page($message = "An internal error occurred. Apologies.") { - self.response( 'error.tmpl', { MESSAGE => $message } ); + self.response( 'error.tmpl', { MESSAGE => $message ~ "<pre>{self.perl}</pre>" } ); } method list_recent_changes { @@ -296,7 +298,7 @@ class November does November::Session does November::Cache { ); } - method view_page_history($page is rw = 'Main_Page') { + method view_page_history($page is copy = 'Main_Page') { $page .= subst('%20', '_', :g); unless $.storage.wiki_page_exists($page) { @@ -309,7 +311,7 @@ class November does November::Session does November::Cache { self.response('page_history.tmpl', { 'TITLE' => $title, - 'CHANGES' => self.get_changes($page, limit => 50), + 'CHANGES' => self.get_changes(:$page, limit => 50), } ); } @@ -394,9 +396,9 @@ class November does November::Session does November::Cache { my $root = $!config.web_root; if $title { if $page ~~ m/':'/ { - return qq|<a href="{ $root ~ $page }">$title</a>|; + return qq|<a href="{ $root ~ $page }">{$title}</a>|; } else { - return qq|<a href="$root/view/$page">$title</a>|; + return qq|<a href="$root/view/$page">{$title}</a>|; } } else { return sprintf('<a href="%s/%s/%s" %s >%s</a>', diff --git a/lib/November/Utils.pm b/lib/November/Utils.pm index dd31c56..8cb0efb 100644 --- a/lib/November/Utils.pm +++ b/lib/November/Utils.pm @@ -38,7 +38,7 @@ sub get_period ($modif_time, $time_now?) is export { return ($days, $hours, $mins) } -sub time_to_period_str ($time) { +sub time_to_period_str ($time) is export { return False unless $time; my $t = get_period($time); my $str = '~'; diff --git a/lib/Text/Markup/Wiki/MediaWiki.pm b/lib/Text/Markup/Wiki/MediaWiki.pm index db0e4fa..e02f850 100644 --- a/lib/Text/Markup/Wiki/MediaWiki.pm +++ b/lib/Text/Markup/Wiki/MediaWiki.pm @@ -131,7 +131,7 @@ class Text::Markup::Wiki::MediaWiki { } elsif $token<wikilink> { take defined $link_maker - ?? $link_maker(~$token<wikilink><page>, Mu) + ?? $link_maker(~$token<wikilink><page>, Any) !! ~$token<wikilink>; } elsif $token<extlink> { diff --git a/wiki b/wiki index 0237df6..5c78d77 100644 --- a/wiki +++ b/wiki @@ -1,8 +1,8 @@ #!perl6 use v6; -use November::CGI; use November; +use November::CGI; use November::Config; use Text::Markup::Wiki::MediaWiki;