summaryrefslogtreecommitdiff
path: root/tex/context/base/core-con.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-01-05 19:27:17 +0100
committerHans Hagen <pragma@wxs.nl>2012-01-05 19:27:17 +0100
commit94124bc6ebef1359c1994f9ec64ac5161d2db276 (patch)
tree7194dbd5b321beba4d4addd426ecd97d304390db /tex/context/base/core-con.lua
parent9fb6251be7393901502aa2039dfdc7057a2e5aa7 (diff)
downloadcontext-94124bc6ebef1359c1994f9ec64ac5161d2db276.tar.gz
beta 2011.11.02 20:10
Diffstat (limited to 'tex/context/base/core-con.lua')
-rw-r--r--tex/context/base/core-con.lua30
1 files changed, 25 insertions, 5 deletions
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index 4ddc9e0b6..4bd51770a 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -804,8 +804,9 @@ end
-- a prelude to a function that we can use at the lua end
-- day:ord month:mmem
+-- j and jj obsolete
-function commands.currentdate(str,currentlanguage) -- j and jj obsolete
+function commands.currentdate(str,currentlanguage) -- second argument false : no label
local list = utilities.parsers.settings_to_array(str)
local year, month, day = tex.year, tex.month, tex.day
local auto = true
@@ -831,7 +832,9 @@ function commands.currentdate(str,currentlanguage) -- j and jj obsolete
elseif tag == "Y" then
context(year)
elseif tag == v_month or tag == "m" then
- if mnemonic then
+ if currentlanguage == false then
+ context(months[month] or "unknown")
+ elseif mnemonic then
commands.monthmnem(month)
else
commands.monthname(month)
@@ -841,7 +844,11 @@ function commands.currentdate(str,currentlanguage) -- j and jj obsolete
elseif tag == "M" then
context(month)
elseif tag == v_day or tag == "d" then
- context.convertnumber(v_day,day)
+ if currentlanguage == false then
+ context(days[day] or "unknown")
+ else
+ context.convertnumber(v_day,day)
+ end
whatordinal = day
elseif tag == "dd" then
context("%02i",day)
@@ -850,7 +857,12 @@ function commands.currentdate(str,currentlanguage) -- j and jj obsolete
context(day)
whatordinal = day
elseif tag == v_weekday or tag == "w" then
- commands.dayname(weekday(day,month,year))
+ local wd = weekday(day,month,year)
+ if currentlanguage == false then
+ context(days[wd] or "unknown")
+ else
+ commands.dayname(wd)
+ end
elseif tag == "W" then
context(weekday(day,month,year))
elseif tag == v_referral then
@@ -863,7 +875,15 @@ function commands.currentdate(str,currentlanguage) -- j and jj obsolete
auto = true
end
if ordinal and whatordinal then
- context("%s",converters.ordinal(whatordinal,currentlanguage))
+ if currentlanguage == false then
+ -- ignore
+ else
+ context("%s",converters.ordinal(whatordinal,currentlanguage))
+ end
end
end
end
+
+function commands.rawdate(str)
+ commands.currentdate(str,false)
+end