Commits

shl...@13c2ddb8-3aa7-4284-800b-8db07c650eef  committed 3722129

Merged the changes from the conversion-to-latemp branch.

  • Participants
  • Parent commits 7518847

Comments (0)

Files changed (40)

 
 TARGET = dest
 
-# PAGES = about articles/index books/index core-doc/index index irc/index mailing-lists/index links/index site-resources/index tutorials/index web-forums/index
+WML_FLAGS += -DLATEMP_THEME=perl-begin-1 -DLATEMP_SERVER=berlios
 
-# SUBDIRS = articles books core-doc irc links mailing-lists tutorials site-resources source source/arcs web-forums
+LATEMP_WML_INCLUDE_PATH =$(shell latemp-config --wml-include-path)
 
-include defs.mak
-
-
-SOURCES = $(addprefix src/,$(addsuffix .html.wml,$(PAGES)))
-
-DESTS = $(patsubst src/%.html.wml,$(TARGET)/%.html,$(SOURCES))
-
-RAW_FILES = $(IMAGES)
-RAW_FILES_SOURCES = $(addprefix src/,$(RAW_FILES))
-RAW_FILES_DEST = $(addprefix $(TARGET)/,$(RAW_FILES))
-
-PODS = $(addprefix docs/,roadmap spec whitepaper version-0.2-spec)
-PODS_DESTS_HTMLS = $(patsubst %,$(TARGET)/%.html,$(PODS))
-PODS_DESTS_PODS = $(patsubst %,$(TARGET)/%.pod,$(PODS))
-
-# PACKAGES_DIR = $(TARGET)/download/arcs
-# PACKAGES = $(shell cd temp && cd lk-module-compiler-final && ls)
-# PACKAGES_DESTS = $(addprefix $(PACKAGES_DIR)/,$(PACKAGES))
-
-SUBDIRS_DEST = $(addprefix $(TARGET)/,$(SUBDIRS))
-
-WML_FLAGS += --passoption=2,-X --passoption=3,-I../lib/ --passoption=7,"-S imgsize" -DROOT~.
+WML_FLAGS += --passoption=2,-X3074 --passoption=3,-I../lib/ \
+	--passoption=3,-w -I$(LATEMP_WML_INCLUDE_PATH) -I../ -DROOT~. \
+	-I../lib/ --passoption=7,"-S imgsize"
 
 RSYNC = rsync --progress --verbose --rsh=ssh 
 
 
 LIBRARY_FILES = template.wml lib/books.wml
 
-all: dest $(SUBDIRS_DEST) $(DESTS) $(RAW_FILES_DEST)
+all: latemp_targets
 
-dest:
-	if [ ! -e $@ ] ; then mkdir $@ ; fi
-	
-$(DESTS) :: $(TARGET)/% : src/%.wml $(LIBRARY_FILES)
-	(cd src && wml $(WML_FLAGS) -DFILENAME=$(patsubst src/%.wml,%,$<) $(patsubst src/%,%,$<)) > $@
-
-$(RAW_FILES_DEST) :: $(TARGET)/% : src/%
-	cp -f $< $@
-
-$(SUBDIRS_DEST) :: % : unchanged
-	if [ ! -e $@ ] ; then mkdir $@ ; fi
-
-$(PODS_DESTS) :: $(TARGET)/% : src/%
-	cp -f $< $@
-
-$(PODS_DESTS_HTMLS) :: $(TARGET)/%.html : src/%.pod
-	pod2html $< > $@
-
-# $(PACKAGES_DESTS) :: $(PACKAGES_DIR)/% : ./temp/lk-module-compiler-final/%
-# 	cp -f $< $@
+include include.mak
+include rules.mak
 
 upload: upload_berlios
 
 
 DEST_ARC_NAME = $(TARGET)/source/arcs/$(ARC_NAME)
 
