incubator-jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From juanpa...@apache.org
Subject svn commit: r1331131 - in /incubator/jspwiki/site/trunk: ./ README.txt cgi-bin/ content/ content/index.mdtext content/sitemap.html lib/ lib/path.pm lib/view.pm templates/ templates/single_narrative.html templates/skeleton.html
Date Thu, 26 Apr 2012 22:29:46 GMT
Author: juanpablo
Date: Thu Apr 26 22:29:46 2012
New Revision: 1331131

URL: http://svn.apache.org/viewvc?rev=1331131&view=rev
Log:
JSPWIKI-727: Apache CMS site boilerplate setup

Added:
    incubator/jspwiki/site/trunk/
    incubator/jspwiki/site/trunk/README.txt
    incubator/jspwiki/site/trunk/cgi-bin/
    incubator/jspwiki/site/trunk/content/
    incubator/jspwiki/site/trunk/content/index.mdtext
    incubator/jspwiki/site/trunk/content/sitemap.html
    incubator/jspwiki/site/trunk/lib/
    incubator/jspwiki/site/trunk/lib/path.pm
    incubator/jspwiki/site/trunk/lib/view.pm
    incubator/jspwiki/site/trunk/templates/
    incubator/jspwiki/site/trunk/templates/single_narrative.html
    incubator/jspwiki/site/trunk/templates/skeleton.html

Added: incubator/jspwiki/site/trunk/README.txt
URL: http://svn.apache.org/viewvc/incubator/jspwiki/site/trunk/README.txt?rev=1331131&view=auto
==============================================================================
--- incubator/jspwiki/site/trunk/README.txt (added)
+++ incubator/jspwiki/site/trunk/README.txt Thu Apr 26 22:29:46 2012
@@ -0,0 +1,28 @@
+Working on the conversion of the JSPWiki website to the ASF CMS,
+see https://issues.apache.org/jira/browse/JSPWIKI-727
+
+To build the site, locally:
+- install python and some needed dependencies, as described in 
+  http://apache.org/dev/cmsref.html#local-build
+  
+- check/out export the build scripts to some directory, for example, let's say we have:
+  + $SVN_HOME/site
+    ++ trunk                 (from svn, contains cms site files)
+    ++ scripts               (svn-exported from the previous URL)
+
+- make sure the markdown processing daemon is up:
+  $ export MARKDOWN_SOCKET=`pwd`/scripts/markdown.socket PYTHONPATH=`pwd`
+  $ python ./scripts/markdownd.py
+
+- create a new directory in which the generated site files will be created. So, our
+  previous example would look like this:
+  + $SVN_HOME/site
+    ++ trunk                 (from svn, contains cms site files)
+    ++ scripts               (svn-exported from the previous URL)
+    ++ target-site           (newly created directory, NOT under svn control)
+  
+- cd into scripts directory and execute: 
+  $ ./build_site.pl --source-base ../trunk/ --target-base ../target-site
+  
+Editing the site online instructions at http://apache.org/dev/cms.html#usage
+More info at http://apache.org/dev/cmsref.html#overview
\ No newline at end of file

Added: incubator/jspwiki/site/trunk/content/index.mdtext
URL: http://svn.apache.org/viewvc/incubator/jspwiki/site/trunk/content/index.mdtext?rev=1331131&view=auto
==============================================================================
--- incubator/jspwiki/site/trunk/content/index.mdtext (added)
+++ incubator/jspwiki/site/trunk/content/index.mdtext Thu Apr 26 22:29:46 2012
@@ -0,0 +1,6 @@
+# Welcome
+
+Welcome to the Apache CMS.  Please see the following resources for further help:
+
+ - [http://www.apache.org/dev/cmsref.html](http://www.apache.org/dev/cmsref.html)
+ - [http://wiki.apache.org/general/ApacheCms2010](http://wiki.apache.org/general/ApacheCms2010)

Added: incubator/jspwiki/site/trunk/content/sitemap.html
URL: http://svn.apache.org/viewvc/incubator/jspwiki/site/trunk/content/sitemap.html?rev=1331131&view=auto
==============================================================================
--- incubator/jspwiki/site/trunk/content/sitemap.html (added)
+++ incubator/jspwiki/site/trunk/content/sitemap.html Thu Apr 26 22:29:46 2012
@@ -0,0 +1,2 @@
+{% include "single_narrative.html" %}
+

Added: incubator/jspwiki/site/trunk/lib/path.pm
URL: http://svn.apache.org/viewvc/incubator/jspwiki/site/trunk/lib/path.pm?rev=1331131&view=auto
==============================================================================
--- incubator/jspwiki/site/trunk/lib/path.pm (added)
+++ incubator/jspwiki/site/trunk/lib/path.pm Thu Apr 26 22:29:46 2012
@@ -0,0 +1,39 @@
+package path;
+
+# taken from django's url.py
+
+our @patterns = (
+	[qr!\.mdtext$!, single_narrative => { template => "single_narrative.html" }],
+
+	[qr!/sitemap\.html$!, sitemap => { headers => { title => "Sitemap" }} ],
+
+) ;
+
+# for specifying interdependencies between files
+
+our %dependencies = (
+    "/sitemap.html" => [ grep s!^content!!, glob "content/*.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.
+
+

Added: incubator/jspwiki/site/trunk/lib/view.pm
URL: http://svn.apache.org/viewvc/incubator/jspwiki/site/trunk/lib/view.pm?rev=1331131&view=auto
==============================================================================
--- incubator/jspwiki/site/trunk/lib/view.pm (added)
+++ incubator/jspwiki/site/trunk/lib/view.pm Thu Apr 26 22:29:46 2012
@@ -0,0 +1,141 @@
+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 *TEMPLATE_DIRS/;
+use Dotiac::DTL::Addon::markup;
+use ASF::Util qw/read_text_file/;
+
+push @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};
+        }
+    }
+
+    return 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};
+        }
+    }
+
+    return 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!/[^/]+$!!;
+    my %data;
+    for (map "content$_", @{$path::dependencies{$args{path}}}) {
+        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 Template($template)->render(\%args), html => \%args;
+}
+
+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;
+}
+
+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.

