Permalink
Browse files

Write something that works (I'm not sure how)

  • Loading branch information...
1 parent 088fd9c commit f6c52a7cccfdc080157a8627dfec6ea957d11c32 @tadzik tadzik committed Jul 18, 2012
Showing with 53 additions and 19 deletions.
  1. +32 −0 web/build.pl
  2. +21 −19 web/index.mojo
View
@@ -0,0 +1,32 @@
+use v6;
+use Template::Mojo;
+
+sub render($tmpl, *@a) {
+ Template::Mojo.new($tmpl).render(|@a);
+}
+
+my $file = slurp 'index.mojo';
+
+class Project {
+ has $.has_readme = True;
+ has $.readme = True;
+
+ has $.is_fresh = True;
+ has $.panda = True;
+ has $.description = True;
+ has $.logo = True;
+
+ has $.has_tests = True;
+
+ has $.name = True;
+ has $.URL = True;
+}
+
+my @projects;
+@projects.push: Project.new;
+@projects.push: Project.new;
+my $last_update = 'dzisiaj';
+
+say @projects.perl;
+
+say render($file, { :@projects, :$last_update })
View
@@ -102,44 +102,46 @@ dl.table-display {
<h2>Project list</h2>
<p id="json_link"><a href="proto.json">JSON version of this list</a>.</p>
<dl class="table-display">
- % for @^projects {
- % if $_.description {
+% my %args = @_[0];
+% my (@projects, $last_update) = (%args<projects>, %args<last_update>);
+% for @projects[0][0] {
+% if $_.description {
<dt>
- % if $_.logo {
+% if $_.logo {
<img class="project-logo" src="<%= $_.logo %>" alt="<%= $_.name %> logo" />
- % }
+% }
<a href="<%= $_.URL %>"><%= $_.name %></a></dt>
<dd>
<div class='badges'>
- % if $_.has_readme {
+% if $_.has_readme {
<a href="<%= $_.readme %>"><img src='readme.png' title='Has a README' alt="Readme badge" /></a>
- % } else {
+% } else {
<img src='unachieved.png' title="Doesn't have a README" alt="Unachieved badge" />
- % }
- % if $_.has_tests {
+% }
+% if $_.has_tests {
<img src='tests.png' title='Has tests' alt="Tests badge" />
- % } else {
+% } else {
<img src='unachieved.png' title="Doesn't have tests" alt="Unachieved badge" />
- % }
- % if $_.is_fresh {
+% }
+% if $_.is_fresh {
<img src='fresh.png' title='Commits in the past 90 days' alt="Fresh badge" />
- % } else {
+% } else {
<img src='unachieved.png' title='No commits in the past 90 days' alt="Unachieved badge" />
- % }
- % if $_.panda {
+% }
+% if $_.panda {
<img src='panda.png' title='Conforms to the latest Perl 6 modules specs' alt="Panda badge" />
- % } else {
+% } else {
<img src='unachieved.png' title='Not quite up-to-date with the specs' alt="Unachieved badge" />
- % }
+% }
</div>
<%= $_.description %></dd>
- % } # if
- % } # for
+% } # if
+% } # for
</dl>
<p style="clear:both; padding-top: 2em">
This page is generated from the files in the <a
href="http://github.com/perl6/modules.perl6.org/">modules.perl6.org
- repository</a><br/>(<i>last update <%= $^last_update %></i>).</p>
+ repository</a><br/>(<i>last update <%= $last_update %></i>).</p>
<p>For feedback and patches, please contact us
through the <a href="http://perl6.org/community/irc">#perl6 IRC
channel</a>, or send an email to the perl6-compiler@perl.org mailing

0 comments on commit f6c52a7

Please sign in to comment.