-.PHONY: 
-
-$(DEST_ARC_PAGE) :: $(TARGET)/% : src/%.wml $(LIBRARY_FILES) .PHONY
-	(cd src && wml $(WML_FLAGS) -DARCNAME=$(ARC_NAME) -DFILENAME=$(patsubst src/%.wml,%,$<) $(patsubst src/%,%,$<)) > $@
-
-arc: $(DEST_ARC_NAME) $(DEST_ARC_PAGE)
-
-$(DEST_ARC_NAME):
-	(cd temp && ./make-archive.sh)
-	mv temp/$(ARC_NAME) $@
-
-upload_arc: arc
-	$(RSYNC) $(ARC_NAME) shlomif@shell.berlios.de:
-
+# .PHONY: 
+# 
+# $(DEST_ARC_PAGE) :: $(TARGET)/% : src/%.wml $(LIBRARY_FILES) .PHONY
+# 	(cd src && wml $(WML_FLAGS) -DARCNAME=$(ARC_NAME) -DFILENAME=$(patsubst src/%.wml,%,$<) $(patsubst src/%,%,$<)) > $@
+# 
+# arc: $(DEST_ARC_NAME) $(DEST_ARC_PAGE)
+# 
+# $(DEST_ARC_NAME):
+# 	(cd temp && ./make-archive.sh)
+# 	mv temp/$(ARC_NAME) $@
+# 
+# upload_arc: arc
+# 	$(RSYNC) $(ARC_NAME) shlomif@shell.berlios.de:
+# 

File gen-helpers.pl

+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use HTML::Latemp::GenMakeHelpers;
+
+my $generator = 
+    HTML::Latemp::GenMakeHelpers->new(
+        'hosts' =>
+        [
+            {
+                'id' => "common",
+                'source_dir' => "common",
+                'dest_dir' => "\$(TARGET)",
+            },
+            {
+                'id' => "berlios",
+                'source_dir' => "src",
+                'dest_dir' => "\$(TARGET)",
+            },
+        ],
+    );
+    
+$generator->process_all();
+
+1;
+

File gen_helper.sh

-#!/bin/bash
-list_wmls()
-{
-    find ./src/ -name '*.html.wml' | 
-        sed 's!^\./src/!!' | 
-        sed 's!\.html\.wml$!!' | 
-        grep -v '^source/index$' |
-        sort
-}
-
-get_subdirs()
-{
-    grep '/' | 
-        sed 's!/[^/]*$!!' |
-        sort |
-        uniq |
-        sort
-}
-
-add_extra()
-{
-    cat ;
-    echo "source"
-    echo "source/arcs"
-}
-
-list_images()
-{
-    find ./src -type f -not -name '*.wml' -not -name '.*' | 
-    grep -v '/\.svn' | 
-    grep -v '~$' | 
-    sed 's!^./src/!!'
-}
-
-(echo "PAGES = $(list_wmls | xargs)" ;
-echo
-echo "SUBDIRS = $(((list_wmls) ; (list_images))| get_subdirs | add_extra | xargs)"
-echo 
-echo "IMAGES = $(list_images | xargs)" ;
-echo ) > defs.mak
-
-    

File lib/MyNavLinks.pm

