incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1075866 - in /sling/trunk/site: ./ archives-before-2011/ archives-before-2011/src/ cgi-bin/ content/ content/css/ lib/ src/ src/logo/ src/logo/old/ templates/
Date Tue, 01 Mar 2011 16:00:45 GMT
Author: bdelacretaz
Date: Tue Mar  1 16:00:44 2011
New Revision: 1075866

URL: http://svn.apache.org/viewvc?rev=1075866&view=rev
Log:
SLING-2002 - skeleton content and templates for ASF CMS

Added:
    sling/trunk/site/archives-before-2011/
    sling/trunk/site/archives-before-2011/src/
      - copied from r1075267, sling/trunk/site/src/
    sling/trunk/site/cgi-bin/
    sling/trunk/site/content/
    sling/trunk/site/content/css/
    sling/trunk/site/content/css/sling.css   (with props)
    sling/trunk/site/content/index.mdtext
    sling/trunk/site/lib/
    sling/trunk/site/lib/path.pm   (with props)
    sling/trunk/site/lib/view.pm   (with props)
    sling/trunk/site/src/
    sling/trunk/site/src/logo/
    sling/trunk/site/src/logo/old/
    sling/trunk/site/templates/
    sling/trunk/site/templates/sidenav.mdtext
    sling/trunk/site/templates/single_narrative.html   (with props)
    sling/trunk/site/templates/skeleton.html   (with props)
Modified:
    sling/trunk/site/readme.txt

Added: sling/trunk/site/content/css/sling.css
URL: http://svn.apache.org/viewvc/sling/trunk/site/content/css/sling.css?rev=1075866&view=auto
==============================================================================
--- sling/trunk/site/content/css/sling.css (added)
+++ sling/trunk/site/content/css/sling.css Tue Mar  1 16:00:44 2011
@@ -0,0 +1 @@
+/* future Sling CSS stylesheet */

Propchange: sling/trunk/site/content/css/sling.css
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/trunk/site/content/index.mdtext
URL: http://svn.apache.org/viewvc/sling/trunk/site/content/index.mdtext?rev=1075866&view=auto
==============================================================================
--- sling/trunk/site/content/index.mdtext (added)
+++ sling/trunk/site/content/index.mdtext Tue Mar  1 16:00:44 2011
@@ -0,0 +1,3 @@
+Title: Welcome to Apache Sling
+
+This is a placeholder index page, will be replaced by content exported from Confluence.
\ No newline at end of file

Added: sling/trunk/site/lib/path.pm
URL: http://svn.apache.org/viewvc/sling/trunk/site/lib/path.pm?rev=1075866&view=auto
==============================================================================
--- sling/trunk/site/lib/path.pm (added)
+++ sling/trunk/site/lib/path.pm Tue Mar  1 16:00:44 2011
@@ -0,0 +1,40 @@
+package path;
+use ASF::Value;
+
+# taken from django's url.py
+
+our @patterns = (
+	[qr!\.mdtext$!, single_narrative => { template => "single_narrative.html" }],
+
+#	[qr!^/sling/sitemap\.html$!, sitemap => { headers => { title => "Sling Sitemap"
}} ],
+
+) ;
+
+# for specifying interdependencies between files
+
+#our %dependencies = (
+#    "/sling/sitemap.html" => [ grep s!^content!!, glob "content/sling/*.mdtext" ],
+#);
+
+1;
+
+=head1 LICENSE
+
+           Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+
+             http://www.apache.org/licenses/LICENSE-2.0
+
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+
+

