Skip to content

Commit

Permalink
Merge pull request #3 from retupmoca/master
Browse files Browse the repository at this point in the history
Make installable with current rakudo/panda
  • Loading branch information
Carl Mäsak committed May 13, 2014
2 parents 6612cb2 + 36c129e commit a50a5fc
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
3 changes: 1 addition & 2 deletions META.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"version" : "*",
"description" : "A proof-of-concept blogging application using Perl 6's Web.pm",
"depends" : ["Web"],
"repo-type" : "git",
"repo-url" : "git://github.com/masak/yarn.git"
"source-url" : "git://github.com/masak/yarn.git"
}
2 changes: 1 addition & 1 deletion lib/Yarn.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use v6;
use Web::Request;
use Web::Response;

use Tags;
use Yarn::Tags;

class Yarn {
method call($env) {
Expand Down
60 changes: 60 additions & 0 deletions lib/Yarn/Tags.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
use v6;
module Yarn::Tags;

sub show(&inner) is export {
# I have no idea what this sub needs to do
inner();
}

sub enclose($tag, $body, *%attr) {
my $attr;
for %attr.kv -> $k, $v {
$attr ~= " $k=\"$v\"";
}
return "<{$tag}{$attr}>{$body}</$tag>";
}

sub html(&inner) is export {
enclose('html', inner());
}

sub head(&inner) is export {
enclose('head', inner());
}

sub title(&inner) is export {
enclose('title', inner());
}

sub body(&inner) is export {
enclose('body', inner());
}

sub p(&inner) is export {
enclose('p', inner());
}

sub a(&inner, *%attr) is export {
enclose('a', inner(), |%attr);
}

sub form(&inner, *%attr) is export {
enclose('form', inner(), |%attr);

}

sub div(&inner, *%attr) is export {
enclose('div', inner(), |%attr);
}

sub textarea(&inner, *%attr) is export {
enclose('textarea', inner(), |%attr);
}

sub input(&inner, *%attr) is export {
enclose('input', inner(), |%attr);
}

sub h1(&inner, *%attr) is export {
enclose('h1', inner(), |%attr);
}

0 comments on commit a50a5fc

Please sign in to comment.