trans-coord-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnu.org-i18n] r318 - in gnu.org-i18n/po4a/www: . prep/i18n


From: Corellia
Subject: [gnu.org-i18n] r318 - in gnu.org-i18n/po4a/www: . prep/i18n
Date: Sat, 29 Dec 2007 21:45:31 +0200

Author: kaloian
Date: Sat Dec 29 21:45:30 2007
New Revision: 318

Log:
* prep/i18n/make-prototype: New script.  Combines functionality
from make-prototype.scm and make-prototype-home.scm, which both
are now obsolete.  Includes sane command line parser and brief
help.
* prep/i18n/make-prototype.scm: Deleted.
* prep/i18n/make-prototype-home.scm: Deleted.
* prep/i18n/GNUmakefile: Updated calls to
prep/i18n/make-prototype.


Added:
   gnu.org-i18n/po4a/www/prep/i18n/make-prototype   (contents, props changed)
Removed:
   gnu.org-i18n/po4a/www/prep/i18n/make-prototype-home.scm
   gnu.org-i18n/po4a/www/prep/i18n/make-prototype.scm
Modified:
   gnu.org-i18n/po4a/www/ChangeLog
   gnu.org-i18n/po4a/www/prep/i18n/GNUmakefile

Modified: gnu.org-i18n/po4a/www/ChangeLog
==============================================================================
--- gnu.org-i18n/po4a/www/ChangeLog     (original)
+++ gnu.org-i18n/po4a/www/ChangeLog     Sat Dec 29 21:45:30 2007
@@ -1,3 +1,14 @@
+2007-12-29  Kaloian Doganov <address@hidden>
+
+       * prep/i18n/make-prototype: New script.  Combines functionality
+       from make-prototype.scm and make-prototype-home.scm, which both
+       are now obsolete.  Includes sane command line parser and brief
+       help.
+       * prep/i18n/make-prototype.scm: Deleted.
+       * prep/i18n/make-prototype-home.scm: Deleted.
+       * prep/i18n/GNUmakefile: Updated calls to
+       prep/i18n/make-prototype.
+
 2007-12-28  Yavor Doganov  <address@hidden>
 
        Initial partially working VCS support for generic.xx.html and the

Modified: gnu.org-i18n/po4a/www/prep/i18n/GNUmakefile
==============================================================================
--- gnu.org-i18n/po4a/www/prep/i18n/GNUmakefile (original)
+++ gnu.org-i18n/po4a/www/prep/i18n/GNUmakefile Sat Dec 29 21:45:30 2007
@@ -20,8 +20,7 @@
 MSGMERGE = msgmerge
 PO4A-GETTEXTIZE = po4a-gettextize
 PO4A-TRANSLATE = po4a-translate
-MAKE-PROTOTYPE = ./make-prototype.scm
-MAKE-PROTOTYPE-HOME = ./make-prototype-home.scm
+MAKE-PROTOTYPE = ./make-prototype
 SED = sed
 M4 = m4
 TOUCH = touch
@@ -148,7 +147,7 @@
 # in order to prevent further messing up in the chain.  For
 # extra safety, exit with an error so that make does not
 # proceed to the next command.
-       $(MAKE-PROTOTYPE-HOME) $< generic.html $@ || ($(RM) $@ ; exit 1)
+       $(MAKE-PROTOTYPE) --home --input=$< --generic=generic.html --output=$@ 
|| ($(RM) $@ ; exit 1)
        $(SED) --in-place "s/\$$Date.*\$$/<gnu.org-i18n>\0<\/gnu.org-i18n>/g" $@
 
 $(rootdir)/po/home.pot: $(rootdir)/po/home.proto
@@ -206,7 +205,7 @@
 # FIXME: Consider using implicit rules, if at all possible.
 define article_pot_rules
 $(1).proto $(1).translinks: $(subst /po/,/,$(1).html)
-       $(MAKE-PROTOTYPE) $$< generic.html $(1).proto $(1).translinks || \
+       $(MAKE-PROTOTYPE) --input=$$< --generic=generic.html 
--output=$(1).proto --translinks=$(1).translinks || \
          ($(RM) $(1).proto $(1).translinks ; exit 1)
        $(SED) --in-place 
"s/\$$$$Date.*\$$$$/<gnu.org-i18n>\0<\/gnu.org-i18n>/g" $(1).proto
 