Propchange: sling/trunk/site/lib/path.pm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/trunk/site/lib/view.pm
URL: http://svn.apache.org/viewvc/sling/trunk/site/lib/view.pm?rev=1075866&view=auto
==============================================================================
--- sling/trunk/site/lib/view.pm (added)
+++ sling/trunk/site/lib/view.pm Tue Mar  1 16:00:44 2011
@@ -0,0 +1,201 @@
+package view;
+
+#
+# BUILD CONSTRAINT:  all views must return $content, $extension.
+# additional return values (as seen below) are optional.  However,
+# careful use of symlinks and dependency management in path.pm can
+# resolve most issues with this constraint.
+#
+
+use strict;
+use warnings;
+use Dotiac::DTL qw/Template/;
+use Dotiac::DTL::Addon::markup;
+use ASF::Util qw/read_text_file shuffle/;
+use File::Temp qw/tempfile/;
+use LWP::Simple;
+
+push @Dotiac::DTL::TEMPLATE_DIRS, "templates";
+
+# This is most widely used view.  It takes a
+# 'template' argument and a 'path' argument.
+# Assuming the path ends in foo.mdtext, any files
+# like foo.page/bar.mdtext will be parsed and
+# passed to the template in the "bar" (hash)
+# variable.
+
+sub single_narrative {
+    my %args = @_;
+    my $file = "content$args{path}";
+    my $template = $args{template};
+    $args{path} =~ s/\.mdtext$/\.html/;
+    $args{breadcrumbs} = breadcrumbs($args{path});
+
+    read_text_file $file, \%args;
+
+    my $page_path = $file;
+    $page_path =~ s/\.[^.]+$/.page/;
+    if (-d $page_path) {
+        for my $f (grep -f, glob "$page_path/*.mdtext") {
+            $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n";
+            $args{$1} = {};
+            read_text_file $f, $args{$1};
+        }
+    }
+
+#	$args{sidenav} = {};
+#	read_text_file "templates/sidenav.mdtext", $args{sidenav} ;
+
+#	select STDOUT ;
+#	$| = 1 ;
+#	for my $ke (keys %args) {
+#		print STDOUT "$ke \n";
+#	}
+
+    return Dotiac::DTL::Template($template)->render(\%args), html => \%args;
+}
+
+# Has the same behavior as the above for foo.page/bar.txt
+# files, parsing them into a bar variable for the template.
+# Otherwise presumes the template is the path.
+
+sub news_page {
+    my %args = @_;
+    my $template = "content$args{path}";
+    $args{breadcrumbs} = breadcrumbs($args{path});
+
+    my $page_path = $template;
+    $page_path =~ s/\.[^.]+$/.page/;
+    if (-d $page_path) {
+        for my $f (grep -f, glob "$page_path/*.mdtext") {
+            $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n";
+            $args{$1} = {};
+            read_text_file $f, $args{$1};
+        }
+    }
+
+    for ((fetch_doap_url_list())[0..2]) {
+        push @{$args{projects}}, parse_doap($_);
+    }
+
+    return Dotiac::DTL::Template($template)->render(\%args), html => \%args;
+}
+
+sub sitemap {
+    my %args = @_;
+    my $template = "content$args{path}";
+    $args{breadcrumbs} .= breadcrumbs($args{path});
+    my $dir = $template;
+    $dir =~ s!/[^/]+$!!;
+    opendir my $dh, $dir or die "Can't opendir $dir: $!\n";
+    my %data;
+    for (map "$dir/$_", grep $_ ne "." && $_ ne ".." && $_ ne ".svn", readdir
$dh) {
+        if (-f and /\.mdtext$/) {
+            my $file = $_;
+            $file =~ s/^content//;
+            no warnings 'once';
+            for my $p (@path::patterns) {
+                my ($re, $method, $args) = @$p;
+                next unless $file =~ $re;
+                my $s = view->can($method) or die "Can't locate method: $method\n";
+                my ($content, $ext, $vars) = $s->(path => $file, %$args);
+                $file =~ s/\.mdtext$/.$ext/;
+                $data{$file} = $vars;
+                last;
+            }
+        }
+    }
+
+    my $content = "";
+
+    for (sort keys %data) {
+        $content .= "- [$data{$_}->{headers}->{title}]($_)\n";
+        for my $hdr (grep /^#/, split "\n", $data{$_}->{content}) {
+            $hdr =~ /^(#+)\s+([^#]+)?\s+\1\s+\{#([^}]+)\}$/ or next;
+            my $level = length $1;
+            $level *= 4;
+            $content .= " " x $level;
+            $content .= "- [$2]($_#$3)\n";
+        }
+    }
+    $args{content} = $content;
+    return Dotiac::DTL::Template($template)->render(\%args), html => \%args;
+}
+
+sub exports {
+    my %args = @_;
+    my $template = "content$args{path}";
+    $args{breadcrumbs} = breadcrumbs($args{path});
+
+    my $page_path = $template;
+    $page_path =~ s/\.[^.]+$/.page/;
+    if (-d $page_path) {
+        for my $f (grep -f, glob "$page_path/*.mdtext") {
+            $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n";
+            $args{$1} = {};
+            read_text_file $f, $args{$1};
+        }
+        $args{table} = `xsltproc $page_path/eccnmatrix.xsl $page_path/eccnmatrix.xml`;
+
+    }
+
+    return Dotiac::DTL::Template($template)->render(\%args), html => \%args;
+}
+
+sub parse_doap {
+    my $url = shift;
+    my $doap = get $url or die "Can't get $url: $!\n";
+    my ($fh, $filename) = tempfile("XXXXXX");
+    print $fh $doap;
+    close $fh;
+    my $result = eval `xsltproc lib/doap2perl.xsl $filename`;
+    unlink $filename;
+    return $result;
+}
+
+sub fetch_doap_url_list {
+    my $xml = get "http://svn.apache.org/repos/asf/infrastructure/site-tools/trunk/projects/files.xml"
+        or die "Can't get doap file list: $!\n";
+    my ($fh, $filename) = tempfile("XXXXXX");
+    print $fh $xml;
+    close $fh;
+    chomp(my @urls = grep /^http/, `xsltproc lib/list2urls.xsl $filename`);
+    unlink $filename;
+    shuffle \@urls;
+    return @urls;
+}
+
+1;
+
+sub breadcrumbs {
+    my @path = split m!/!, shift;
+    pop @path;
+    my @rv;
+    my $relpath = "";
+    for (@path) {
+        $relpath .= "$_/";
+        $_ ||= "Home";
+        push @rv, qq(<a href="$relpath">\u$_</a>);
+    }
+    return join "&nbsp;&raquo&nbsp;", @rv;
+}
+
+
+=head1 LICENSE
+
+           Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+
+             http://www.apache.org/licenses/LICENSE-2.0
+
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.

Propchange: sling/trunk/site/lib/view.pm
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: sling/trunk/site/readme.txt
URL: http://svn.apache.org/viewvc/sling/trunk/site/readme.txt?rev=1075866&r1=1075865&r2=1075866&view=diff
==============================================================================
--- sling/trunk/site/readme.txt (original)
+++ sling/trunk/site/readme.txt Tue Mar  1 16:00:44 2011
@@ -1,10 +1,2 @@
-Recreating the site project
----------------------------
-
-The site project currently only contains the new and old logos. It will
-later be used to generate the JavaDoc to be integrated with the Site
-exported from Confluence.
-
-Currently this project is just the hold of the logos ....
-
-fmeschbe, 2008/01/19
+Working on the conversion of the Sling website to the ASF CMS,
+see https://issues.apache.org/jira/browse/SLING-2002

Added: sling/trunk/site/templates/sidenav.mdtext
URL: http://svn.apache.org/viewvc/sling/trunk/site/templates/sidenav.mdtext?rev=1075866&view=auto
==============================================================================
--- sling/trunk/site/templates/sidenav.mdtext (added)
+++ sling/trunk/site/templates/sidenav.mdtext Tue Mar  1 16:00:44 2011
@@ -0,0 +1,10 @@
+# Sling links
+  - [Home](index.html)
+  
+# ASF links
+  - [Apache Software Foundation](http://www.apache.org)
+  - [License](http://www.apache.org/licenses/LICENSE-2.0)
+  - [Thanks](http://www.apache.org/foundation/thanks.html)
+  - [Become a Sponsor](http://www.apache.org/foundation/sponsorship.html)
+  - [Security](http://www.apache.org/security/)
+  

Added: sling/trunk/site/templates/single_narrative.html
URL: http://svn.apache.org/viewvc/sling/trunk/site/templates/single_narrative.html?rev=1075866&view=auto
==============================================================================
--- sling/trunk/site/templates/single_narrative.html (added)
+++ sling/trunk/site/templates/single_narrative.html Tue Mar  1 16:00:44 2011
@@ -0,0 +1 @@
+{% extends "skeleton.html" %}

Propchange: sling/trunk/site/templates/single_narrative.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/trunk/site/templates/skeleton.html
URL: http://svn.apache.org/viewvc/sling/trunk/site/templates/skeleton.html?rev=1075866&view=auto
==============================================================================
--- sling/trunk/site/templates/skeleton.html (added)
+++ sling/trunk/site/templates/skeleton.html Tue Mar  1 16:00:44 2011
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+  <link href="/sling/css/sling.css" rel="stylesheet" type="text/css">
+  <title>Apache Sling - {% block title %}{{ headers.title }}{% endblock %}</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <link rel="icon" type="image/png" href="/sling/images/sling-logo/sling-favicon.png"/>
+</head>
+
+<body>
+  <div id="navigation"> 
+  <img title="Sling logo" width="274" height="125" src="/sling/images/sling-logo/sling-2010-270-transparent.png"/>
+  {% filter markdown %}{% include "sidenav.mdtext" %}{% endfilter %}
+  </div>
+  
+  <div id="content">
+    <h1 class="title">{% block title %}{{ headers.title }}{% endblock %}</h1>
+    {% block content %}{{ content|markdown }}{% endblock %}
+  </div>
+  
+  <div id="footer">
+    <div class="copyright">
+      <p>
+        Copyright &copy; 2010 The Apache Software Foundation, Licensed under 
+        the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version
2.0</a>.
+        <br />
+        "Apache Sling" and the Apache feather and Sling logos are trademarks of The Apache
Software Foundation.
+      </p>
+    </div>
+  </div>
+  
+</body>
+</html>

Propchange: sling/trunk/site/templates/skeleton.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message