diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-10-10 15:29:49 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-10-10 15:29:49 +0200 |
commit | 64f50a1d7fe79d365b350c1bae688b9bf1b44d34 (patch) | |
tree | da3871bb93562ec8b9d125b71ad08020881dca48 /tex/context/base/mkiv/cldf-ini.lua | |
parent | 4855f5a841edc1db318818c89f30d12227f4740f (diff) | |
download | context-64f50a1d7fe79d365b350c1bae688b9bf1b44d34.tar.gz |
2019-10-10 14:28:00
Diffstat (limited to 'tex/context/base/mkiv/cldf-ini.lua')
-rw-r--r-- | tex/context/base/mkiv/cldf-ini.lua | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index 026d78c0d..e22de5a5b 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -749,6 +749,12 @@ local s_cldl_argument_e = "}" local t_cldl_luafunction = newtoken("luafunctioncall",0) local lua_expandable_call_token_code = token.command_id and token.command_id("lua_expandable_call") +local sortedhashindeed = false + +directives.register("context.sorthash",function(v) + sortedhashindeed = v and table.sortedhash or nil +end) + local function writer(parent,command,...) -- already optimized before call if type(command) == "string" then -- for now @@ -799,20 +805,39 @@ local function writer(parent,command,...) -- already optimized before call local tn = #ti if tn == 0 then local done = false - for k, v in next, ti do - if done then - if v == "" then - flush(currentcatcodes,",",k,'=') + if sortedhashindeed then + for k, v in sortedhashindeed(ti) do + if done then + if v == "" then + flush(currentcatcodes,",",k,'=') + else + flush(currentcatcodes,",",k,"={",v,"}") + end else - flush(currentcatcodes,",",k,"={",v,"}") + if v == "" then + flush(currentcatcodes,"[",k,"=") + else + flush(currentcatcodes,"[",k,"={",v,"}") + end + done = true end - else - if v == "" then - flush(currentcatcodes,"[",k,"=") + end + else + for k, v in next, ti do + if done then + if v == "" then + flush(currentcatcodes,",",k,'=') + else + flush(currentcatcodes,",",k,"={",v,"}") + end else - flush(currentcatcodes,"[",k,"={",v,"}") + if v == "" then + flush(currentcatcodes,"[",k,"=") + else + flush(currentcatcodes,"[",k,"={",v,"}") + end + done = true end - done = true end end if done then |