diff --git a/config/cdswmllib.wml b/config/cdswmllib.wml index a5a722726..239a3b6c3 100644 --- a/config/cdswmllib.wml +++ b/config/cdswmllib.wml @@ -1,83 +1,93 @@ ## $Id$ ## Library of WML functions of general interest. ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 CERN. ## ## The CDSware 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. ## ## The CDSware 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 CDSware; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## library of WML functions of general interest: <: sub get_language_name { ## Return long name for a language. ## Input: en ## Output: English ($ln) = @_; %longnames = ('en' => 'English', 'fr' => 'Français', 'de' => 'Deutsch', 'es' => 'Español', 'pt' => 'Português', 'it' => 'Italiano', 'ru' => 'Русский', 'sk' => 'Slovenčina', 'cz' => 'Čeština', 'no' => 'Norsk/Bokmål', 'se' => 'Svenska'); return $longnames{$ln}; } sub generate_language_list_for_python { ## Return Python-ready language list out of user-configured WML language list. ## May return short or long version, depending on the first argument. ## Output example: ['en','fr'] ## Output example: [['en','English'],['fr','French']] ($type) = @_; $out = "["; foreach $ln (split /\s*,\s*/, '') { if ($type) { $out .= "['".$ln."','".get_language_name($ln)."'],"; } else { $out .= "'".$ln."',"; } } $out .= "]"; return $out; } sub generate_language_selection_box_for_html { ## Return HTML-ready language selection box links. ## Output example: ($filenamebase, $filenameextension) = split /\./, '$(WML_SRC_BASENAME)'; $out = "
"; foreach $ln (split /\s*,\s*/, '') { $out .= ' '.get_language_name($ln).'   '; } return substr($out, 0, -2); } sub generate_pretty_version_string { - ## Input: CVS $Id$ string + ## Input: CVS DOLLAR Id DOLLAR string ## Output: nicely formatted version number suitable for `bibtaskex --version' - ## Example: ``$Id$'' - ## will generate ``webcoll 1.36 (CDSware 0.3.0)'' + ## Example: ``DOLLAR Id: webcoll.wml,v 1.41 2004/04/21 11:20:06 tibor Exp DOLLAR'' + ## will generate output like ``CDSware/0.3.2 webcoll/1.41'' ($out) = @_; - ($junk, $filename, $revision, $junk) = split / /, $out; + ($junk, $filename, $revision, $date, $junk) = split / /, $out; $filename =~ s/\.wml,v//g; return "CDSware/ " . $filename . "/" . $revision; } + sub generate_pretty_revision_date_string { + ## Input: CVS DOLLAR Id DOLLAR string + ## Output: nicely formatted revision/date number suitable for Admin Guides + ## Example: ``DOLLAR Id: webcoll.wml,v 1.41 2004/04/21 11:20:06 tibor Exp DOLLAR'' + ## will generate output like ``CDSware/0.3.2 webcoll/1.41'' + ($out) = @_; + ($junk, $filename, $revision, $date, $junk) = split / /, $out; + return $revision . ", " . $date; + } + :>