[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trans-coord/gnun/server/gnun AUTHORS ChangeLog ...
From: |
Pavel Kharitonov |
Subject: |
trans-coord/gnun/server/gnun AUTHORS ChangeLog ... |
Date: |
Thu, 04 Oct 2012 14:43:18 +0000 |
CVSROOT: /sources/trans-coord
Module name: trans-coord
Changes by: Pavel Kharitonov <ineiev> 12/10/04 14:43:18
Modified files:
gnun/server/gnun: AUTHORS ChangeLog GNUmakefile Makefile.am NEWS
README configure.ac
gnun/server/gnun/doc: gnun.texi
Added files:
gnun/server/gnun: make-prototype.awk
Removed files:
gnun/server/gnun: make-prototype make-prototype.in
Log message:
Replace `make-prototype' with and awk script; the latter
is faster, profides more diagnostics and eliminates
a dependency (Guile).
* make-prototype.awk: New file.
* make-prototype.in: Remove.
* configure.ac: Don't check for Guile; use awk instead.
* GNUmakefile (MAKE-PROTOTYPE, generate-proto):
Use awk implementation of `make-prototype'.
* doc/gnun.texi (make-prototype): Remove node.
* AUTHORS:
* NEWS:
* README: Update.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/AUTHORS?cvsroot=trans-coord&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.296&r2=1.297
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.140&r2=1.141
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/Makefile.am?cvsroot=trans-coord&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/README?cvsroot=trans-coord&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/configure.ac?cvsroot=trans-coord&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/make-prototype.awk?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/make-prototype?cvsroot=trans-coord&r1=1.11&r2=0
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/make-prototype.in?cvsroot=trans-coord&r1=1.9&r2=0
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/doc/gnun.texi?cvsroot=trans-coord&r1=1.60&r2=1.61
Patches:
Index: AUTHORS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/AUTHORS,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- AUTHORS 31 May 2012 04:44:42 -0000 1.10
+++ AUTHORS 4 Oct 2012 14:43:17 -0000 1.11
@@ -9,7 +9,7 @@
diff-page-tail.html, dtd/html5.dtd (based on W3C DTD),
expand-m4-includes.in, expand-ssi.awk,
languages.txt (compiled from www.gnu.org pages),
- gnun-add-fuzzy-diff, priorities.mk,
+ gnun-add-fuzzy-diff, make-prototype.awk, priorities.mk,
translinks-head.html, translinks-tail.html,
update-localized-urls.in.
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.296
retrieving revision 1.297
diff -u -b -r1.296 -r1.297
--- ChangeLog 2 Oct 2012 11:48:05 -0000 1.296
+++ ChangeLog 4 Oct 2012 14:43:17 -0000 1.297
@@ -1,3 +1,19 @@
+2012-10-04 Pavel Kharitonov <address@hidden>
+
+ Replace `make-prototype' with and awk script; the latter
+ is faster, profides more diagnostics and eliminates
+ a dependency (Guile).
+
+ * make-prototype.awk: New file.
+ * make-prototype.in: Remove.
+ * configure.ac: Don't check for Guile; use awk instead.
+ * GNUmakefile (MAKE-PROTOTYPE, generate-proto):
+ Use awk implementation of `make-prototype'.
+ * doc/gnun.texi (make-prototype): Remove node.
+ * AUTHORS:
+ * NEWS:
+ * README: Update.
+
2012-10-02 Pavel Kharitonov <address@hidden>
Fix a bug in optional templates (`generate-html'
Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -b -r1.140 -r1.141
--- GNUmakefile 2 Oct 2012 11:48:04 -0000 1.140
+++ GNUmakefile 4 Oct 2012 14:43:17 -0000 1.141
@@ -29,7 +29,7 @@
VALIDATE-HTML-NOTIFY := $(pkglibexecdir)/validate-html-notify
MAILFAIL := $(pkglibexecdir)/mailfail
-MAKE-PROTOTYPE := $(pkglibexecdir)/make-prototype
+MAKE-PROTOTYPE := $(AWK) -f $(pkglibexecdir)/make-prototype.awk
UPDATE-LOCALIZED-URLS := $(pkglibexecdir)/update-localized-urls
ADD-FUZZY-DIFF := $(pkglibexecdir)/add-fuzzy-diff
COPY-MSGID := $(pkglibexecdir)/copy-msgid
@@ -628,8 +628,7 @@
define generate-proto
$(MAILFAIL) $(NOTIFYSKIP) $(web-addr),$(devel-addr) \
"[GNUN Error] Incompatible change in $(subst $(rootdir)/,,$<)" \
- $(MAKE-PROTOTYPE) --home --input=$< --generic=generic.html --output=$@ \
- || ($(RM) $@ ; exit 1)
+ $(MAKE-PROTOTYPE) < $< > $@ || ($(RM) $@ ; exit 1)
$(SED) --in-place -e '/<span[[:space:]]*$$/{:egin;N; />[^\n]*$$/! begin};\
s,<span[[:space:]]\+class="gnun-split"></span>,<gnun></gnun>,g' \
-e "s/\$$Date.*\$$/<gnun>\0<\/gnun>/g" $@
Index: Makefile.am
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/Makefile.am,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- Makefile.am 5 Jun 2012 10:13:07 -0000 1.31
+++ Makefile.am 4 Oct 2012 14:43:17 -0000 1.32
@@ -41,11 +41,7 @@
pkglibexec_SCRIPTS += add-fuzzy-diff
endif
-if HAVE_GUILE
-pkglibexec_SCRIPTS += make-prototype
-endif
-
-dist_pkglibexec_SCRIPTS = expand-ssi.awk mailfail
+dist_pkglibexec_SCRIPTS = expand-ssi.awk mailfail make-prototype.awk
edit = $(SED) \
-e 's|@address@hidden|$(PACKAGE)|g' \
Index: NEWS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/NEWS,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- NEWS 26 Sep 2012 14:39:04 -0000 1.66
+++ NEWS 4 Oct 2012 14:43:17 -0000 1.67
@@ -2,6 +2,8 @@
* Changes in GNUnited Nations 0.7 (????-??-??)
+** GNUN doesn't depend on Guile any more.
+
** <span class="gnun-split"></span> is used as a separator to split
long strings of the original files.
Index: README
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/README,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- README 30 Jan 2012 09:24:01 -0000 1.10
+++ README 4 Oct 2012 14:43:17 -0000 1.11
@@ -30,9 +30,6 @@
* GNU Gettext (>= 0.16)
http://www.gnu.org/software/gettext
-* GNU Guile (>= 1.6)
- http://www.gnu.org/software/guile
-
* GNU Awk (other `awk' implementations are untested)
http://www.gnu.org/software/gawk
Index: configure.ac
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/configure.ac,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- configure.ac 28 Jun 2012 19:15:06 -0000 1.37
+++ configure.ac 4 Oct 2012 14:43:17 -0000 1.38
@@ -126,17 +126,13 @@
AS_IF([test -n "$MSGATTRIB"], [decent_msgattrib=yes], [decent_msgattrib=no])
AM_CONDITIONAL([NEW_MSGATTRIB], [test "$decent_msgattrib" = yes])
-AC_PATH_PROG([GUILE], [guile])
-AS_IF([test -n "$GUILE"], [have_guile=yes], [have_guile=no])
-AM_CONDITIONAL([HAVE_GUILE], [test -n "$GUILE"])
-
AC_ARG_VAR([WDIFF], [the `wdiff' program])
AC_PATH_PROG([WDIFF], [wdiff])
AS_IF([test -n "$WDIFF"], [have_wdiff=yes], [have_wdiff=no])
AM_CONDITIONAL([HAVE_WDIFF], [test -n "$WDIFF"])
-# Po4a is useless for our purpose if Guile is missing.
-if test "$have_guile" = yes; then
+# Po4a is useless for our purpose if awk is missing.
+if test "$decent_awk" = yes; then
AC_ARG_VAR([PO4A_GETTEXTIZE], [the `po4a-gettextize' program])
AC_CHECK_PROGS([PO4A_GETTEXTIZE], [po4a-gettextize])
AC_ARG_VAR([PO4A_TRANSLATE], [the `po4a-translate' program])
@@ -219,8 +215,6 @@
AM_CONDITIONAL([HAVE_PO4A], [test "$gnun_cv_recent_po4a" = yes])
AC_CONFIG_FILES([Makefile doc/Makefile dtd/Makefile config.mk])
-AS_IF([test -n "$GUILE"],
- [AC_CONFIG_FILES([make-prototype], [chmod +x make-prototype])])
AS_IF([test "$decent_msgattrib" = yes],
[AC_CONFIG_FILES([gnun-clear-previous], [chmod +x gnun-clear-previous])
AS_CASE(["$gnun_cv_recent_po4a"], [yes],
@@ -233,7 +227,6 @@
EOF
echo "Basic make operations... $decent_make"
echo "PO files manipulation, make report... $decent_gettext"
-echo "make-prototype... $have_guile"
echo "gnun-clear-previous... $decent_msgattrib"
echo "gnun-add-fuzzy-diff... $have_wdiff"
echo "POT/HTML generation... $gnun_cv_recent_po4a"
Index: doc/gnun.texi
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/doc/gnun.texi,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- doc/gnun.texi 26 Sep 2012 14:39:04 -0000 1.60
+++ doc/gnun.texi 4 Oct 2012 14:43:18 -0000 1.61
@@ -2055,7 +2055,6 @@
They all can be invoked separately, as stand-alone programs.
@menu
-* make-prototype::
* gnun-add-fuzzy-diff:: Add differences to previous
@code{msgid}s.
* gnun-init-po:: Initialize a new translation.
@@ -2068,66 +2067,6 @@
* gnun-clear-previous::
@end menu
address@hidden make-prototype
address@hidden The @command{make-prototype} Script
address@hidden POT generation
address@hidden prototype generation
address@hidden generation, POT, .proto
-
-This is a Guile script which makes the ``prototype'' file,
address@hidden@var{lang}.proto}, from which the POT is generated. GNUN is
-designed in such a way, because it would be no big improvement if links
-to other translations ended up in the POT---it would mean that
-translators would have to manually update their PO file when a new
-translation is address@hidden version 0.5, those links are
-maintained in a separate file included with SSI directives.}
-
-In addition, @command{make-prototype} guards the timestamp (the
address@hidden RCS keyword) in order the timestamp of the translation to
-be updated @emph{only} when there are actual changes, being automatic
-or not.
-
-Finally, @command{make-prototype} ``injects'' the artificial elements
-`*GNUN-SLOT: TRANSLATOR'S NOTES*' and `*GNUN-SLOT: TRANSLATOR'S
-CREDITS*', thanks to which it is possible to insert the name of the
-translator and translator's notes, if necessary. @xref{New
-Translation}.
-
-Here are the options that @command{make-prototype} accepts:
-
address@hidden @option
address@hidden --article
-Process the input file as an article. This is the address@hidden
-of version 0.5, this option is considered obsolete because the lists of
-translations are implemented as an automatically generated file included
-via SSI directive just like the respective list is included in the
-homepage. @xref{languages.txt}. In the future, both the
address@hidden and the @code{--home} option will be removed.}
-
address@hidden --home
-Process the input article as a homepage. Specify this when you want
-to create a @file{.proto} file for a homepage.
-
address@hidden -i
address@hidden address@hidden
-Input file, which can be a common article (essay) or a homepage.
-
address@hidden -g
address@hidden address@hidden
-Common notes for a translation team; this is the
address@hidden@var{lang}.html} file. @xref{generic.LANG.html}.
-
address@hidden -o
address@hidden address@hidden
-The file where to write the output of the script.
-
address@hidden --version
-Print copyright and version information on the standard output.
-
address@hidden --help
-Print usage information on stdout.
address@hidden table
-
@node gnun-add-fuzzy-diff
@subsection The @command{gnun-add-fuzzy-diff} Script
@cindex previous, diff
Index: make-prototype.awk
===================================================================
RCS file: make-prototype.awk
diff -N make-prototype.awk
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ make-prototype.awk 4 Oct 2012 14:43:18 -0000 1.1
@@ -0,0 +1,63 @@
+# make-prototype.awk: generate `prototype' HTML.
+
+# Copyright (C) 2012 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 of the
+# License, 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. If not, see <http://www.gnu.org/licenses/>.
+
+# Read whole file to `text'.
+{ text = text $0 RT }
+
+END {
+
+# Program's name to prepend error messages.
+ my_name = "make-prototype.awk: "
+# Default name of file with `generic' message.
+ if(generic_file == "")
+ generic_file = "generic.html"
+
+ if (!match(text, /(<title>.*)(<\/div>.*<div id="footer">)(.*)/, parts))
+ {
+ print my_name \
+ "`<title>' followed by `</div>' and `<div id=\"footer\">' not found" \
+ > "/dev/stderr"
+ exit 1
+ }
+ output = ""
+ if (RSTART > 1)
+ output = substr(text, 1, RSTART-1)
+ output = output "<gnun></gnun>"\
+ "<!-- This file is automatically generated by GNUnited Nations! -->\n" \
+ parts[1] \
+"\n" \
+"<div style=\"font-size: small;\">\n" \
+"<!--TRANSLATORS: Use space (SPC) as msgstr if you don't have notes.-->\n" \
+"*GNUN-SLOT: TRANSLATOR'S NOTES*</div>\n" \
+ parts[2]
+
+ if(!match (parts[3], /(.*)(<p>.*[$]Date:.*)/, tail))
+ {
+ print my_name \
+ "no `<p>' followed by `$Date:' after `<div id=\"footer\">' found" \
+ > "/dev/stderr"
+ exit 1
+ }
+ printf "%s", output tail[1] \
+"\n" \
+"<div class=\"translators-credits\">\n" \
+"<!--TRANSLATORS: Use space (SPC) as msgstr if you don't want credits.-->\n" \
+"*GNUN-SLOT: TRANSLATOR'S CREDITS*</div>\n" \
+"<gnun>m4_include(`" generic_file "')</gnun> " tail[2]
+}
Index: make-prototype
===================================================================
RCS file: make-prototype
diff -N make-prototype
--- make-prototype 7 Jan 2010 14:43:04 -0000 1.11
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,184 +0,0 @@
-#!/usr/bin/guile \ -*-scheme-*-
--e main --debug -s
-!#
-;; make-prototype. Generated from make-prototype.in by configure.
-
-;; Copyright (C) 2007, 2008, 2009, 2010 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 of the
-;; License, 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. If not, see
-;; <http://www.gnu.org/licenses/>.
-
-(define version-message
- (string-append
- "make-prototype (GNUnited Nations) 0.4\n"
- "Copyright (C) 2010 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 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"
- "GNUnited Nations home page: <http://www.gnu.org/software/gnun/>\n"
- "General help using GNU software: <http://www.gnu.org/gethelp/>\n"))
-
-(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
- "^(.*)(<title>.*)(</div>.*<div id=\"footer\">.*)(<p>.*?[$]Date:.*)(<ul
class=\"translations-list\">.*</ul>)(.*)$")
-
-(define home-page-regexp
- "^(.*?)(<title>.*)(</div>.*<div id=\"footer\">.*)(<p>.*?[$]Date:.*)$")
-
-(define skip-tag
- "gnun")
-
-(define slot-translators-notes
- (string-append
- "\n"
- "<div style=\"font-size: small;\">\n"
- "<!--TRANSLATORS: Use space (SPC) as msgstr if you don't have notes.-->\n"
- "*GNUN-SLOT: TRANSLATOR'S NOTES*</div>\n"))
-
-(define slot-translators-credits
- (string-append
- "\n"
- "<div class=\"translators-credits\">\n"
- "<!--TRANSLATORS: Use space (SPC) as msgstr if you don't want credits.-->\n"
- "*GNUN-SLOT: TRANSLATOR'S CREDITS*</div>\n"))
-
-(define autogenerated-warning
- "This file is automatically generated by GNUnited Nations!")
-
-(define <skip-tag>
- (string-append "<" skip-tag ">"))
-
-(define </skip-tag>
- (string-append "</" skip-tag ">"))
-
-(define <autogenerated-warning>
- (string-append
- <skip-tag> </skip-tag> "<!-- " autogenerated-warning " -->" "\n"))
-
-
-(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)
- (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)
- <autogenerated-warning>
- (match:substring m 2)
- slot-translators-notes
- (match:substring m 3)
- slot-translators-credits
- "<" skip-tag ">m4_include(`" generic "')</"
skip-tag "> "
- (match:substring m 4)
- "<" skip-tag ">m4_include(`" translinks "')</"
skip-tag ">"
- (match:substring m 6)))))
- (with-output-to-file translinks
- (lambda ()
- (display (match:substring m 5))))))))
-
-(define (make-home input generic output)
- (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)
- <autogenerated-warning>
- (match:substring m 2)
- slot-translators-notes
- (match:substring m 3)
- slot-translators-credits
- "<" skip-tag ">m4_include(`" generic "')</"
skip-tag "> "
- (match:substring m 4)))))))))
Index: make-prototype.in
===================================================================
RCS file: make-prototype.in
diff -N make-prototype.in
--- make-prototype.in 30 Jan 2012 08:49:14 -0000 1.9
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,185 +0,0 @@
address@hidden@ \ -*-scheme-*-
--e main --debug -s
-!#
-;; @configure_input@
-
-;; Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 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 of the
-;; License, 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. If not, see
-;; <http://www.gnu.org/licenses/>.
-
-(define version-message
- (string-append
- "make-prototype (@PACKAGE_NAME@) @address@hidden"
- "Copyright (C) 2012 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 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"
- "@PACKAGE_NAME@ home page: <@PACKAGE_URL@>\n"
- "General help using GNU software: <http://www.gnu.org/gethelp/>\n"))
-
-(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
- "^(.*)(<title>.*)(</div>.*<div id=\"footer\">.*)(<p>.*?[$]Date:.*)(<ul
class=\"translations-list\">.*</ul>)(.*)$")
-
-(define home-page-regexp
- "^(.*?)(<title>.*)(</div>.*<div id=\"footer\">.*)(<p>.*?[$]Date:.*)$")
-
-(define skip-tag
- "gnun")
-
-(define slot-translators-notes
- (string-append
- "\n"
- "<div style=\"font-size: small;\">\n"
- "<!--TRANSLATORS: Use space (SPC) as msgstr if you don't have notes.-->\n"
- "*GNUN-SLOT: TRANSLATOR'S NOTES*</div>\n"))
-
-(define slot-translators-credits
- (string-append
- "\n"
- "<div class=\"translators-credits\">\n"
- "<!--TRANSLATORS: Use space (SPC) as msgstr if you don't want credits.-->\n"
- "*GNUN-SLOT: TRANSLATOR'S CREDITS*</div>\n"))
-
-(define autogenerated-warning
- "This file is automatically generated by GNUnited Nations!")
-
-(define <skip-tag>
- (string-append "<" skip-tag ">"))
-
-(define </skip-tag>
- (string-append "</" skip-tag ">"))
-
-(define <autogenerated-warning>
- (string-append
- <skip-tag> </skip-tag> "<!-- " autogenerated-warning " -->" "\n"))
-
-
-(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)
- (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)
- <autogenerated-warning>
- (match:substring m 2)
- slot-translators-notes
- (match:substring m 3)
- slot-translators-credits
- "<" skip-tag ">m4_include(`" generic "')</"
skip-tag "> "
- (match:substring m 4)
- "<" skip-tag ">m4_include(`" translinks "')</"
skip-tag ">"
- (match:substring m 6)))))
- (with-output-to-file translinks
- (lambda ()
- (display (match:substring m 5))))))))
-
-(define (make-home input generic output)
- (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)
- <autogenerated-warning>
- (match:substring m 2)
- slot-translators-notes
- (match:substring m 3)
- slot-translators-credits
- "<" skip-tag ">m4_include(`" generic "')</"
skip-tag "> "
- (match:substring m 4)))))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- trans-coord/gnun/server/gnun AUTHORS ChangeLog ...,
Pavel Kharitonov <=