package path;
# The following packages are currently stored at:
#  https://svn.apache.org/repos/infra/websites/cms/build/lib
use ASF::Value::Blogs;
use ASF::Value::Twitter;
use ASF::Value::Mail;
use ASF::Value::Jira;

# taken from django's url.py

# @patterns entries have the form:
# [regex, methodname => {arguments}]
# The regex is matched against the file being processed
# On match, the corresponding method is called with the specified arguments.
# The method should be defined in the view.pm module
# It can provide additional arguments if necessary.

# The preprocess attribute means single_narrative[_wrapper] will invoke
# Django processing before conversion by markdown

# N.B.
# Django uses the meta-character '{', followed by one of: '{', '%', '#'
# However it does not have an escape mechanism, and processing will fail
# if the start meta-string is not followed by the corresponding close on the same line.
# Unfortunately, the string '{#' was chosen for the markdown add-on that adds ids
# This can cause problems if pre-processing is performed on markdown files
# Currently only foundation/index.mdtext and foundation/board/index.mdtext are preprocessed
# They do not currently use the {# markdown extension.
#
# There is a work-round:
# Instead of using '{#' in the source, use the Django construct:
# {% templatetag opencomment %} which generates '{#' in the output
#
# If this is needed a lot, it might be worth extending the id extension at:
# https://svn.apache.org/repos/infra/websites/cms/build/mdx_elementid.py
# to support an additional marker. This must be chosen with care to avoid clashing!

our @patterns = (

    [qr!^/index\.html$!, news_page =>
      {
#        svn      => ASF::Value::SVN->new(limit => 5),
#        jira     => ASF::Value::Jira->new(limit => 5,
#                                          url => "http://s.apache.org/q4"),
        announce    => ASF::Value::Mail->new(list => 'announce@apache.org',
                                          limit => 3),
        planet      => ASF::Value::Blogs->new(blog => "planet", limit=> 1),
        blog        => ASF::Value::Blogs->new(blog => "foundation", limit=> 1),
        conferences => ASF::Value::Blogs->new(blog => "conferences", limit=> 1),
        #projects => ASF::Value::Blogs->new(blog => "foundation/feed/entries/atom?cat=Projects", limit =>1),
        twitter     => ASF::Value::Twitter->new(name => 'TheASF', limit => 1),
      },
    ],
    
        # does not appear to be used
        [qr!^/index\.html$!, news_podlings =>
      {
      # dummy
      },
    ],

    [qr!^/dev/index\.html$!, news_page =>
      {
#        svn      => ASF::Value::SVN->new(limit => 5),
        twitter  => ASF::Value::Twitter->new(name=>"infrabot", limit => 4), # 2 pairs
        blog     => ASF::Value::Blogs->new(blog => "infra", limit=> 3),
        jira     => ASF::Value::Jira->new(limit => 4, url => "https://s.apache.org/lg"),
      },
    ],

    [qr!^/dev/sitemap\.html$!, sitemap => { headers => { title => "Developer Sitemap" }} ],

    [qr!^/licenses/exports/index\.html$!, exports => {} ],

    [qr!^/travel/stories/.*\.mdtext$!, single_narrative => { 
                                         template => "single_narrative.html",
                                         preprocess => 1 }],

    # allow use of Django as well as markdown
    [qr!foundation/(board/)?index\.mdtext$!, single_narrative_wrapper => {
                                         template => "single_narrative.html",
                                         preprocess => 1}],

    [qr!\.mdtext$!, single_narrative => { template => "single_narrative.html" }],
    [qr!^/dev/machines\..*$!,  fingerprints => {}],

);

# for specifying interdependencies between files

our %dependencies = (
    "/dev/sitemap.html" => [ grep s!^content!!, glob "content/dev/*.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.
