From 46195ced3679368b868db235c30ba0f009cb31d2 Mon Sep 17 00:00:00 2001 From: jonas Date: Fri, 17 Jan 2003 21:06:46 +0000 Subject: [PATCH] The great word of blessendness and a feeling of ease a cup of the well of freedom and life we joyfully drink Inside, all was new, but outwards nothing had changed an escapade, then to the alter to evaluate all parts, of the great mystery but all remains on the same spot, no signs of a new season In my hand is a new word, but the word is still without a body a hidden life-stream that swells in the deep will soon give the word a second face. (In Flames; The New World) svn path=/trunk/; revision=2955 --- blue-new.css | 76 ++++++ fsfe-new.xsl | 131 ++++++++++ projects/agnula/project.en.xml | 17 ++ projects/projects.en.xhtml | 12 + projects/projects.sources | 2 + projects/projects.xsl | 63 +++++ tools/README | 10 + tools/build.pl | 438 +++++++++++++++++++++++++++++++++ tools/menu-global.xml | 13 + tools/texts-en.xml | 44 ++++ 10 files changed, 806 insertions(+) create mode 100644 blue-new.css create mode 100644 fsfe-new.xsl create mode 100644 projects/agnula/project.en.xml create mode 100644 projects/projects.en.xhtml create mode 100644 projects/projects.sources create mode 100644 projects/projects.xsl create mode 100644 tools/README create mode 100644 tools/build.pl create mode 100644 tools/menu-global.xml create mode 100644 tools/texts-en.xml diff --git a/blue-new.css b/blue-new.css new file mode 100644 index 0000000000..d46a135aa2 --- /dev/null +++ b/blue-new.css @@ -0,0 +1,76 @@ +BODY { font-family: Helvetica, Verdana, sans-serif; + font-size: 13px; + background: #ffffff; + color: #000000; + margin-left: 0px; + margin-right: 0px; + margin-top: 0px; + margin-bottom: 0px; + margin: 0; + padding: 0; + } + +TD.focus-top-hinge { + background: #00389a; + text-align: left; + padding: 4px; + font-size: 11px; + font-weight: bold; + color: #ffffff; + } + +TD.focus-box { + background: #00389a; + border-top: solid #00389a; + border-left: solid #00389a; + border-right: solid #00389a; + border-width: thin; + font-size: 11px; + } + +TABLE.focus { + background: #00389a; + } + +TD.line { + border-top: solid #00389a; + border-bottom: solid #00389a; + border-width: thin; + } + +TD.focus { + background: #00389a; + width: 150px; + } + +TD.menu { + padding: 10px; + background: #00389a; + width: 150px; + vertical-align: top; + } + +h3.menu { + color: #ffffff; + border-bottom: solid white; + border-width: thin; + font-size: 15px; + } +A,P,DIV { + font-size: 13px; + } +a.menu { + color: #ffffff; + text-decoration: none; + font-size: 15px; + font-weight: bold; + } +a.menu:visited { + color: #eeeeee; + text-decoration: none; + } +a.menu:hover { + background-color: #ffffff; + color: #00389a; + text-decoration: underline; + } diff --git a/fsfe-new.xsl b/fsfe-new.xsl new file mode 100644 index 0000000000..08468e3e5c --- /dev/null +++ b/fsfe-new.xsl @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + DO NOT MODIFY THIS DOCUMENT. IT WAS GENERATED BY XSLT PROCESSING + AND YOUR MODIFICATIONS WILL BE LOST. THE SOURCE OF THE DOCUMENT + IS IN THE .xml FILE USE make all TO REGENERATE + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + +
+ +
+
+ + +
+ +
+
+
+
+ + + + + + + + + ..html + + + + + + +
+
+ +
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + +
diff --git a/projects/agnula/project.en.xml b/projects/agnula/project.en.xml new file mode 100644 index 0000000000..3823d7c856 --- /dev/null +++ b/projects/agnula/project.en.xml @@ -0,0 +1,17 @@ + + + + + A GNU/Linux Audio distribution + + AGNULA's main task will be the development of two reference + distributions for the GNU/Linux operating system completely based on + Free Software (i.e. under a FSF approved Free Software license) and + completely devoted to professional and consumer audio applications and + multimedia development. One distribution will be Debian-based (DeMuDi) + and the other will be Red Hat-based (ReHMuDi). Both will be available + on the network for download and on CD. + + /projects/agnula/agnula.html + + diff --git a/projects/projects.en.xhtml b/projects/projects.en.xhtml new file mode 100644 index 0000000000..72c2a40eec --- /dev/null +++ b/projects/projects.en.xhtml @@ -0,0 +1,12 @@ + + + + + Free Software Foundation Europe + + +A list of projects. + + + + diff --git a/projects/projects.sources b/projects/projects.sources new file mode 100644 index 0000000000..6325e245ca --- /dev/null +++ b/projects/projects.sources @@ -0,0 +1,2 @@ +projects/*/project:global +de/projects/*/project:de diff --git a/projects/projects.xsl b/projects/projects.xsl new file mode 100644 index 0000000000..2d58474643 --- /dev/null +++ b/projects/projects.xsl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
TechnicalLegalSociologicalOther
+ +


+

+
+
+ +


+

+
+
+ +


+

+
+
+ +


+

+
+
+ +
+ + + + + + + + + +
+ diff --git a/tools/README b/tools/README new file mode 100644 index 0000000000..bd7787a8d1 --- /dev/null +++ b/tools/README @@ -0,0 +1,10 @@ +Files in this directory: + + boilerplate* ? + preproc.pl ? + test.* ? + translate.sh Creates list of translations for a page + build.pl The all might build script + menu-*.xml Menues for all focuses ("inherits" from global) + texts-*.xml Static texts for all languages. + diff --git a/tools/build.pl b/tools/build.pl new file mode 100644 index 0000000000..2ee2f75eb8 --- /dev/null +++ b/tools/build.pl @@ -0,0 +1,438 @@ +#! /usr/bin/perl +# +# build.pl - a tool for building FSF Europe web pages +# +# Copyright (C) 2003 Jonas Öberg +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +use File::Find::Rule; +use Getopt::Std; +use File::Path; +use File::Basename; +use XML::LibXSLT; +use XML::LibXML; +use File::Copy; + +# This defines the focuses and their respective preferred / original +# language. For example, it says that we should have a focus called +# "se" (Sweden) which has the preferred language "sv" (Swedish). +# +# This also says that documents in the directory /se should be considered +# as having the Swedish version as the original, and so on. +# +our %countries = ( + global => 'en', + se => 'sv', + de => 'de', + fr => 'fr' ); + +# +# This is a hash of all the languages that we have translations into, and their +# respective names in the local language. Make sure that one entry exists +# here for every language, or it won't be rendered. +# +our %languages = ( + cs => 'Cesky', + de => 'Deutsch', + en => 'English', + es => 'Español', + fr => 'Français', + it => 'Italiano', + pt => 'Português', + sv => 'Svenska', +); + +# +# Parse the command line options. We need two; where to put the finished +# pages and what to use as base for the input. +# +getopts('o:i:', \%opts); +unless ($opts{o} && $opts{i}) { + print STDERR "Usage: $0 -o -i \n"; + exit 1; +} + +# +# First topic of today: create all directories we need. Instead of creating +# these as they are used, we create them in a batch at the beginning of each +# run, so we won't have to worry about them later. +# Note though that this also REMOVES the previous paths. You don't want to +# build directly into the production web tree. +# +my @dirs = File::Find::Rule->directory() + ->in($opts{i}); + +while (my ($path, undef) = each %countries) { + print STDERR "Reseting path for $path\n"; + rmtree($opts{o}.'/'.$path); + my @paths = map { $opts{o}."/$path/".$_ } grep(!/^\.\.?$/, @dirs); + foreach (@paths) { + mkpath($_); + } +} + +# +# Here starts our real work. First we get ourselves a list of all files +# that we need to worry about and then single out the XHTML files. We +# create a hash of hashes, %bases, which contains the basename of each +# file, together with the translations that it exists in. +# +my @files = File::Find::Rule->file() + ->in($opts{i}); + +my %bases; +foreach (grep(/\.xhtml$/, @files)) { + my ($lang) = ($_ =~ /\.([a-z][a-z])\.xhtml$/); + unless ($lang) { $lang = "en"; } + $_ =~ s/\.[a-z][a-z]\.xhtml//; + $bases{$_}{$lang} = 1; +} + +$| = 1; + +# +# For each file, translation and focus, we create a new XML file. This will +# contain all information that the XSL needs to produce a finished page. +# The XML file will look like this: +# +# +# +# Svenska +# ... +# +# +# ... +# +# +# ... +# +# +# +# ... +# ... +# +# +# +# +# In addition to this, the buildinfo and document root will be equipped with +# the following attributes: +# +# buildinfo/@original The language code of the original document +# buildinfo/@filename The filename without language or trailing .html +# buildinfo/@language The language that we're building into +# buildinfo/@outdated Set to "yes" if the original is newer than this page +# document/@language The language that this documents is in +# +while (my ($file, $langs) = each %bases) { + print STDERR "Building $file.. "; + + # + # Create XML and XSLT parser contexts. Also create the root note for the + # above mentioned XML file (used to feed the XSL transformation). + # + my $parser = XML::LibXML->new(); + my $xslt_parser = XML::LibXSLT->new(); + + my $dom = XML::LibXML::Document->new("1.0", "iso-8859-1"); + my $root = $dom->createElement("buildinfo"); + $dom->setDocumentElement($root); + + # + # Find original language. It's en, unless we're in the country specific + # se/, fr/, de/ and so on, directories. + # + $root->setAttribute("original", "en"); + if ($file =~ /^([a-z][a-z])\//) { + $root->setAttribute("original", $countries{$1}); + } + + $root->setAttribute("filename", "/$file"); + + # + # Find all translations for this document, and create the trlist set + # for them. + # + my $trlist = $dom->createElement("trlist"); + while (my ($lang, undef) = each %{ $langs }) { + my $tr = $dom->createElement("tr"); + $tr->setAttribute("id", $lang); + $tr->appendText($languages{$lang}); + $trlist->appendChild($tr); + } + $root->appendChild($trlist); + + # + # Transform it, once for every focus! + # + while (my ($dir, undef) = each %countries) { + print STDERR "$dir "; + + # + # And once for every language! + # + while (my ($lang, undef) = each %languages) { + $root->setAttribute("language", $lang); + + # + # This finds the source file to use. If we can't find a translation + # into the language, it uses the english version instead, or that in + # the local language. Or the first version it finds. This should be + # made prettier. + # + my $document = $dom->createElement("document"); + $document->setAttribute("language", $lang); + $root->appendChild($document); + + my $source = $opts{i}."/$file.$lang.xhtml"; + unless (-f $source) { + if ($lang eq "en" && -f $opts{i}."/$file.xhtml") { + $document->setAttribute("language", "en"); + $source = $opts{i}."/$file.xhtml"; + } elsif (-f $opts{i}."/$file.en.xhtml") { + $document->setAttribute("language", "en"); + $source = $opts{i}."/$file.en.xhtml"; + } elsif (-f $opts{i}."/$file.".$root->getAttribute("original").".xhtml") { + $document->setAttribute("language", $root->getAttribute("original")); + $source = $opts{i}."/$file.".$root->getAttribute("original").".xhtml"; + } else { + my $l = (keys %{$bases{$file}})[0]; + $document->setAttribute("language", $l); + $source = $opts{i}."/$file.$l.xhtml"; + } + } + + # + # Here begins automated magic for those pages which we need to + # assemble other sets of informations for first (automatically + # updated pages). + # + if (-f $opts{i}."/$file.xsl") { + # + # Settle down please, children. First we remove all previous + # document leftovers. + # + foreach ($root->getElementsByTagName("document")) { + $root->removeChild($_); + } + $root->appendChild($document); + + # + # Get the list of sources and create the files hash. The files + # hash contains the base name for each file we want to use, and + # then the language for it as a value. It prefers a file in the + # language we're building into, but will accept an English file as + # a substitute. + # + # "Learn all that is learnable and return that information + # to the Creator." + # + open(IN, '<', $opts{i}."/$file.sources"); + my @auto_sources = ; + close IN; + my %files; + foreach (@auto_sources) { + if (/(.*):[a-z,]*global/ || /(.*):[a-z,]*$dir/) { + foreach my $f (glob("$1*")) { + if ($f =~ /(.*)\.([a-z][a-z])\.xml$/) { + if ($2 eq "en" && !exists $files{$1}) { + $files{$1} = $2; + } elsif ($2 eq $lang) { + $files{$1} = $2; + } + } + } + } + } + + # + # With that information, we load the source document and create + # a new element in it, called , which will hold the combined + # knowledge of all the sets in the source files. + # + my $sourcedoc = $parser->parse_file($source); + my $auto_data = $sourcedoc->createElement("set"); + + while (my ($base, $l) = each %files) { + my $source_data = $parser->parse_file($opts{i}."/$base.$l.xml"); + foreach ($source_data->documentElement->childNodes) { + my $c = $_->cloneNode(1); + $auto_data->appendChild($c); + } + } + $sourcedoc->documentElement->appendChild($auto_data); + + # + # Transform the document using the XSL file and then push the + # result into the element of the document we're building. + # + my $style_doc = $parser->parse_file($opts{i}."/$file.xsl"); + my $stylesheet = $xslt_parser->parse_stylesheet($style_doc); + my $results = $stylesheet->transform($sourcedoc); + + foreach ($results->documentElement->childNodes) { + my $c = $_->cloneNode(1); + $document->appendChild($c); + } + } else { + # + # If this wasn't an automatically updating document, we simply + # clone the contents of the source file into the document. + # + clone_document($document, $source); + } + + # + # Find out if this translation is to be regarded as outdated or not. + # Make allowances for files called either file.en.xhtml or file.xhtml. + # + if ((stat($opts{i}."/$file.".$root->getAttribute("original").".xhtml"))[9] > + (stat($source))[9]) { + $root->setAttribute("outdated", "yes"); + } else { + $root->setAttribute("outdated", "no"); + } + + if ($lang eq "en" && -f $opts{i}."/$file.xhtml") { + if ((stat($opts{i}."/$file.xhtml"))[9] > + (stat($source))[9]) { + $root->setAttribute("outdated", "yes"); + } else { + $root->setAttribute("outdated", "no"); + } + } + + # + # Get the appropriate textset for this language. If one can't be + # found, use the English. (I hope this never happens) + # + my $textlang = $lang; + unless (-f $opts{i}."/tools/texts-$textlang.xml") { + $textlang = "en"; + } + + my $textdoc = $dom->createElement("textset"); + $root->appendChild($textdoc); + clone_document($textdoc, $opts{i}."/tools/texts-$textlang.xml"); + + # + # And then we do the same thing for the menues. But first we take the + # global menu here, then we add any information that is specific to + # the focus. + # + # FIXME: Allow for headings and subitems. + foreach ($root->getElementsByTagName("menuset")) { + $root->removeChild($_); + } + + my %menu; + foreach ('global', $dir) { + if (-f $opts{i}."/tools/menu-$_.xml") { + my $menudoc = $parser->parse_file($opts{i}."/tools/menu-$_.xml"); + foreach my $n ($menudoc->documentElement->getElementsByTagName("menu")) { + $menu{$n->getAttribute("id")} = $n->textContent; + } + } + } + my $menuroot = $dom->createElement("menuset"); + while (my ($id, $href) = each %menu) { + my $m = $dom->createElement("menu"); + $m->setAttribute("id", $id); + $m->appendText($href); + $menuroot->appendChild($m); + } + $root->appendChild($menuroot); + + + # + # Do the actual transformation. + # + my $style_doc = $parser->parse_file("fsfe-new.xsl"); + my $stylesheet = $xslt_parser->parse_stylesheet($style_doc); + my $results = $stylesheet->transform($dom); + + # + # In post-processing, we replace links pointing back to ourselves + # so that they point to the correct language. + # + foreach ($results->documentElement->getElementsByTagName("a")) { + if ($_->getAttribute("href") !~ /^http/) { + my $href = $_->getAttribute("href"); + if ($href !~ /\.html$/) { + if (-d $opts{i}."/$href") { + $href =~ s/\/?$/\/index.$lang.html/; + } else { + $href .= ".$lang.html"; + } + } else { + $href =~ s/([^\.][a-z][a-z])\.html/$1.$lang.html/; + } + $_->setAttribute("href", $href); + } + } + + $stylesheet->output_file($results, "$opts{o}/$dir/$file.$lang.html"); + } + } + print STDERR "\n"; +} + +# +# For all files that are not XHTML source files, we copy them verbatim to +# the final location, for each focus. These should be links instead to +# prevent us from vasting disk space. +# +print STDERR "Copying misc files\n"; +foreach (grep(!/\.xhtml$/, @files)) { + while (my ($dir, undef) = each %countries) { + copy("$opts{i}/$_", "$opts{o}/$dir/$_") if -f "$opts{i}/$_"; + } +} + +# +# Helper function that clones a document. It accepts an XML node and +# a filename as parameters. Using this, it loads the source file into +# the XML node. +# +sub clone_document { + my ($doc, $source) = @_; + my $root = $doc->parentNode; + + foreach ($root->getElementsByTagName($doc->nodeName)) { + $root->removeChild($_); + } + $root->appendChild($doc); + + my $parser = XML::LibXML->new(); + + open(IN, '<', $source); + $textsource = join('', ); + + # + # This requires an explanation. I had bad luck with some versions of + # XML::LibXML wanting to validate the DTD. So just to be extra safe + # we maintain a local copy of it, so it doesn't need to go browsing + # www.w3.org for -every- parsing. + # + $textsource =~ s|http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd|tools/xhtml1-transitional.dtd|g; + + my $sourcedoc = $parser->parse_string($textsource); + foreach ($sourcedoc->documentElement->childNodes) { + $_->unbindNode(); + my $n = $_->cloneNode(1); + $doc->appendChild($n); + } +} diff --git a/tools/menu-global.xml b/tools/menu-global.xml new file mode 100644 index 0000000000..2d36f4dda1 --- /dev/null +++ b/tools/menu-global.xml @@ -0,0 +1,13 @@ + + + + /about/about.html + /projects/projects.html + /documents/documents.html + /events/events.html + /help/help.html + /donate/donate.html + /order/order.html + /contact/contact.html + + diff --git a/tools/texts-en.xml b/tools/texts-en.xml new file mode 100644 index 0000000000..8dfa803112 --- /dev/null +++ b/tools/texts-en.xml @@ -0,0 +1,44 @@ + + + + + Copyright (C) 2003 FSF Europe
+ Verbatim copying and distribution of this entire article is permitted + in any medium, provided this notice is preserved. +
+ Focus + Find + Select focus + +

Warning: + This page may be out of date with the original. Please use + this page to see how you can help + with translations, and other things. +

+
+ +

Warning: + This page has not been translated yet. What you're seeing below + is the original version of the page. Please use + tihs page to see how you can help + with translations, and other things. +

+
+ About + Projects + Technical + Other + Legal + Awareness + Documents + Events + Help + Donate + Order + Contact + Associates + Mailing Lists + ThankGNUs + News + Press Information +