+package MyNavLinks;
+
+use strict;
+use warnings;
+
+use vars qw($nav_buttons_html);
+
+use base 'Class::Accessor';
+
+__PACKAGE__->mk_accessors(qw(root nav_links));
+
+use Template;
+
+# load Template::Stash to make method tables visible
+use Template::Stash;
+
+# Define a method to return a substring.
+$Template::Stash::SCALAR_OPS->{ 'substr' } = sub {
+    return substr($_[0], $_[1], $_[2]);
+};
+
+
+sub new
+{
+    my $class = shift;
+    my $self = {};
+    bless $self, $class;
+    $self->initialize(@_);
+    return $self;
+}
+
+sub initialize
+{
+    my $self = shift;
+    my %args = (@_);
+    %{$self} = %args;
+}
+
+sub get_nav_buttons_html
+{
+    my $self = shift;
+
+    my (%args) = (@_);
+    
+    my $with_accesskey = $args{'with_accesskey'};
+
+    my $nav_links = $self->nav_links();
+    my $root = $self->root();    
+
+    my $template = 
+        Template->new(
+        {
+            'POST_CHOMP' => 1,
+        }
+        );
+
+    my @buttons =
+    (
+        { 
+            'dir' => "prev", 
+            'button' => "left", 
+            'title' => "Previous Page",
+        },
+        { 
+            'dir' => "up", 
+            'button' => "up", 
+            'title' => "Up in the Site",
+        },
+        {
+            'dir' => "next", 
+            'button' => "right", 
+            'title' => "Next Page",
+        },
+    );
+
+    foreach my $button (@buttons)
+    {
+        my $dir = $button->{'dir'};
+        if ($button->{'exists'} = exists($nav_links->{$dir}))
+        {
+            $button->{'link'} = $nav_links->{$dir};
+        }
+    }
+    
+    my $vars = 
+    {
+        'buttons' => \@buttons,
+        'root' => $root,
+        'with_accesskey' => $with_accesskey,
+    };
+    
+    my $nav_links_template = <<'EOF';
+[% USE HTML %]
+[% FOREACH b = buttons %]
+[% SET key = b.dir.substr(0, 1) %]
+<li>
+[% IF b.exists %]
+<a href="[% HTML.escape(b.link) %]" title="[% b.title %] (Alt+[% key FILTER upper %])"
+[% IF with_accesskey %]
+accesskey="[% key %]"
+[% END %]
+>[% END %]<img src="[% root %]/images/arrow-[% b.button %][% UNLESS b.exists %]-disabled[% END %].png"
+alt="[% b.title %]" class="bless" />[% IF b.exists %]</a>
+[% END %]
+</li>
+[% END %]
+EOF
+    
+    my $nav_buttons_html = "";
+    
+    $template->process(\$nav_links_template, $vars, \$nav_buttons_html);
+    return $nav_buttons_html;
+}
+
+sub get_total_html
+{
+    my $self = shift;
+
+    return "<ul class=\"nav_links\">\n" .
+        $self->get_nav_buttons_html(@_) .
+        "\n</ul>";
+}
+
+1;
+

File src/about.html.wml

 #include '../template.wml'
 
-<subject "Perl Beginners' Site - About" />
+<latemp_subject "Perl Beginners' Site - About" />
 
 <h2>About</h2>
 

File src/articles/index.html.wml

 #include '../template.wml'
 
-<subject "Collection of Articles" />
+<latemp_subject "Collection of Articles" />
 
 <h2>External Collections of Articles</h2>
 

File src/books/advanced/index.html.wml

 
 #include "../lib/books.wml"
 
-<subject "Advanced Books" />
+<latemp_subject "Advanced Books" />
 
 <p>
 These books are recommended as further reading for the Perl programmer

File src/books/index.html.wml

 
 #include "../lib/books.wml"
 
-<subject "Paper Books" />
+<latemp_subject "Paper Books" />
 
 <ul>
 <li><a href="#beginners">Books for Beginners</a></li>

File src/books/topics/index.html.wml

 #include "../template.wml"
 
-<subject "Perl Books that cover Specific Topics" />
+<latemp_subject "Perl Books that cover Specific Topics" />
 
 <p>
 Perl has many third-party APIs available on CPAN, many of which interface it

File src/contribute/index.html.wml

 #include '../template.wml'
 
-<subject "Contribute to the Perl Beginners' Site" />
+<latemp_subject "Contribute to the Perl Beginners' Site" />
 
 <p>
     We feel that the Perl Beginners' Site should be a community site

File src/contribute/list/index.html.wml

 #include '../template.wml'
 
