summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-11-22 13:40:13 +0200
committerMarius <mariausol@gmail.com>2012-11-22 13:40:13 +0200
commit9cebcfa775796a7d6111a1354b0c754f3499ef4d (patch)
treed0bd0e986f60cc954de476b7283d65d85e462087
parent33b4746f54191db2459fc0f64390ff75836e84a7 (diff)
downloadcontext-9cebcfa775796a7d6111a1354b0c754f3499ef4d.tar.gz
beta 2012.11.22 11:29
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4149 -> 4146 bytes
-rw-r--r--tex/context/base/context-version.pngbin40722 -> 40631 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua80
-rw-r--r--tex/context/base/status-files.pdfbin24572 -> 24555 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin198628 -> 198690 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
10 files changed, 56 insertions, 34 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index cc16d60da..12f182399 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.11.21 17:53}
+\newcontextversion{2012.11.22 11:29}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 1bfc68380..85f21c864 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.11.21 17:53}
+\newcontextversion{2012.11.22 11:29}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 567137b85..e55cc07c2 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index c6f3eb0db..c38b8efd8 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 92fe8d69f..50320e65d 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.11.21 17:53}
+\edef\contextversion{2012.11.22 11:29}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index d8bb4fbe6..3f9b0f979 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.11.21 17:53}
+\edef\contextversion{2012.11.22 11:29}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index 19aa3b223..96f3a00ea 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -721,7 +721,11 @@ end
-- verbose numbers
-local verbose = { }
+-- verbose numbers
+
+local data = allocate()
+local verbose = { data = data }
+converters.verbose = verbose
-- verbose english
@@ -761,7 +765,7 @@ local words = {
[1000^4] = "trillion",
}
-function verbose.english(n)
+local function translate(n)
local w = words[n]
if w then
return w
@@ -780,6 +784,10 @@ function verbose.english(n)
elseif a > 0 then
t[#t+1] = words[a]
t[#t+1] = words[100]
+ -- don't say 'nine hundred zero'
+ if b == 0 then
+ return
+ end
end
if words[b] then
t[#t+1] = words[b]
@@ -810,22 +818,22 @@ function verbose.english(n)
return #t > 0 and concat(t," ") or tostring(n)
end
-verbose.en = verbose.english
-
--- print(verbose.english(11111111))
--- print(verbose.english(2221101))
--- print(verbose.english(1111))
--- print(verbose.english(1218))
--- print(verbose.english(1234))
--- print(verbose.english(12345))
--- print(verbose.english(12345678900000))
+data.english = {
+ words = words,
+ translate = translate,
+}
--- verbose spanish (unchecked)
+data.en = data.english
-local floor = math.floor
-local concat = table.concat
+-- print(translate(11111111))
+-- print(translate(2221101))
+-- print(translate(1111))
+-- print(translate(1218))
+-- print(translate(1234))
+-- print(translate(12345))
+-- print(translate(12345678900000))
-local verbose = { }
+-- verbose spanish (unchecked)
local words = {
[1] = "uno",
@@ -875,10 +883,11 @@ local words = {
[900] = "novecientos",
[1000] = "mil",
[1000^2] = "millón",
- [1000^3] = "millones",
+ [1000^3] = "mil millónes",
+ [1000^4] = "billón",
}
-function verbose.spanish(n)
+local function translate(n)
local w = words[n]
if w then
return w
@@ -890,23 +899,31 @@ function verbose.spanish(n)
t[#t+1] = w
return
end
+ -- a, b = hundreds, remainder
local a, b = floor(n/100), n % 100
+ -- one thousand
if a == 10 then
t[#t+1] = words[1]
t[#t+1] = words[1000]
+ -- x hundred (n.b. this will not give thirteen hundred because
+ -- compose_one(n) is only called after
+ -- `n = compose(two(n, 1000^1))`.
elseif a > 0 then
--- t[#t+1] = words[a]
- t[#t+1] = words[100]
+ t[#t+1] = words[a*100]
end
+ -- the remainder
if words[b] then
t[#t+1] = words[b]
else
+ -- a, b = tens, remainder
a, b = floor(b/10), n % 10
t[#t+1] = words[a*10]
-t[#t+1] = "y"
+ t[#t+1] = "y"
t[#t+1] = words[b]
end
end
+ -- compose_two handles x billion, ... x thousand. When 1000 or less is
+ -- left, compose_one takes over.
local function compose_two(n,m)
if n > (m-1) then
local a, b = floor(n/m), n % m
@@ -928,22 +945,27 @@ t[#t+1] = "y"
return #t > 0 and concat(t," ") or tostring(n)
end
-verbose.es = verbose.spanish
+data.spanish = {
+ words = words,
+ translate = translate,
+}
+
+data.es = data.spanish
--- print(verbose.spanish(31))
--- print(verbose.spanish(101))
--- print(verbose.spanish(199))
+-- print(translate(31))
+-- print(translate(101))
+-- print(translate(199))
-- verbose handler:
-function converters.verbose(n,language)
- local t = language and verbose[language]
- return t and t(n) or n
+function converters.verbose.translate(n,language)
+ local t = language and data[language]
+ return t and t.translate(n) or n
end
function commands.verbose(n,language)
- local t = language and verbose[language]
- context(t and t(n) or n)
+ local t = language and data[language]
+ context(t and t.translate(n) or n)
end
-- --
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 25b8f0bbd..8b4358fe7 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 23891ed39..3b93ab6eb 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 652d6fa92..367afa20a 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 11/21/12 17:53:22
+-- merge date : 11/22/12 11:29:41
do -- begin closure to overcome local limits and interference