You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jo...@apache.org on 2014/03/22 02:55:15 UTC

svn commit: r1580115 - in /thrift/cms-site/trunk/lib: path.pm view.pm

Author: joes
Date: Sat Mar 22 01:55:15 2014
New Revision: 1580115

URL: http://svn.apache.org/r1580115
Log:
snippets

Modified:
    thrift/cms-site/trunk/lib/path.pm
    thrift/cms-site/trunk/lib/view.pm

Modified: thrift/cms-site/trunk/lib/path.pm
URL: http://svn.apache.org/viewvc/thrift/cms-site/trunk/lib/path.pm?rev=1580115&r1=1580114&r2=1580115&view=diff
==============================================================================
--- thrift/cms-site/trunk/lib/path.pm (original)
+++ thrift/cms-site/trunk/lib/path.pm Sat Mar 22 01:55:15 2014
@@ -21,13 +21,15 @@ our @patterns = (
         preprocess => 1,
     }],
     [qr/\.md(?:text)?$/,   memoize => {
-        view       => [qw/thrift_preprocessor single_narrative/],
+        view       => [qw/snippet_preprocessor single_narrative/],
         conf       => $conf,
         template   => 'default.html',
+        repo       => 'thrift.git',
+        type       => 'git',
     }],
 );
 
-our $runners = 1; # maximize page memoization impact in thrift_preprocessor view
+our $runners = 1; # maximize page memoization impact
 
 our %dependencies;
 

Modified: thrift/cms-site/trunk/lib/view.pm
URL: http://svn.apache.org/viewvc/thrift/cms-site/trunk/lib/view.pm?rev=1580115&r1=1580114&r2=1580115&view=diff
==============================================================================
--- thrift/cms-site/trunk/lib/view.pm (original)
+++ thrift/cms-site/trunk/lib/view.pm Sat Mar 22 01:55:15 2014
@@ -1,35 +1,5 @@
 package view;
-
 # see https://svn.apache.org/repos/infra/websites/cms/build/lib/ASF/View.pm
 use base 'ASF::View';
-use ASF::Util qw/read_text_file/;
-use ASF::Value::Snippet;
-use strict;
-use warnings;
-
-sub thrift_preprocessor {
-    my %args = @_;
-    $args{view} = [@{$args{view}}] if ref $args{view};
-    my $file = "content$args{path}";
-    read_text_file $file, \%args;
-
-    my $key = "_snippet_a";
-    $args{content} =~ s{\[snippet:([^\]]+)\]}
-                       {
-                           my $template = $1;
-                           my %a = map {split /=/, $_, 2} split /:/,
-                               ASF::View::Template($template)->render(\%args);
-                           $args{$key} = ASF::Value::Snippet->new(
-                               type => "git",
-                               repo => "thrift.git",
-                               %a,
-                           );
-                           my $filter = exists $a{lang} ?  "markdown" : "safe";
-                           "{{ " . $key++ . ".fetch|$filter }}";
-                       }ge;
-
-    my $view = ref $args{view} ? shift @{$args{view}} : delete $args{view};
-    return view->can($view)->(%args, preprocess => 1);
-}
 
 1;