-<subject "Contributors List" />
+<latemp_subject "Contributors List" />
 
 <dl>
 <dt>

File src/conventions.html.wml

 #include '../template.wml'
 
-<subject "Coding Conventions" />
+<latemp_subject "Coding Conventions" />
 
 <ul>
 <li>

File src/core-doc/index.html.wml

 #include '../template.wml'
 
-<subject "Perl Core Documentation" />
+<latemp_subject "Perl Core Documentation" />
 
 <h2>Online Documentation</h2>
 

File src/download/index.html.wml

 #include '../template.wml'
 
-<subject "CLAN Code Downloads" />
+<latemp_subject "CLAN Code Downloads" />
 
 <h2 class="plain"><a href="./arcs">For Downloads Check here</a></h2>
 

File src/future.html.wml

 #include '../template.wml'
 
-<subject "The Future Vision" />
+<latemp_subject "The Future Vision" />
 
 <p>
 After CLAN is installed on the system it compiles a basic kernel that 

File src/index.html.wml

 #include '../template.wml'
 
-<subject "Perl Beginners' Site" />
+<latemp_subject "Perl Beginners' Site" />
 
 <h2>About</h2>
 

File src/irc/index.html.wml

 #include '../template.wml'
 
-<subject "IRC Channels for Perl Q&amp;A" />
+<latemp_subject "IRC Channels for Perl Q&amp;A" />
 
 <h2>What is the IRC?</h2>
 

File src/links.html.wml

 #include '../template.wml'
 
-<subject "CLAN Links" />
+<latemp_subject "CLAN Links" />
 
 <h2>Documents</h2>
 

File src/links/index.html.wml

 #include '../template.wml'
 
-<subject "Links" />
+<latemp_subject "Links" />
 
 <h2>Main Perl Resources</h2>
 

File src/lkmb/index.html.wml

 #include '../template.wml'
 
-<subject "LKMB - The Linux Kernel Module Builder" />
+<latemp_subject "LKMB - The Linux Kernel Module Builder" />
 
 <h2>About</h2>
 <p>

File src/mailing-lists/index.html.wml

 #include '../template.wml'
 
-<subject "Mailing Lists" />
+<latemp_subject "Mailing Lists" />
 
 <h2>Overview</h2>
 

File src/news/index.html.wml

 #include '../template.wml'
 
-<subject "Perl Beginners' Site - News" />
+<latemp_subject "Perl Beginners' Site - News" />
 
 <h2><a name="news_29_Feb_2004">29-February-2004: New Wiki</a></h2>
 

File src/platforms/index.html.wml

 #include '../template.wml'
 
-<subject "Perl Platforms" />
+<latemp_subject "Perl Platforms" />
 
 <p>
 perl 5 (the most common implementation of the Perl language) was made very 

File src/platforms/mac/index.html.wml

 #include '../template.wml'
 
-<subject "Perl on Mac OS" />
+<latemp_subject "Perl on Mac OS" />
 
 <p>
     Mac OS X, being mostly compatible with UNIX can, easily run Perl 5, as 

File src/platforms/unix/index.html.wml

 #include '../template.wml'
 
-<subject "Perl on UNIX and Linux Systems" />
+<latemp_subject "Perl on UNIX and Linux Systems" />
 
 <p>
     If you are using a UNIX-compatible system (such as Linux or Solaris), most chances

File src/platforms/windows/index.html.wml

 #include '../template.wml'
 
-<subject "Perl on Win32" />
+<latemp_subject "Perl on Win32" />
 
 <p>
     Perl can easily run on Windows and makes for a very powerful and free

File src/site-resources/index.html.wml

 #include '../template.wml'
 
-<subject "Site Resources" />
+<latemp_subject "Site Resources" />
 
 <h2><a href="https://lists.berlios.de/mailman/listinfo/perl-begin-help">Mailing List</a></h2>
 

File src/site-resources/mailing-list/index.html.wml

 #include '../template.wml'
 
