summaryrefslogtreecommitdiff
path: root/support/lualibs/lua-uca
diff options
context:
space:
mode:
Diffstat (limited to 'support/lualibs/lua-uca')
-rw-r--r--support/lualibs/lua-uca/CHANGELOG.md14
-rw-r--r--support/lualibs/lua-uca/LICENSE12
-rw-r--r--support/lualibs/lua-uca/README.md8
-rw-r--r--support/lualibs/lua-uca/lua-uca-doc.pdfbin72038 -> 72205 bytes
-rw-r--r--support/lualibs/lua-uca/lua-uca-doc.tex2
-rw-r--r--support/lualibs/lua-uca/lua-uca/lua-uca-collator.lua18
6 files changed, 46 insertions, 8 deletions
diff --git a/support/lualibs/lua-uca/CHANGELOG.md b/support/lualibs/lua-uca/CHANGELOG.md
index 2d5816ebfc..9ba52855a1 100644
--- a/support/lualibs/lua-uca/CHANGELOG.md
+++ b/support/lualibs/lua-uca/CHANGELOG.md
@@ -1,7 +1,17 @@
# Changelog
+2021-11-10
+
+ - version `0.1b` released.
+
+2021-11-09
+
+ - cache string to codepoint conversion.
+ - use NFC normalization with LuaTeX.
+
2021-09-16
+ - version `0.1a` released.
- added sorting rules for all languages contained in CLDR collation files.
2020-06-09
@@ -11,5 +21,5 @@
2020-03-24
- - version `0.1` released
- - initial version for CTAN
+ - version `0.1` released.
+ - initial version for CTAN.
diff --git a/support/lualibs/lua-uca/LICENSE b/support/lualibs/lua-uca/LICENSE
index c085812b5a..c71dcd0d8c 100644
--- a/support/lualibs/lua-uca/LICENSE
+++ b/support/lualibs/lua-uca/LICENSE
@@ -1,8 +1,14 @@
-Copyright 2020 Michal Hoftich
+Copyright 2021 Michal Hoftich
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
diff --git a/support/lualibs/lua-uca/README.md b/support/lualibs/lua-uca/README.md
index 37343a83af..6ef94a4995 100644
--- a/support/lualibs/lua-uca/README.md
+++ b/support/lualibs/lua-uca/README.md
@@ -121,3 +121,11 @@ will be sorted at the very end.
- Algorithm for setting implicit sort weights of characters that are not explicitly listed in DUCET.
- Special handling of CJK scripts.
+
+\iffalse
+# Copyright
+
+Michal Hoftich, 2021. See LICENSE file for more details.
+
+
+\fi
diff --git a/support/lualibs/lua-uca/lua-uca-doc.pdf b/support/lualibs/lua-uca/lua-uca-doc.pdf
index 049332eda1..4b32fd55d3 100644
--- a/support/lualibs/lua-uca/lua-uca-doc.pdf
+++ b/support/lualibs/lua-uca/lua-uca-doc.pdf
Binary files differ
diff --git a/support/lualibs/lua-uca/lua-uca-doc.tex b/support/lualibs/lua-uca/lua-uca-doc.tex
index 2d25f51992..64b34335c2 100644
--- a/support/lualibs/lua-uca/lua-uca-doc.tex
+++ b/support/lualibs/lua-uca/lua-uca-doc.tex
@@ -31,7 +31,6 @@
\section{Available Languages}
-\begin{raggedright}
The \texttt{lua-uca-languages} library provides the following langauges:
\bgroup\ttfamily
\begin{luacode*}
@@ -46,7 +45,6 @@ table.sort(l)
tex.print(table.concat(l, ", "))
\end{luacode*}
\egroup
-\end{raggedright}
If you want to requrest language not listed in this listing, or if you had
created support code for one, please contact the package author by mail or using
diff --git a/support/lualibs/lua-uca/lua-uca/lua-uca-collator.lua b/support/lualibs/lua-uca/lua-uca/lua-uca-collator.lua
index c009bc9868..258b2a12e4 100644
--- a/support/lualibs/lua-uca/lua-uca/lua-uca-collator.lua
+++ b/support/lualibs/lua-uca/lua-uca/lua-uca-collator.lua
@@ -2,6 +2,11 @@
local math = require "math"
local tailoring_lib = require "lua-uca.lua-uca-tailoring"
local reordering_table = require "lua-uca.lua-uca-reordering-table"
+local uni_normalize
+-- in LuaTeX, load the lua-uni-normalize library
+if kpse then
+ uni_normalize = require "lua-uni-normalize"
+end
local collator = {}
collator.__index = collator
@@ -213,9 +218,20 @@ function collator:compare(a, b)
return #a < #b
end
+local codepoints_cache = {}
+
function collator:string_to_codepoints(a)
+ if codepoints_cache[a] then return codepoints_cache[a] end
+ -- try unicode normalization, if it is available
+ -- it uses libraries available in LuaTeX, so it doesn't work with
+ -- stock Lua
+ local normalized = a
+ if uni_normalize then
+ normalized = uni_normalize.NFC(a)
+ end
local codepoints = {}
- for _, code in utf8.codes(a) do codepoints[#codepoints+1] = code end
+ for _, code in utf8.codes(normalized) do codepoints[#codepoints+1] = code end
+ codepoints_cache[a] = codepoints
return codepoints
end