Added: incubator/jspwiki/site/trunk/templates/single_narrative.html
URL: http://svn.apache.org/viewvc/incubator/jspwiki/site/trunk/templates/single_narrative.html?rev=1331131&view=auto
==============================================================================
--- incubator/jspwiki/site/trunk/templates/single_narrative.html (added)
+++ incubator/jspwiki/site/trunk/templates/single_narrative.html Thu Apr 26 22:29:46 2012
@@ -0,0 +1 @@
+{% extends "skeleton.html" %}

Added: incubator/jspwiki/site/trunk/templates/skeleton.html
URL: http://svn.apache.org/viewvc/incubator/jspwiki/site/trunk/templates/skeleton.html?rev=1331131&view=auto
==============================================================================
--- incubator/jspwiki/site/trunk/templates/skeleton.html (added)
+++ incubator/jspwiki/site/trunk/templates/skeleton.html Thu Apr 26 22:29:46 2012
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <title>{% block title %}{{ headers.title }}{% endblock %}</title>
+
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <meta property="og:image" content="http://www.apache.org/images/asf_logo.gif" />
+
+    <link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/style.css">
+    <link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/code.css">
+
+    </style>
+
+    {% if headers.atom %}
+      <link rel="alternate" href="{{ headers.atom.url }}"
+            type="application/atom+xml" title="{{ headers.atom.title }}" />
+    {% endif %}
+
+    {% if headers.base %}<base href="{{ headers.base }}" />{% endif %}
+    {% if headers.notice %}<!-- {{ headers.notice }} -->{% endif %}
+  </head>
+
+  <body>
+    <div id="page" class="container_16">
+      <div id="header" class="grid_8">
+        <img src="http://www.apache.org/images/feather-small.gif" alt="The Apache Software
Foundation">
+        <h1>The Apache Software Foundation</h1>
+        <h2>{% block tagline %}{{ headers.title }}{% endblock %}</h2>
+      </div>
+      <div id="nav" class="grid_8">
+        <ul>
+          <!-- <li><a href="/" title="Welcome!">Home</a></li>
-->
+          <li><a href="http://www.apache.org/foundation/" title="The Foundation">Foundation</a></li>
+          <li><a href="http://projects.apache.org" title="The Projects">Projects</a></li>
+          <li><a href="http://people.apache.org" title="The People">People</a></li>
+          <li><a href="http://www.apache.org/foundation/getinvolved.html" title="Get
Involved">Get Involved</a></li>
+          <li><a href="http://www.apache.org/dyn/closer.cgi" title="Download">Download</a></li>
+          <li><a href="http://www.apache.org/foundation/sponsorship.html" title="Support
Apache">Support Apache</a></li>
+        </ul>
+        <p>{{ breadcrumbs|safe }}</p>
+        <form name="search" id="search" action="http://www.google.com/search" method="get">
+          <input value="*.apache.org" name="sitesearch" type="hidden"/>
+          <input type="text" name="q" id="query">
+          <input type="submit" id="submit" value="Search">
+        </form>
+      </div>
+      <div class="clear"></div>
+      {% block content %}<div id="content" class="grid_16"><div class="section-content">{{
content|markdown }}</div></div>{% endblock %}
+      <div class="clear"></div>
+    </div>
+
+    <div id="copyright" class="container_16">
+      <p>Copyright &#169; 2011 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
and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
+    </div>
+  </body>
+</html>



Mime
View raw message