-<subject "Our Mailing List" />
+<latemp_subject "Our Mailing List" />
 
 <p>
 Archives, Usage information, and settings (for people who are subscribed)

File src/site-resources/web-forum/index.html.wml

 #include '../template.wml'
 
-<subject "Our Web-Forum" />
+<latemp_subject "Our Web-Forum" />
 
 <p>
 We have a 

File src/site-resources/wiki/index.html.wml

 #include '../template.wml'
 
-<subject "Our Wiki" />
+<latemp_subject "Our Wiki" />
 
 <p>
 A Wiki is a site that can be freely edited by anybody using a web-browser.

File src/source/index.html.wml

 #include '../template.wml'
 
-<subject "Site's Source Code" />
+<latemp_subject "Site's Source Code" />
 
 <p>
 This site is a static HTML site written in

File src/tutorials/index.html.wml

 #include '../template.wml'
 
-<subject "Online Tutorials" />
+<latemp_subject "Online Tutorials" />
 
 <h2>Note</h2>
 

File src/tutorials/localized/index.html.wml

 #include '../template.wml'
 
-<subject "Tutorials in Foreign Languages" />
+<latemp_subject "Tutorials in Foreign Languages" />
 
 <h2><a href="http://lea-linux.org/dev/perl.php3">French Intro to Perl</a></h2>
 

File src/uses/bio-info/index.html.wml

 #include '../template.wml'
 
-<subject "Perl for Bio-Informatics" />
+<latemp_subject "Perl for Bio-Informatics" />
 
 <h2>To be filled in.</h2>

File src/uses/index.html.wml

 #include '../template.wml'
 
-<subject "Common Uses for Perl" />
+<latemp_subject "Common Uses for Perl" />
 
 <p>
 Perl can be used and was utilized for a variety of uses. This section will

File src/uses/qa/index.html.wml

 #include '../template.wml'
 
-<subject "Perl for Quality Assurance and Testing" />
+<latemp_subject "Perl for Quality Assurance and Testing" />
 
 <h2>To be filled in.</h2>

File src/uses/sys-admin/index.html.wml

 #include '../template.wml'
 
-<subject "Perl for System Administration" />
+<latemp_subject "Perl for System Administration" />
 
 <p>
 Perl can be used to perform or automate system administration tasks

File src/uses/web/index.html.wml

 #include '../template.wml'
 
-<subject "Perl for CGI and Web Programming" />
+<latemp_subject "Perl for CGI and Web Programming" />
 
 <p>
 Perl 5 was one of the first available technologies for automating a web-server,

File src/web-forums/index.html.wml

 #include '../template.wml'
 
-<subject "Web Forums" />
+<latemp_subject "Web Forums" />
 
 <h2><a href="http://www.perlmonks.org/">Perl Monks</a></h2>
 

File template.wml

-# #use wml::des::navbar
+#include "latemp/latemp-main.wml"
 
