diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-02-20 15:15:08 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-02-20 15:15:08 +0100 |
commit | 93dce457ab8769ef45a56b2e0f7ad447d7a47a83 (patch) | |
tree | 2374ca50eceb2aab1a5d0af0ba26dc129eb19ab6 /tex/context/base/mkiv/core-con.lua | |
parent | b13dd166ce8563c60c10affc97ab28940d6a7776 (diff) | |
download | context-93dce457ab8769ef45a56b2e0f7ad447d7a47a83.tar.gz |
2016-02-20 14:58:00
Diffstat (limited to 'tex/context/base/mkiv/core-con.lua')
-rw-r--r-- | tex/context/base/mkiv/core-con.lua | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/tex/context/base/mkiv/core-con.lua b/tex/context/base/mkiv/core-con.lua index 416e7f630..53f9734dc 100644 --- a/tex/context/base/mkiv/core-con.lua +++ b/tex/context/base/mkiv/core-con.lua @@ -17,7 +17,7 @@ slower but look nicer this way.</p> --ldx]]-- local floor, date, time, concat = math.floor, os.date, os.time, table.concat -local lower, rep, match, gsub = string.lower, string.rep, string.match, string.gsub +local lower, upper, rep, match, gsub = string.lower, string.upper, string.rep, string.match, string.gsub local utfchar, utfbyte = utf.char, utf.byte local tonumber, tostring = tonumber, tostring local P, C, Cs, lpegmatch = lpeg.P, lpeg.C, lpeg.Cs, lpeg.match @@ -1132,6 +1132,9 @@ local v_weekday = variables.weekday local v_referral = variables.referral local v_space = variables.space +local v_MONTH = upper(v_month) +local v_WEEKDAY = upper(v_weekday) + local convert = converters.convert local days = { -- not variables.sunday @@ -1205,6 +1208,16 @@ implement { -- day:ord month:mmem -- j and jj obsolete +local spaced = { + [v_year] = true, + [v_month] = true, + [v_MONTH] = true, + [v_day] = true, + [v_weekday] = true, + [v_WEEKDAY] = true, + [v_day] = true, +} + local function currentdate(str,currentlanguage) -- second argument false : no label local list = utilities.parsers.settings_to_array(str) local splitlabel = languages.labels.split or string.itself -- we need to get the loading order right @@ -1229,16 +1242,14 @@ local function currentdate(str,currentlanguage) -- second argument false : no la elseif plus == "mnem" then mnemonic = true end - if not auto and (tag == v_year or tag == v_month or tag == v_day or tag == v_weekday) then + if not auto and spaced[tag] then context.space() end auto = false - if tag == v_year or tag == "y" then + if tag == v_year or tag == "y" or tag == "Y" then context(year) - elseif tag == "yy" then + elseif tag == "yy" or tag == "YY" then context("%02i",year % 100) - elseif tag == "Y" then - context(year) elseif tag == v_month or tag == "m" then if currentlanguage == false then context(months[month] or "unknown") @@ -1247,6 +1258,14 @@ local function currentdate(str,currentlanguage) -- second argument false : no la else context.labeltext(monthname(month)) end + elseif tag == v_MONTH then + if currentlanguage == false then + context.WORD(months[month] or "unknown") + elseif mnemonic then + context.LABELTEXT(monthmnem(month)) + else + context.LABELTEXT(monthname(month)) + end elseif tag == "mm" then context("%02i",month) elseif tag == "M" then @@ -1271,6 +1290,13 @@ local function currentdate(str,currentlanguage) -- second argument false : no la else context.labeltext(days[wd] or "unknown") end + elseif tag == v_WEEKDAY then + local wd = weekday(day,month,year) + if currentlanguage == false then + context.WORD(days[wd] or "unknown") + else + context.LABELTEXT(days[wd] or "unknown") + end elseif tag == "W" then context(weekday(day,month,year)) elseif tag == v_referral then |