[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, 7 Jul 2016 06:33:49 +0000 (UTC) |
CVSROOT: /sources/trans-coord
Module name: trans-coord
Changes by: Pavel Kharitonov <ineiev> 16/07/07 06:33:48
Modified files:
gnun/server/gnun: AUTHORS ChangeLog GNUmakefile Makefile.am NEWS
README TODO configure.ac
gnun/server/gnun/doc: gnun.texi
Added files:
gnun/server/gnun: sort-linguas sort.awk.in
gnun/server/gnun/tests: collate sort0 sort0-it sort1 sort1-it
Log message:
Add sorted lists.
* sort-linguas:
* sort.awk.in:
* tests/collate:
* tests/sort0:
* tests/sort0-it:
* tests/sort1:
* tests/sort1-it: New files.
* GNUmakefile (generate-html): Post-process output with sort.awk.
* configure.ac (--disable-sort): New option.
(SORT) (LOCALEDEF): New variables to detect respective programs.
(HAVE_SORT): New conditional.
* Makefile.am (check_environment): Add pkgdatadir.
[HAVE_SORT] (noinst_SCRIPTS): Add stamp-i18n.mk.
(tests_available): Add collate.
[HAVE_SORT] (tests_enabled): Add collate.
(pkglibexec_SCRIPTS): Add sort.awk.
(edit): Substitute SORT.
(sort.awk): New target.
[HAVE_SORT] (stamp-i18n.mk, install-data-hook)
(uninstall-data-hook, distclean-local): New targets.
(pkgdata_DATA): Add sort-linguas.
(EXTRA_DIST): Add sort-linguas, tests/collate, tests/sort0,
tests/sort0-it, tests/sort1, tests/sort1-it.
(CLEANFILES): Add sort.awk.
* doc/gnun.texi (Sorting Lists): New node.
(Disadvantages): Update.
(Webmaster Tips): Add Sorting Lists to the menu.
* AUTHORS:
* NEWS:
* README:
* TODO: Update.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/AUTHORS?cvsroot=trans-coord&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.447&r2=1.448
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.188&r2=1.189
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/Makefile.am?cvsroot=trans-coord&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.122&r2=1.123
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/README?cvsroot=trans-coord&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/TODO?cvsroot=trans-coord&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/configure.ac?cvsroot=trans-coord&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/sort-linguas?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/sort.awk.in?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/doc/gnun.texi?cvsroot=trans-coord&r1=1.105&r2=1.106
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/tests/collate?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/tests/sort0?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/tests/sort0-it?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/tests/sort1?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/tests/sort1-it?cvsroot=trans-coord&rev=1.1
Patches:
Index: AUTHORS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/AUTHORS,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- AUTHORS 13 Mar 2015 19:20:56 -0000 1.21
+++ AUTHORS 7 Jul 2016 06:33:48 -0000 1.22
@@ -1,6 +1,6 @@
Authors of GNUnited Nations.
-Copyright (C) 2015 Free Software Foundation, Inc.
+Copyright (C) 2016 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@@ -19,7 +19,7 @@
languages.txt (compiled from www.gnu.org pages),
gnun-add-fuzzy-diff, gnun-diff-po.in,
gnun-init-po.in, gnun-report.in, make-prototype.awk,
- priorities.mk, update-localized-urls.in,
+ priorities.mk, update-localized-urls.in, sort.awk.in, sort-linguas,
all files in test/.
Some changes in configure.ac, GNUmakefile, GNUmakefile.team,
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.447
retrieving revision 1.448
diff -u -b -r1.447 -r1.448
--- ChangeLog 29 Jun 2016 16:51:31 -0000 1.447
+++ ChangeLog 7 Jul 2016 06:33:48 -0000 1.448
@@ -1,3 +1,39 @@
+2016-07-07 Pavel Kharitonov <address@hidden>
+
+ Add sorted lists.
+
+ * sort-linguas:
+ * sort.awk.in:
+ * tests/collate:
+ * tests/sort0:
+ * tests/sort0-it:
+ * tests/sort1:
+ * tests/sort1-it: New files.
+ * GNUmakefile (generate-html): Post-process output with sort.awk.
+ * configure.ac (--disable-sort): New option.
+ (SORT) (LOCALEDEF): New variables to detect respective programs.
+ (HAVE_SORT): New conditional.
+ * Makefile.am (check_environment): Add pkgdatadir.
+ [HAVE_SORT] (noinst_SCRIPTS): Add stamp-i18n.mk.
+ (tests_available): Add collate.
+ [HAVE_SORT] (tests_enabled): Add collate.
+ (pkglibexec_SCRIPTS): Add sort.awk.
+ (edit): Substitute SORT.
+ (sort.awk): New target.
+ [HAVE_SORT] (stamp-i18n.mk, install-data-hook)
+ (uninstall-data-hook, distclean-local): New targets.
+ (pkgdata_DATA): Add sort-linguas.
+ (EXTRA_DIST): Add sort-linguas, tests/collate, tests/sort0,
+ tests/sort0-it, tests/sort1, tests/sort1-it.
+ (CLEANFILES): Add sort.awk.
+ * doc/gnun.texi (Sorting Lists): New node.
+ (Disadvantages): Update.
+ (Webmaster Tips): Add Sorting Lists to the menu.
+ * AUTHORS:
+ * NEWS:
+ * README:
+ * TODO: Update.
+
2016-06-29 Pavel Kharitonov <address@hidden>
Remove 'gnun-clear-previous'.
Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -b -r1.188 -r1.189
--- GNUmakefile 29 Jun 2016 15:54:55 -0000 1.188
+++ GNUmakefile 7 Jul 2016 06:33:48 -0000 1.189
@@ -499,7 +499,9 @@
define generate-html
$(PO4A_TRANSLATE) $(PO4A-XHTMLFLAGS) $(PO4A-TRANSLATEFLAGS) \
--master $$< --po $(2) --localized $(3); \
- $(call substitute-localized-includes,$(1)) $(3)
+ $(call substitute-localized-includes,$(1)) $(3); \
+ $(AWK) -f $(pkglibexecdir)/sort.awk -v language=$(1) < $(3) > $(3).tmp; \
+ mv $(3).tmp $(3)
endef
# Eliminate more than 1 subsequent empty lines before comments in file $(1);
Index: Makefile.am
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/Makefile.am,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- Makefile.am 29 Jun 2016 16:51:31 -0000 1.44
+++ Makefile.am 7 Jul 2016 06:33:48 -0000 1.45
@@ -25,6 +25,7 @@
tests_enabled =
check_environment = bindir="$(bindir)" \
pkglibexecdir="$(pkglibexecdir)" \
+ pkgdatadir="$(pkgdatadir)" \
srcdir="$(srcdir)/tests" \
AWK="$(AWK)" \
MSGATTRIB="$(MSGATTRIB)" \
@@ -51,6 +52,9 @@
endif
noinst_SCRIPTS = stamp-config.mk
+if HAVE_SORT
+noinst_SCRIPTS += stamp-i18n.mk
+endif
pkglibexec_SCRIPTS = copy-msgid mailfail update-localized-urls \
validate-html-notify
@@ -77,6 +81,11 @@
tests_enabled += diff-po
endif
endif
+tests_available += collate
+if HAVE_SORT
+tests_enabled += collate
+endif
+pkglibexec_SCRIPTS += sort.awk
tests_available += make-prototype
tests_enabled += make-prototype
@@ -128,12 +137,13 @@
-e 's|@address@hidden|$(MSGFMT)|g' \
-e 's|@address@hidden|$(MSGMERGE)|g' \
-e 's|@address@hidden|$(SED)|g' \
+ -e 's|@address@hidden|$(SORT)|g' \
-e 's|@address@hidden|$(XMLLINT)|g' \
-e 's|@address@hidden|$(WDIFF)|g'
add-fuzzy-diff copy-msgid diff-po.awk gnun-add-fuzzy-diff \
gnun-diff-po gnun-init-po gnun-merge-preconverted gnun-report \
-gnun-validate-html mailfail update-localized-urls \
+gnun-validate-html mailfail sort.awk update-localized-urls \
validate-html-notify: Makefile
$(AM_V_at)rm -f $@ address@hidden
$(AM_V_GEN)$(edit) '$(srcdir)/address@hidden' >address@hidden
@@ -144,6 +154,26 @@
$(AM_V_GEN)$(edit) config.mk >config.mk.tmp
$(AM_V_at)mv config.mk.tmp config.mk
$(AM_V_at)touch $@
+if HAVE_SORT
+stamp-i18n.mk:
+ $(AM_V_GEN)mkdir i18n; \
+ $(SED) '/#/d' "$(srcdir)/sort-linguas" | while read line; do \
+ lang=`echo $$line | sed "s, .*,,"`; loc=`echo $$line | sed "s,.* ,,"`; \
+ echo Generating locale for $$lang...; \
+ $(LOCALEDEF) -c -f UTF-8 -i $$loc ./i18n/$$loc || true; \
+ done
+ $(AM_V_at)touch $@
+
+install-data-hook:
+ $(AM_V_at)$(RM) -r $(DESTDIR)/$(pkgdatadir)/i18n
+ $(AM_V_at)cp -R i18n $(DESTDIR)/$(pkgdatadir)
+
+uninstall-hook:
+ $(AM_V_at)$(RM) -r $(DESTDIR)/$(pkgdatadir)/i18n
+
+distclean-local:
+ $(AM_V_at)$(RM) -r i18n
+endif
add-fuzzy-diff: $(srcdir)/add-fuzzy-diff.in
copy-msgid: $(srcdir)/copy-msgid.in
@@ -156,6 +186,10 @@
diff-po.awk: $(srcdir)/diff-po.awk.in
mailfail: $(srcdir)/mailfail.in
update-localized-urls: $(srcdir)/update-localized-urls.in
+sort.awk: $(srcdir)/sort.awk.in
+if !HAVE_SORT
+ $(AM_V_GEN)echo '{ print }' > $@
+endif
validate-html-notify: $(srcdir)/validate-html-notify.in
exampledir = $(docdir)/examples
@@ -165,7 +199,7 @@
initial-translations-list.html \
priorities.mk \
translist-head.html translist-tail.html
-pkgdata_DATA = config.mk
+pkgdata_DATA = config.mk sort-linguas
dist_sysconf_DATA = gnun.conf
dist_pkgdata_DATA = GNUmakefile
@@ -173,7 +207,7 @@
expand-ssi.awk.in gnun-add-fuzzy-diff.in gnun-diff-po.in \
gnun-init-po.in gnun-merge-preconverted.in \
gnun-report.in gnun-validate-html.in \
- mailfail.in update-localized-urls.in \
+ mailfail.in sort.awk.in sort-linguas update-localized-urls.in \
validate-html-notify.in \
tests/add-fuzzy-diff tests/fuzzy-diff-0.po tests/fuzzy-diff-1.po \
tests/convert tests/conv.html tests/conv.pr.html \
@@ -185,6 +219,8 @@
tests/init-po tests/compendium.bg.po tests/init.bg.po \
tests/init-no-diffs.bg.po tests/init.pot \
tests/make-prototype tests/proto.html tests/proto.proto \
+ tests/collate tests/sort0 tests/sort0-it tests/sort1 \
+ tests/sort1-it \
tests/validate/1 tests/validate/1.html \
tests/validate/2 tests/validate/html5.html \
tests/validate/3 tests/validate/3.0.html tests/validate/3.1.html \
@@ -195,6 +231,9 @@
CLEANFILES = add-fuzzy-diff copy-msgid diff-po.awk gnun-add-fuzzy-diff \
gnun-diff-po gnun-init-po gnun-merge-preconverted gnun-report \
- gnun-validate-html mailfail \
+ gnun-validate-html mailfail sort.awk \
update-localized-urls validate-html-notify \
stamp-config.mk
+if HAVE_SORT
+CLEANFILES += stamp-i18n.mk
+endif
Index: NEWS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/NEWS,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -b -r1.122 -r1.123
--- NEWS 29 Jun 2016 16:51:31 -0000 1.122
+++ NEWS 7 Jul 2016 06:33:48 -0000 1.123
@@ -2,6 +2,9 @@
* Changes in GNUnited Nations 0.11 (????-??-??)
+** New experimental feature, sorting lists. See
+ https://www.gnu.org/s/trans-coord/manual/gnun/html_node/Sorting-Lists.html
+
** www.gnu.org URLs in many places are replaced with the HTTPS version.
** In `configure', a workaround for less precise versions
Index: README
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/README,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- README 29 Jun 2016 15:54:56 -0000 1.17
+++ README 7 Jul 2016 06:33:48 -0000 1.18
@@ -64,6 +64,10 @@
or
https://www.gnu.org/software/sharutils
+* sort and deflocale (needed for sorting)
+ https://www.gnu.org/software/coreutils
+ https://www.gnu.org/software/libc
+
Bugs
----
Please send bug reports and suggestions to <address@hidden>.
Index: TODO
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/TODO,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- TODO 6 Jun 2014 05:08:38 -0000 1.42
+++ TODO 7 Jul 2016 06:33:48 -0000 1.43
@@ -9,10 +9,6 @@
* Present bugs
-** Items are not in alphabetical order in articles like
- philosophy/fs-translations.LANG.html or
- licenses/translations.LANG.html.
-
** An extensive testsuite is missing.
The testsuite should be further developed.
Index: configure.ac
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/configure.ac,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- configure.ac 29 Jun 2016 16:51:31 -0000 1.53
+++ configure.ac 7 Jul 2016 06:33:48 -0000 1.54
@@ -50,6 +50,13 @@
AC_MSG_RESULT([$enable_multiviews])
AC_SUBST([MULTIVIEWS], [$enable_multiviews])
+AC_MSG_CHECKING([whether to enable sorting])
+AC_ARG_ENABLE([sort],
+ [AS_HELP_STRING([--disable-sort],
+ [Disable sorting lists.])]
+)
+AS_CASE(["x$enable_sort"],[xno],,[enable_sort=yes])
+
AC_MSG_CHECKING([whether `date' supports the `-d' option])
timestamp=`date -d "2001-09-09 01:47+0000" +%s 2> /dev/null || echo FAIL`
decent_date=no
@@ -337,6 +344,23 @@
])])
rm -f conftest.html
+AC_ARG_VAR([SORT], [the `sort' program])
+AC_PATH_PROG([SORT], [sort], [no])
+have_sort=yes
+AS_CASE([$SORT], [no], [have_sort=no])
+
+AC_ARG_VAR([LOCALEDEF], [the `localedef' program])
+AC_PATH_PROG([LOCALEDEF], [localedef], [no])
+have_localedef=yes
+AS_CASE([$LOCALEDEF], [no], [have_localedef=no])
+AC_SUBST([LOCALEDEF], [$LOCALEDEF])
+
+have_sorted_lists=no
+AS_CASE([$have_localedef$have_sort$enable_sort], [yesyesyes],
+[have_sorted_lists=yes])
+
+AM_CONDITIONAL([HAVE_SORT], [test "$have_sorted_lists" = yes])
+
# Our validation scripts depend on awk and xmllint.
AS_CASE([$have_xmllint], [yes],
[have_validation=$decent_awk], [have_validation=no])
@@ -364,6 +388,7 @@
echo "NOTIFY/ANNOUNCE support... $have_mail"
echo "VCS support... $have_vcs $cvs $svn $bzr"
echo "Use Multiviews naming conventions... $enable_multiviews"
+echo "Sorting support $have_sorted_lists"
echo
echo \
"Type \"make\" to build the scripts, \"make install\" to install them
Index: doc/gnun.texi
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/doc/gnun.texi,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -b -r1.105 -r1.106
--- doc/gnun.texi 29 Jun 2016 16:51:31 -0000 1.105
+++ doc/gnun.texi 7 Jul 2016 06:33:48 -0000 1.106
@@ -346,10 +346,11 @@
are processed.
@item
-In some rare cases (most notably, for alphabetically sorted lists)
+In very rare cases
the structure of the translation should diverge from the structure
of the original document. So far, our system has developed no means
-of taking such issues into account.
+of taking such issues into account (apart from alphabetically
+sorted lists).
@end itemize
@node Usage
@@ -1909,6 +1910,8 @@
to be translated.
* Splitting Long Passages:: How to avoid too long strings
in PO files.
+* Sorting Lists:: Marking up lists for sorting
+ in translations.
@end menu
@node Modifying Templates
@@ -2026,6 +2029,73 @@
of parts of the sentence, and the translator has no control over
the sequence of the strings in the translation.
address@hidden Sorting Lists
address@hidden Sorting Lists
address@hidden sorting translated lists
+
+Sometimes a list is sorted alphabetically to make search easier
+for the visitors, and this property should be preserved in
+translations. GNUN has specific marks for such lists.
+
address@hidden GNUN-SORT-START
address@hidden
+<!-- GNUN-SORT-START -->
address@hidden example
+
+This HTML comment marks the begin of the list.
+
address@hidden GNUN-SORT-STOP
address@hidden
+<!-- GNUN-SORT-STOP -->
address@hidden example
+
+This comment marks the end of the list.
+
address@hidden GNUN-SORT-NEXT-ITEM
address@hidden
+<!-- GNUN-SORT-NEXT-ITEM -->
address@hidden example
+
+This mark separates list items.
+
+The next two marks are optional, they delimit the key to sort items.
+
address@hidden GNUN-SORT-BEGIN-KEY
address@hidden
+<!-- GNUN-SORT-BEGIN-KEY -->
address@hidden example
+
address@hidden GNUN-SORT-END-KEY
address@hidden
+<!-- GNUN-SORT-END-KEY -->
address@hidden example
+
+When extracting the keys, all HTML tags are removed, leading and
+trailing whitespace is trimmed.
+
+The translators can modify the sorting order using HTML comments
+if needed. For example, let the English text say
+
address@hidden
+<!-- GNUN-SORT-BEGIN-KEY -->
+<h3>Afrikaans</h3>
+<!-- GNUN-SORT-END-KEY -->
address@hidden example
+
+In the PO file, this transforms to an @code{msgstr} like
+
address@hidden
+Afrikaans
address@hidden example
+
+The translator inserts a comment in the translation:
+
address@hidden
+<!-- boer --> afrikaans
address@hidden example
+
+Now the item sorts like @samp{boer afrikaans}.
+
@node Internals
@chapter Unexciting Information for GNUN's Operation
Index: sort-linguas
===================================================================
RCS file: sort-linguas
diff -N sort-linguas
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sort-linguas 7 Jul 2016 06:33:48 -0000 1.1
@@ -0,0 +1,72 @@
+# Copyright (C) 2016 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 <https://www.gnu.org/licenses/>.
+#
+# Locales for sorting lists.
+af af_ZA
+ar ar_IQ
+az az_AZ
+bg bg_BG
+bn bn_BD
+bs bs_BA
+ca ca_ES
+cs cs_CZ
+da da_DK
+de de_DE
+el el_GR
+# en is omitted since it's the source language, lists are sorted manually.
+eo eo
+es es_ES
+et et_EE
+fa fa_IR
+fi fi_FI
+fr fr_FR
+gl gl_ES
+he he_IL
+hi hi_IN
+hr hr_HR
+hu hu_HU
+id id_ID
+it it_IT
+ja ja_JP
+kn kn_IN
+ko ko_KR
+lt lt_LT
+lv lv_LV
+mk mk_MK
+ml ml_IN
+nb nb_NO
+nl nl_NL
+nn nn_NO
+pl pl_PL
+pt pt_PT
+pt-br pt_BR
+ro ro_RO
+ru ru_RU
+sk sk_SK
+sl sl_SI
+sq sq_AL
+sr sr_RS
+sv sv_SE
+ta ta_IN
+th th_TH
+tl tl_PH
+tr tr_TR
+uk uk_UA
+uz uz_UZ
+vi vi_VN
+zh-cn zh_CN
+zh-tw zh_TW
Index: sort.awk.in
===================================================================
RCS file: sort.awk.in
diff -N sort.awk.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sort.awk.in 7 Jul 2016 06:33:48 -0000 1.1
@@ -0,0 +1,123 @@
+# Copyright (C) 2016 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 <https://www.gnu.org/licenses/>.
+
+# Sort specifically marked lists according to given language.
+
+function assign_locale(language,
+ n, lang)
+{
+ n = length(language)
+ if (!n)
+ return ""
+ lang = ""
+ while((getline < "@datadir@/sort-linguas") > 0)
+ {
+ if (language" " != substr($0, 1, n + 1))
+ continue
+ lang = substr($0, n + 2) ".UTF-8"
+ break
+ }
+ close("@datadir@/sort-linguas")
+ return lang
+}
+
+function sort_list(list,
+ items, keys, n, i, tmp_file, cmd, keyed_items, sorted_list)
+{
+ n = split(list, items,
+ /<!--[ \t\r\n]+GNUN-SORT-NEXT-ITEM[ \t\r\n]+-->/)
+ cmd = "@MKTEMP@ gnun-sort.XXXXXXXXXX"
+ cmd | getline tmp_file
+ close(cmd)
+ for(i = 1; i <= n; i++)
+ {
+ # Extract key.
+ keys[i] = items[i]
+ sub(/.*<!--[ \t\r\n]+GNUN-SORT-BEGIN-KEY[ \t\r\n]+-->/, "",
+ keys[i])
+ sub(/<!--[ \t\r\n]+GNUN-SORT-END-KEY[ \t\r\n]+-->.*/, "",
+ keys[i])
+ # Remove HTML tags.
+ gsub(/<[^!][^>]*>/, "", keys[i])
+ gsub(/<\/[^>]*[^-]>/, "", keys[i])
+ # Remove HTML comment delimiters.
+ gsub(/<!--/, "", keys[i])
+ gsub(/-->/, "", keys[i])
+ # Trim leading and trailing whitespace.
+ gsub(/^[\t\r\n ]*/, "", keys[i])
+ gsub(/[\t\r\n ]*$/, "", keys[i])
+ # Normalize whitespace.
+ gsub(/[\t\r\n ]+/, " ", keys[i])
+ if (keys[i] in keyed_items)
+ keyed_items[keys[i]] = keyed_items[keys[i]] "\n"
+ keyed_items[keys[i]] = keyed_items[keys[i]] items[i]
+ print keys[i] >> tmp_file
+ }
+ close(tmp_file)
+ cmd = " LC_CTYPE=" language " @SORT@ " tmp_file
+ cmd = "LC_ALL=" language " LC_COLLATE=" language cmd
+ cmd = "LANG= address@hidden@/i18n " cmd
+ i = 0
+ sorted_list = ""
+ while((cmd | getline) > 0)
+ {
+ if (i)
+ sorted_list = sorted_list "<!-- GNUN-SORT-NEXT-ITEM -->"
+ sorted_list = sorted_list keyed_items[$0]
+ i++
+ }
+ printf("%s", sorted_list)
+
+ close(cmd)
+ system("rm -f " tmp_file)
+}
+
+BEGIN {
+ language = assign_locale(language)
+# Fallback for awks who don't support RT.
+ RT = "\n"
+}
+
+/<!--[ \t\r\n]+GNUN-SORT-START[ \t\r\n]+-->/ {
+ line = $0
+ idx = match(line, /<!--[ \t\r\n]+GNUN-SORT-START[ \t\r\n]+-->/)
+ idx += index(substr(line, idx), ">")
+ printf substr(line, 1, idx - 1)
+ in_list = 1;
+ list = substr(line, idx) RT
+ next
+}
+
+!in_list { printf("%s", $0 RT); next }
+
+/<!--[ \t\r\n]+GNUN-SORT-STOP[ \t\r\n]+-->/ {
+ line = $0
+ idx = match(line, /<!--[ \t\r\n]+GNUN-SORT-STOP[ \t\r\n]+-->/)
+ if (idx > 1)
+ {
+ list = list substr(line, 1, idx - 1)
+ line = substr(line, idx)
+ }
+ if (language)
+ sort_list(list)
+ else
+ printf("%s", list)
+ print line
+ in_list = 0
+ next
+}
+{ list = list $0 RT }
Index: tests/collate
===================================================================
RCS file: tests/collate
diff -N tests/collate
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/collate 7 Jul 2016 06:33:48 -0000 1.1
@@ -0,0 +1,38 @@
+#! /bin/sh
+# Copyright (C) 2016 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/>.
+#
+# Test sorting.
+
+"$AWK" -f "${pkglibexecdir}/sort.awk" -v language=lt \
+ "${srcdir}/sort0" > sort0.out || exit 1
+diff "${srcdir}/sort0" sort0.out || exit 1
+rm -f sort0.out
+"$AWK" -f "${pkglibexecdir}/sort.awk" -v language=it \
+ "${srcdir}/sort0" > sort0-it.out || exit 1
+diff "${srcdir}/sort0-it" sort0-it.out || exit 1
+rm -f sort0-it.out
+"$AWK" -f "${pkglibexecdir}/sort.awk" -v language=lt \
+ "${srcdir}/sort1" > sort1.out || exit 1
+diff "${srcdir}/sort1" sort1.out || exit 1
+rm -f sort1.out
+"$AWK" -f "${pkglibexecdir}/sort.awk" -v language=it \
+ "${srcdir}/sort1" > sort1-it.out || exit 1
+diff "${srcdir}/sort1-it" sort1-it.out || exit 1
+rm -f sort1-it.out
+
+exit 0
Index: tests/sort0
===================================================================
RCS file: tests/sort0
diff -N tests/sort0
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sort0 7 Jul 2016 06:33:48 -0000 1.1
@@ -0,0 +1,23 @@
+Test of sorting.
+
+Copyright (C) 2016 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/>.
+
+<!-- GNUN-SORT-START -->
+yes
+<!-- GNUN-SORT-NEXT-ITEM -->
+no
+<!-- GNUN-SORT-STOP -->
Index: tests/sort0-it
===================================================================
RCS file: tests/sort0-it
diff -N tests/sort0-it
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sort0-it 7 Jul 2016 06:33:48 -0000 1.1
@@ -0,0 +1,23 @@
+Test of sorting.
+
+Copyright (C) 2016 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/>.
+
+<!-- GNUN-SORT-START -->
+no
+<!-- GNUN-SORT-NEXT-ITEM -->
+yes
+<!-- GNUN-SORT-STOP -->
Index: tests/sort1
===================================================================
RCS file: tests/sort1
diff -N tests/sort1
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sort1 7 Jul 2016 06:33:48 -0000 1.1
@@ -0,0 +1,31 @@
+Another test of sorting.
+
+Copyright (C) 2016 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/>.
+
+before<!-- GNUN-SORT-START -->this item
+started the list
+<!-- GNUN-SORT-BEGIN-KEY -->
+<h3 id="no">yes</h3>
+<!-- GNUN-SORT-END-KEY -->
+more data
+<!-- GNUN-SORT-NEXT-ITEM -->
+(was) next item
+<!-- GNUN-SORT-BEGIN-KEY -->
+<!-- no --> ah
+<!-- GNUN-SORT-END-KEY -->
+still more
+data<!-- GNUN-SORT-STOP -->after
Index: tests/sort1-it
===================================================================
RCS file: tests/sort1-it
diff -N tests/sort1-it
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sort1-it 7 Jul 2016 06:33:48 -0000 1.1
@@ -0,0 +1,31 @@
+Another test of sorting.
+
+Copyright (C) 2016 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/>.
+
+before<!-- GNUN-SORT-START -->
+(was) next item
+<!-- GNUN-SORT-BEGIN-KEY -->
+<!-- no --> ah
+<!-- GNUN-SORT-END-KEY -->
+still more
+data<!-- GNUN-SORT-NEXT-ITEM -->this item
+started the list
+<!-- GNUN-SORT-BEGIN-KEY -->
+<h3 id="no">yes</h3>
+<!-- GNUN-SORT-END-KEY -->
+more data
+<!-- GNUN-SORT-STOP -->after
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- trans-coord/gnun/server/gnun AUTHORS ChangeLog ...,
Pavel Kharitonov <=