-<:{
-use MyNavData;
-use HTML::Widgets::NavMenu::HeaderRole;
-
-my $filename = "$(FILENAME)";
-$filename =~ s!index\.html$!!;
-$filename = "/$filename";
-
-my $nav_bar = HTML::Widgets::NavMenu::HeaderRole->new(
-    'path_info' => $filename,
-    'current_host' => "berlios",
-    MyNavData::get_params(),
-    'ul_classes' => [ "navbarmain", ("navbarnested") x 10 ],
-    );
-
-my $rendered_results = $nav_bar->render();
-
-use vars qw($nav_links);
-
-$nav_links = $rendered_results->{nav_links};
-
-use vars qw($nav_html);
-
-$nav_html = $rendered_results->{html};
-
-}:>
+<latemp_lang "en-US" />
+<latemp_encoding "iso-8859-1" />
+<latemp_author "Shlomi Fish" />
+<latemp_common_keywords "Perl, perl, beginners, newbies, learn, web design, Berlios, system administration, Unix, unix, UNIX, Linux, Shlomi Fish" />
+<latemp_affiliations_buttons>
+<p>
+<a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=70"><img 
+   style="margin-top:1em; border:0;" alt="Get Firefox!" 
+   title="Get Firefox! A safer, faster, better web-browser." 
+   src="$(ROOT)/images/get-firefox.gif" /></a>
+</p>
+<p>
+<a href="http://validator.w3.org/check/referer"><img 
+    style="border:0" src="http://www.w3.org/Icons/valid-xhtml10" 
+         alt="Valid XHTML 1.0!"
+         /></a>
+</p>
+<p>
+ <a href="http://jigsaw.w3.org/css-validator/validator?uri=http%3A//perl-begin.berlios.de/$(LATEMP_FILENAME)"><img style="border:0"
+       src="http://jigsaw.w3.org/css-validator/images/vcss" 
+       alt="Valid CSS!" /></a>
+</p>
+<p>
+</p>
+</latemp_affiliations_buttons>
+<latemp_webmaster>
+<p>
+<b>Webmaster:</b> <a href="mailto:shlomif@iglu.org.il">Shlomi Fish - shlomif@iglu.org.il</a>
+</p>
+</latemp_webmaster>
 
 <define-tag email:link>
 <a href="mailto:%0">%0</a>
 </define-tag>
 
-# The Definition of the page itself
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html 
-     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
-<head>
-<title>{#SUBJECT_LOC#}</title>
-<link rel="stylesheet" href="$(ROOT)/style.css" type="text/css" />
-<:{
-use CGI qw();
-
-my @keys = (sort { $a cmp $b } keys(%$nav_links));
-foreach my $key (@keys)
-{
-    my $url = $nav_links->{$key};
-    print "<link rel=\"$key\" href=\"" . CGI::escapeHTML($url) . "\" />\n"
-}
-}:>
-</head>
-<body>
-
-
 <define-tag rellink whitespace="delete">
 <preserve url />
 <set-var %attributes />
 </define-tag>
 
 <define-tag nothing></define-tag>
-
-<table summary="Layout Table: The first cell contains a navigation bar, the second the main page" border="0" width="99%">
-<tr>
-<td valign="top" class="navbar" style="width:20%">
-
-<:{ print join("\n", @$nav_html); }:>
-
-<define-tag validhtml>
-<p>
-<a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=70"><img 
-   style="margin-top:1em; border:0;" alt="Get Firefox!" 
-   title="Get Firefox! A safer, faster, better web-browser." 
-   src="$(ROOT)/images/get-firefox.gif" /></a>
-</p>
-<p>
-<a href="http://validator.w3.org/check/referer"><img 
-    style="border:0" src="http://www.w3.org/Icons/valid-xhtml10" 
-         alt="Valid XHTML 1.0!"
-         /></a>
-</p>
-<p>
- <a href="http://jigsaw.w3.org/css-validator/validator?uri=http%%3A//perl-begin.berlios.de/$(FILENAME)"><img style="border:0"
-       src="http://jigsaw.w3.org/css-validator/images/vcss" 
-       alt="Valid CSS!" /></a>
-</p>
-<p>
-</p>
-</define-tag>
-
-# <ifeq "$(FILENAME)" "index.html" "<validhtml />" "" />
-
-<validhtml />
-
-</td>
-<td valign="top" class="main">
-<h1>{#SUBJECT_LOC#}</h1>
-{#BODY#}
-
-</td>
-</tr>
-</table>
-<hr />
-<p>
-<b>Webmaster:</b> <a href="mailto:shlomif@iglu.org.il">Shlomi Fish - shlomif@iglu.org.il</a>
-</p>
-
-</body>
-</html>
-
-<define-tag subject>
-{#SUBJECT_LOC#:%0:##}
-</define-tag>
-
-
-#   per default we are in body
-{#BODY#:
-