Added: gnu.org-i18n/po4a/www/prep/i18n/make-prototype
==============================================================================
--- (empty file)
+++ gnu.org-i18n/po4a/www/prep/i18n/make-prototype      Sat Dec 29 21:45:30 2007
@@ -0,0 +1,160 @@
+#!/usr/bin/guile \
+-e main --debug -s
+!#
+
+;; Copyright (C) 2007 Free Software Foundation, Inc.
+
+;; This file is part of GNUnited Nations.
+
+;; GNUNited Nations 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 3, or (at your option)
+;; any later version.
+
+;; GNUnited Nations 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 GNUnited Nations; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+(define version-message
+  (string-append
+   "make-prototype (GNUnited Nations) 0.1\n"
+   "Copyright (C) 2007 Free Software Foundation, Inc.\n"
+   "You may redistribute copies of GNUnited Nations\n"
+   "under the terms of the GNU General Public License.\n"
+   "For more information about these matters, see the file named COPYING.\n"))
+
+(define help-message
+  (string-append
+   "Usage: make-prototype.scm OPTION...\n"
+   "\n"
+   "Input format specification:\n"
+   "      --article              Process input file as an article (default)\n"
+   "      --home                 Process input file as a home page\n"
+   "\n"
+   "Input specification:\n"
+   "  -i, --input=FILE           Input file (article or home page)\n"
+   "  -g, --generic=FILE         Generic notes for a language team\n"
+   "\n"
+   "Output options:\n"
+   "  -o, --output=FILE          Output prototype\n"
+   "  -t, --translinks=FILE      Translations links (meaningful for articles 
only)\n"
+   "\n"
+   "      --version              Just print version info and return\n"
+   "      --help                 Print this usage information message\n"
+   "\n"
+   "Report bugs to address@hidden"))
+
+(define option-grammar
+  '((article (value #f))
+    (home (value #f))
+    (input (single-char #\i) (value #t))
+    (generic (single-char #\g) (value #t))
+    (output (single-char #\o) (value #t))
+    (translinks (single-char #\t) (value #t))
+    (version (value #f))
+    (help (value #f))))
+
+(define article-page-regexp
+  "^(.*)(</div>.*<div id=\"footer\">.*)(<p>.*?[$]Date:.*)(<ul 
class=\"translations-list\">.*</ul>)(.*)$")
+
+(define home-page-regexp
+  "^(.*)(</div>.*<div id=\"footer\">.*)(<p>.*?[$]Date:.*)$")
+
+(define slot-translators-note
+  "\n<div style=\"font-size: small;\">GNU-i18n-SLOT: TRANSLATOR'S 
NOTES</div>\n")
+
+(define slot-translators-credits
+  "\n<div class=\"translators-credits\">GNU-i18n-SLOT: TRANSLATOR'S 
CREDITS</div>\n")
+
+; ./make-prototype.scm --article --input=IN.HTML --generic=GENERIC.BG.HTML 
--translinks=ARTICLE.TRANSLINKS  --output=OUT.HTML
+; ./make-prototype.scm --home --input=IN.HTML --generic=GENERIC.BG.HTML 
--output=OUT.HTML
+; ./make-prototype.scm --version
+; ./make-prototype.scm --help
+
+(use-modules (ice-9 regex)
+            (ice-9 rdelim)
+            (ice-9 getopt-long))
+
+(define (main args)
+  (let* ((options (catch 'misc-error
+                        (lambda () (getopt-long args option-grammar))
+                        (lambda (key subr message args data)
+                          (die (apply format #f message args)))))
+        (opt (lambda args (apply option-ref options args))))
+    (cond ((opt 'version #f) (version))
+         ((opt 'help #f) (help))
+         ((and (opt 'article #f)
+               (opt 'home #f))
+          (die "conflicting options: `--article' and `--home'"))
+         ((not (opt 'input #f))
+          (die "no input file"))
+         ((not (opt 'generic #f))
+          (die "no generic file"))
+         ((not (opt 'output #f))
+          (die "no output file"))
+         ((opt 'home #f)
+          (and (opt 'translinks #f)
+               (die "`--translinks' makes no sense for home pages"))
+          (make-home (opt 'input #f)
+                     (opt 'generic #f)
+                     (opt 'output #f)))
+         ((opt 'article #t)
+          (or (opt 'translinks #f)
+              (die "no translinks file"))
+          (make-article (opt 'input #f)
+                        (opt 'generic #f)
+                        (opt 'output #f)
+                        (opt 'translinks #f))))))
+
+(define (die message)
+  (display "make-prototype: " (current-error-port))
+  (display message (current-error-port))
+  (newline (current-error-port))
+  (exit 2))
+
+(define (version)
+  (display version-message))
+
+(define (help)
+  (display help-message))
+
+(define (make-article input generic output translinks)
+  (display (format #f "make-article ~s ~s ~s ~s\n" input generic output 
translinks) (current-error-port))
+  (with-input-from-file input
+    (lambda ()
+      (let ((m (string-match article-page-regexp (read-delimited ""))))
+       (with-output-to-file output
+         (lambda ()
+           (display
+            (string-append (match:substring m 1)
+                           slot-translators-note
+                           (match:substring m 2)
+                           slot-translators-credits
+                           "<gnu.org-i18n>include(`" generic 
"')</gnu.org-i18n> "
+                           (match:substring m 3)
+                           "<gnu.org-i18n>include(`" translinks 
"')</gnu.org-i18n>"
+                           (match:substring m 5)))))
+       (with-output-to-file translinks
+         (lambda ()
+           (display (match:substring m 4))))))))
+
+(define (make-home input generic output)
+  (display (format #f "make-home ~s ~s ~s\n" input generic output) 
(current-error-port))
+  (with-input-from-file input
+    (lambda ()
+      (let ((m (string-match home-page-regexp (read-delimited ""))))
+       (with-output-to-file output
+         (lambda ()
+           (display
+            (string-append (match:substring m 1)
+                           slot-translators-note
+                           (match:substring m 2)
+                           slot-translators-credits
+                           "<gnu.org-i18n>include(`" generic 
"')</gnu.org-i18n> "
+                           (match:substring m 3)))))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]