Author: joes
Date: Tue Mar 18 03:08:13 2014
New Revision: 1578726
URL: http://svn.apache.org/r1578726
Log:
docs
Modified:
thrift/cms-site/trunk/content/docs.md
thrift/cms-site/trunk/lib/path.pm
thrift/cms-site/trunk/lib/view.pm
Modified: thrift/cms-site/trunk/content/docs.md
URL:
http://svn.apache.org/viewvc/thrift/cms-site/trunk/content/docs.md?rev=1578726&r1=1578725&r2=1578726&view=diff
==============================================================================
--- thrift/cms-site/trunk/content/docs.md (original)
+++ thrift/cms-site/trunk/content/docs.md Tue Mar 18 03:08:13 2014
@@ -2,9 +2,9 @@
title: "Documentation"
---
<ul>
-<% @item.children.sort_by { |i| i[:title].downcase }.each do |docs| %>
+{% for item in dir %}
<li>
- <a href="<%= docs.path %>"><%= docs[:title] %></a>
+ <a href="{{ item.0 }}">{{ item.1 }}</a>
</li>
-<% end %>
+{% endfor %}
</ul>
Modified: thrift/cms-site/trunk/lib/path.pm
URL:
http://svn.apache.org/viewvc/thrift/cms-site/trunk/lib/path.pm?rev=1578726&r1=1578725&r2=1578726&view=diff
==============================================================================
--- thrift/cms-site/trunk/lib/path.pm (original)
+++ thrift/cms-site/trunk/lib/path.pm Tue Mar 18 03:08:13 2014
@@ -4,6 +4,12 @@ use YAML::XS;
my $conf = Load(join "", <DATA>);
our @patterns = (
+ [qr!^/docs.md(?:text)?$!, dir_wrapper => {
+ conf => $conf,
+ template => 'default.html',
+ view => 'single_narrative',
+ dir => "/docs",
+ }],
[qr/\.md(?:text)?$/, single_narrative => {conf => $conf, template =>
'default.html'}],
);
Modified: thrift/cms-site/trunk/lib/view.pm
URL:
http://svn.apache.org/viewvc/thrift/cms-site/trunk/lib/view.pm?rev=1578726&r1=1578725&r2=1578726&view=diff
==============================================================================
--- thrift/cms-site/trunk/lib/view.pm (original)
+++ thrift/cms-site/trunk/lib/view.pm Tue Mar 18 03:08:13 2014
@@ -1,4 +1,18 @@
package view;
use base 'ASF::View';
+use ASF::Util qw/read_text_file parse_filename/;
+
+sub dir_wrapper {
+ my %args = @_;
+ my $dir = delete $args{dir} || (parse_filename $args{path})[1];
+ my @d;
+ for (grep $_ ne "." && $_ ne "..", readdir "content$dir") {
+ my $f = -d $_ ? glob("$_/index.*")[0] : $_;
+ my %a;
+ read_text_file "content/$dir/$f", \%a;
+ push @d, [ "$dir/$_", $a{headers}->{title} // $_ ];
+ }
+ return view->can($args{view})->(dir => [sort {lc $a->[1] cmp lc $b->[1]}
@d], %args);
+}
1;