diff options
author | Marius <mariausol@gmail.com> | 2010-11-01 14:00:14 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-11-01 14:00:14 +0200 |
commit | e19e21294c4450e292a48ee5a3cec8a90daf91ed (patch) | |
tree | a0c53a86c5692bd2d07b9c96a51a9d8325f57c52 /tex | |
parent | b8fc800cde67f29f4724b642d87278f864ec2d58 (diff) | |
download | context-e19e21294c4450e292a48ee5a3cec8a90daf91ed.tar.gz |
beta 2010.11.01 12:14
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cldf-com.lua | 13 | ||||
-rw-r--r-- | tex/context/base/cldf-ini.lua | 9 | ||||
-rw-r--r-- | tex/context/base/cldf-ini.mkiv | 3 | ||||
-rw-r--r-- | tex/context/base/cldf-ver.lua | 44 | ||||
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/l-dir.lua | 123 | ||||
-rw-r--r-- | tex/context/base/l-file.lua | 15 | ||||
-rw-r--r-- | tex/context/base/l-io.lua | 19 | ||||
-rw-r--r-- | tex/context/base/l-table.lua | 2 | ||||
-rw-r--r-- | tex/context/base/math-ini.mkiv | 13 | ||||
-rw-r--r-- | tex/context/base/mult-cld.lua | 4 | ||||
-rw-r--r-- | tex/context/base/mult-def.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mult-ini.lua | 25 | ||||
-rw-r--r-- | tex/context/base/page-lay.mkiv | 10 | ||||
-rw-r--r-- | tex/context/base/page-run.mkiv | 314 | ||||
-rw-r--r-- | tex/context/base/sort-ini.lua | 2 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 38 |
18 files changed, 304 insertions, 336 deletions
diff --git a/tex/context/base/cldf-com.lua b/tex/context/base/cldf-com.lua new file mode 100644 index 000000000..3bbeabb0f --- /dev/null +++ b/tex/context/base/cldf-com.lua @@ -0,0 +1,13 @@ +if not modules then modules = { } end modules ['cldf-com'] = { + version = 1.001, + comment = "companion to cldf-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local generics = context.generics +local variables = interfaces.variables + +generics.starttabulate = "start" .. variables.tabulate -- todo: e!start +generics.stoptabulate = "stop" .. variables.tabulate -- todo: e!stop diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua new file mode 100644 index 000000000..89c5bfe58 --- /dev/null +++ b/tex/context/base/cldf-ini.lua @@ -0,0 +1,9 @@ +if not modules then modules = { } end modules ['cldf-ini'] = { + version = 1.001, + comment = "companion to cldf-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is a placeholder, maybe mult-cld moves here. diff --git a/tex/context/base/cldf-ini.mkiv b/tex/context/base/cldf-ini.mkiv index b8731fe29..44e9e7873 100644 --- a/tex/context/base/cldf-ini.mkiv +++ b/tex/context/base/cldf-ini.mkiv @@ -13,7 +13,8 @@ \writestatus{loading}{ConTeXt Lua Documents / Functions} -%registerctxluafile{cldf-ini}{1.001} % maybe mult-cld moves here +\registerctxluafile{cldf-ini}{1.001} +\registerctxluafile{cldf-com}{1.001} \registerctxluafile{cldf-ver}{1.001} \endinput diff --git a/tex/context/base/cldf-ver.lua b/tex/context/base/cldf-ver.lua index 0d7d55649..fbc7670e2 100644 --- a/tex/context/base/cldf-ver.lua +++ b/tex/context/base/cldf-ver.lua @@ -6,17 +6,47 @@ if not modules then modules = { } end modules ['cldf-ver'] = { license = "see context related readme files" } -local concat = table.concat +local concat, tohandle = table.concat, table.tohandle +local tostring, type = tostring, type local context = context -function table.tocontext(...) - local function flush(...) - context(concat{...,"\n"}) - end - context.starttyping() +local function flush(...) + context(concat{...,"\n"}) +end + +local function t_tocontext(...) + context.starttyping { "typing" } -- else [1] is intercepted context.pushcatcodes("verbatim") - table.tohandle(flush,...) + tohandle(flush,...) context.stoptyping() context.popcatcodes() end + +local function s_tocontext(...) -- we need to catch {\} + context.type() + context("{") + context.pushcatcodes("verbatim") + context(concat({...}," ")) + context.popcatcodes() + context("}") +end + +local function b_tocontext(b) + string_tocontext(tostring(b)) +end + +table .tocontext = t_tocontext +string .tocontext = s_tocontext +boolean.tocontext = b_tocontext + +function tocontext(first,...) + local t = type(first) + if t == "string" then + s_tocontext(first,...) + elseif t == "table" then + t_tocontext(first,...) + elseif t == "boolean" then + b_tocontext(first,...) + end +end diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index c37fdc72a..1c44d3050 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.10.29 18:15} +\newcontextversion{2010.11.01 12:14} %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/context.tex b/tex/context/base/context.tex index 394703624..be9700d73 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.10.29 18:15} +\edef\contextversion{2010.11.01 12:14} %D For those who want to use this: diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua index be21fb985..b35973eef 100644 --- a/tex/context/base/l-dir.lua +++ b/tex/context/base/l-dir.lua @@ -114,7 +114,7 @@ local function glob(str,t) elseif isfile(str) then t(str) else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local root, path, base = split[1], split[2], split[3] local recurse = find(base,"%*%*") @@ -138,7 +138,7 @@ local function glob(str,t) return { str } end else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local t = t or { } local action = action or function(name) t[#t+1] = name end @@ -165,7 +165,7 @@ dir.glob = glob local function globfiles(path,recurse,func,files) -- func == pattern or function if type(func) == "string" then - local s = func -- alas, we need this indirect way + local s = func func = function(name) return find(name,s) end end files = files or { } @@ -210,7 +210,9 @@ end local make_indeed = true -- false -if find(os.getenv("PATH"),";") then -- os.type == "windows" +local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") + +if onwindows then function dir.mkdirs(...) local str, pth, t = "", "", { ... } @@ -266,49 +268,17 @@ if find(os.getenv("PATH"),";") then -- os.type == "windows" return pth, (isdir(pth) == true) end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expandname(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = currentdir() - if chdir(first) then - first = dir.current() - end - chdir(d) - end - end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end - end + --~ print(dir.mkdirs("","","a","c")) + --~ print(dir.mkdirs("a")) + --~ print(dir.mkdirs("a:")) + --~ print(dir.mkdirs("a:/b/c")) + --~ print(dir.mkdirs("a:b/c")) + --~ print(dir.mkdirs("a:/bbb/c")) + --~ print(dir.mkdirs("/a/b/c")) + --~ print(dir.mkdirs("/aaa/b/c")) + --~ print(dir.mkdirs("//a/b/c")) + --~ print(dir.mkdirs("///a/b/c")) + --~ print(dir.mkdirs("a/bbb//ccc/")) else @@ -350,13 +320,55 @@ else return pth, (isdir(pth) == true) end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) + --~ print(dir.mkdirs("","","a","c")) + --~ print(dir.mkdirs("a")) + --~ print(dir.mkdirs("/a/b/c")) + --~ print(dir.mkdirs("/aaa/b/c")) + --~ print(dir.mkdirs("//a/b/c")) + --~ print(dir.mkdirs("///a/b/c")) + --~ print(dir.mkdirs("a/bbb//ccc/")) + +end + +dir.makedirs = dir.mkdirs + +-- we can only define it here as it uses dir.current + +if onwindows then + + function dir.expandname(str) -- will be merged with cleanpath and collapsepath + local first, nothing, last = match(str,"^(//)(//*)(.*)$") + if first then + first = dir.current() .. "/" + end + if not first then + first, last = match(str,"^(//)/*(.*)$") + end + if not first then + first, last = match(str,"^([a-zA-Z]:)(.*)$") + if first and not find(last,"^/") then + local d = currentdir() + if chdir(first) then + first = dir.current() + end + chdir(d) + end + end + if not first then + first, last = dir.current(), str + end + last = gsub(last,"//","/") + last = gsub(last,"/%./","/") + last = gsub(last,"^/*","") + first = gsub(first,"/*$","") + if last == "" or last == "." then + return first + else + return first .. "/" .. last + end + end + +else function dir.expandname(str) -- will be merged with cleanpath and collapsepath if not find(str,"^/") then @@ -364,9 +376,10 @@ else end str = gsub(str,"//","/") str = gsub(str,"/%./","/") + str = gsub(str,"(.)/%.$","%1") return str end end -dir.makedirs = dir.mkdirs +file.expandname = dir.expandname -- for convenience diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index 7c5b9c67f..264b6a286 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -12,7 +12,7 @@ file = file or { } local file = file local insert, concat = table.insert, table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char +local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower local lpegmatch = lpeg.match local getcurrentdir, attributes = lfs.currentdir, lfs.attributes @@ -168,8 +168,8 @@ function file.splitpath(str,separator) -- string return checkedsplit(str,separator or io.pathseparator) end -function file.joinpath(tab) -- table - return concat(tab,io.pathseparator) -- can have trailing // +function file.joinpath(tab,separator) -- table + return concat(tab,separator or io.pathseparator) -- can have trailing // end -- we can hash them weakly @@ -265,8 +265,13 @@ file.collapse_path = file.collapsepath --~ test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..") --~ test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..") -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) +function file.robustname(str,strict) + str = gsub(str,"[^%a%d%/%-%.\\]+","-") + if strict then + return lower(gsub(str,"^%-*(.-)%-*$","%1")) + else + return str + end end file.readdata = io.loaddata diff --git a/tex/context/base/l-io.lua b/tex/context/base/l-io.lua index f9a663519..88816648d 100644 --- a/tex/context/base/l-io.lua +++ b/tex/context/base/l-io.lua @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['l-io'] = { local io = io local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format local concat = table.concat +local type = type if string.find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator = "\\", ";" @@ -67,12 +68,19 @@ function io.size(filename) end function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 + if type(f) == "string" then + local f = io.open(filename) + local n = f and io.noflines(f) or 0 + assert(f:close()) + return n + else + local n = 0 + for _ in f:lines() do + n = n + 1 + end + f:seek('set',0) + return n end - f:seek('set',0) - return n end local nextchar = { @@ -164,6 +172,7 @@ function io.ask(question,default,options) io.write(format(" [%s]",default)) end io.write(format(" ")) + io.flush() local answer = io.read() answer = gsub(answer,"^%s*(.*)%s*$","%1") if answer == "" and default then diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua index abaaa62ba..e335944cd 100644 --- a/tex/context/base/l-table.lua +++ b/tex/context/base/l-table.lua @@ -305,7 +305,7 @@ table.serialize_inline = true local noquotes, hexify, handle, reduce, compact, inline, functions -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key +local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 26fb94033..e057e1cc6 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -411,7 +411,18 @@ %D Even more drastic: -\def\asciimode{\catcodetable\txtcatcodes\nonknuthmode} +\unexpanded\def\asciimode + {\catcodetable\txtcatcodes + \nonknuthmode} + +\unexpanded\def\startasciimode + {\pushcatcodetable + \catcodetable\txtcatcodes + \nonknuthmode} + +\unexpanded\def\stopasciimode + {\popcatcodetable + \donknuthmode} %D Needed for unicode: diff --git a/tex/context/base/mult-cld.lua b/tex/context/base/mult-cld.lua index a200625bb..70c190865 100644 --- a/tex/context/base/mult-cld.lua +++ b/tex/context/base/mult-cld.lua @@ -198,8 +198,10 @@ local function writer(command,first,...) --~ end end +local generics = { } context.generics = generics + local function indexer(t,k) - local c = "\\" .. k + local c = "\\" .. (generics[k] or k) local f = function(first,...) if first == nil then flush(currentcatcodes,c) diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index a6840b0e0..156cdfff5 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -28,4 +28,6 @@ \input mult-\userinterfacetag \relax \input mult-m\userresponsestag \relax +\ctxlua{interfaces.setuserinterface("\userinterfacetag","\userresponsestag")} + \protect \endinput diff --git a/tex/context/base/mult-ini.lua b/tex/context/base/mult-ini.lua index 2b31bcfc0..be4a7cb69 100644 --- a/tex/context/base/mult-ini.lua +++ b/tex/context/base/mult-ini.lua @@ -23,6 +23,14 @@ interfaces.interfaces = { "cs", "de", "en", "fr", "it", "nl", "ro", "pe", } +storage.shared.currentinterface = storage.shared.currentinterface or "en" +storage.shared.currentresponse = storage.shared.currentresponse or "en" + +function interfaces.setuserinterface(interface,response) + storage.shared.currentinterface = interface + storage.shared.currentresponse = response +end + local messages, constants, variables = interfaces.messages, interfaces.constants, interfaces.variables function interfaces.setmessages(category,str) @@ -105,5 +113,20 @@ function interfaces.cachesetup(t) end function interfaces.is_command(str) - return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false + return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false -- there will be a proper function for this +end + +-- -- -- + +local complete = { } interfaces.complete = complete + +setmetatable(complete, { __index = function(t,k) + complete = require("mult-def.lua") + interfaces.complete = complete + return complete[k] +end } ) + +function interfaces.interfacedcommand(name) + local command = complete.commands[name] + return command and command[storage.shared.currentinterface] or name end diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index aad3a7bb8..9b3079d2a 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -1171,11 +1171,11 @@ %D \showsetup{showsetups} %D %showsetup{showmargins} -\fetchruntimecommand \showprint {page-run.mkii} -\fetchruntimecommand \showframe {page-run.mkii} -\fetchruntimecommand \showlayout {page-run.mkii} -\fetchruntimecommand \showsetups {page-run.mkii} -\fetchruntimecommand \showmargins {page-run.mkii} +\fetchruntimecommand \showprint {page-run.mkiv} +\fetchruntimecommand \showframe {page-run.mkiv} +\fetchruntimecommand \showlayout {page-run.mkiv} +\fetchruntimecommand \showsetups {page-run.mkiv} +\fetchruntimecommand \showmargins {page-run.mkiv} %D The default dimensions are quite old and will not change. %D The funny fractions were introduced when we went from fixed diff --git a/tex/context/base/page-run.mkiv b/tex/context/base/page-run.mkiv index ae5af81e9..cde0a2231 100644 --- a/tex/context/base/page-run.mkiv +++ b/tex/context/base/page-run.mkiv @@ -88,7 +88,78 @@ % {\toonprint[][gespiegeld][plaats=midden]} {\strut\break\type{gespiegeld}} % {\toonprint[gespiegeld][gespiegeld][plaats=midden]} {\type{gespiegeld}\break\type{gespiegeld}} % \stopcombinatie - + +% maybe we will have page-run.lua + +\startluacode +local function showdimension(name) + context.NC() + context.tex(interfaces.interfacedcommand(name)) + context.NC() + context(number.todimen(tex.dimen[name],"pt","%0.4fpt")) + context.NC() + context(number.todimen(tex.dimen[name],"cm","%0.4fcm")) + context.NC() + context(number.todimen(tex.dimen[name],"bp","%0.4fbp")) + context.NC() + context(number.todimen(tex.dimen[name],"dd","%0.4fdd")) + context.NC() + context.NR() +end + +local function showmacro(name) + context.NC() + context.tex(interfaces.interfacedcommand(name)) + context.NC() + context.getvalue(name) + context.NC() + context.NR() +end + +function commands.showlayoutvariables() + + context.starttabulate { "|l|Tr|Tr|Tr|Tr|" } + + showdimension("paperheight") + showdimension("paperwidth") + showdimension("printpaperheight") + showdimension("printpaperwidth") + showdimension("topspace") + showdimension("backspace") + showdimension("makeupheight") + showdimension("makeupwidth") + showdimension("topheight") + showdimension("topdistance") + showdimension("headerheight") + showdimension("headerdistance") + showdimension("textheight") + showdimension("footerdistance") + showdimension("footerheight") + showdimension("bottomdistance") + showdimension("bottomheight") + showdimension("leftedgewidth") + showdimension("leftedgedistance") + showdimension("leftmarginwidth") + showdimension("leftmargindistance") + showdimension("textwidth") + showdimension("rightmargindistance") + showdimension("rightmarginwidth") + showdimension("rightedgedistance") + showdimension("rightedgewidth") + context.NR() + showdimension("bodyfontsize") + showdimension("lineheight") + context.NR() + showmacro("strutheightfactor") + showmacro("strutdepthfactor") + showmacro("topskipfactor") + showmacro("maxdepthfactor") + + context.stoptabulate() + +end +\stopluacode + \gdef\doshowframe[#1][#2]% {\ifsecondargument \setupbackgrounds @@ -120,246 +191,11 @@ \setupbackgrounds [\c!state=\v!repeat]} -\gdef\showframe{\dodoubleempty\doshowframe} - -\gdef\showsetupA#1#2% - {#1&\PtToCm{\the#2}&\the#2&\tttf\string#2\cr} - -\gdef\showsetupB#1#2#3% - {#1&#3&\tttf\string#3\cr} - -% \startinterface english % english is fallback - -\gdef\showsetups - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{paperheight} \paperheight - \showsetupA{paperwidth} \paperwidth - \showsetupA{printpaperheight} \printpaperheight - \showsetupA{printpaperwidth} \printpaperwidth - \showsetupA{topspace} \topspace - \showsetupA{backspace} \backspace - \showsetupA{height} \makeupheight - \showsetupA{width} \makeupwidth - \showsetupA{top} \topheight - \showsetupA{topdistance} \topdistance - \showsetupA{header} \headerheight - \showsetupA{headerdistance} \headerdistance - \showsetupA{textheight} \textheight - \showsetupA{footerdistance} \footerdistance - \showsetupA{footer} \footerheight - \showsetupA{bottomdistance} \bottomdistance - \showsetupA{bottom} \bottomheight - \showsetupA{leftedge} \leftedgewidth - \showsetupA{leftedgedistance} \leftedgedistance - \showsetupA{leftmargin} \leftmarginwidth - \showsetupA{leftmargindistance} \leftmargindistance - \showsetupA{textwidth} \textwidth - \showsetupA{rightmargindistance}\rightmargindistance - \showsetupA{rightmargin} \rightmarginwidth - \showsetupA{rightedgedistance} \rightedgedistance - \showsetupA{rightedge} \rightedgewidth - \showsetupB{bodyfontsize} \the \globalbodyfontsize - \showsetupB{line} \relax \normallineheight - \showsetupB{height} \relax \strutheightfactor - \showsetupB{depth} \relax \strutdepthfactor - \showsetupB{topskip} \relax \topskipfactor - \showsetupB{maxdepth} \relax \maxdepthfactor}}} - -% \stopinterface - -\startinterface dutch +\gdef\showframe + {\dodoubleempty\doshowframe} \gdef\showsetups - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{papierhoogte} \papierhoogte - \showsetupA{papierbreedte} \papierbreedte - \showsetupA{printpapierhoogte} \printpapierhoogte - \showsetupA{printpapierbreedte} \printpapierbreedte - \showsetupA{kopwit} \kopwit - \showsetupA{rugwit} \rugwit - \showsetupA{snijwit} \snijwit - \showsetupA{hoogte} \zethoogte - \showsetupA{breedte} \zetbreedte - \showsetupA{boven} \bovenhoogte - \showsetupA{bovenafstand} \bovenafstand - \showsetupA{hoofd} \hoofdhoogte - \showsetupA{hoofdafstand} \hoofdafstand - \showsetupA{teksthoogte} \teksthoogte - \showsetupA{voetafstand} \voetafstand - \showsetupA{voet} \voethoogte - \showsetupA{onderafstand} \onderafstand - \showsetupA{onder} \onderhoogte - \showsetupA{linkerrand} \linkerrandbreedte - \showsetupA{linkerrandafstand} \linkerrandafstand - \showsetupA{linkermarge} \linkermargebreedte - \showsetupA{linkermargeafstand} \linkermargeafstand - \showsetupA{tekstbreedte} \tekstbreedte - \showsetupA{rechtermargeafstand}\rechtermargeafstand - \showsetupA{rechtermarge} \rechtermargebreedte - \showsetupA{rechterrandafstand} \rechterrandafstand - \showsetupA{rechterrand} \rechterrandbreedte - \showsetupB{korps} \the \globalbodyfontsize - \showsetupB{regel} \relax \normallineheight - \showsetupB{hoogte} \relax \strutheightfactor - \showsetupB{diepte} \relax \strutdepthfactor - \showsetupB{boven} \relax \topskipfactor - \showsetupB{onder} \relax \maxdepthfactor}}} - -\stopinterface - -% todo: \showsetupA{rugwit} \rugwit - -\startinterface german - -\gdef\showsetups% - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{papierhoehe} \papierhoehe - \showsetupA{papierbreite} \papierbreite - \showsetupA{printpapierhoehe} \printpapierhoehe - \showsetupA{printpapierbreite} \printpapierbreite - \showsetupA{kopfweite} \kopfweite - \showsetupA{rumpfweite} \rumpfweite - \showsetupA{hoehe} \satzhoehe - \showsetupA{breite} \satzbreite - \showsetupA{oben} \hoeheoben - \showsetupA{abstandoben} \abstandoben - \showsetupA{kopfzeile} \kopfzeilenhoehe - \showsetupA{kopfzeilenabstand} \kopfzeilenabstand - \showsetupA{texthoehe} \texthoehe - \showsetupA{fusszeileabstand} \fusszeileabstand - \showsetupA{fusszeilen} \fusszeilenhoehe - \showsetupA{abstandunten} \abstandunten - \showsetupA{hoeheunten} \hoeheunten - \showsetupA{linkerrand} \breitelinkerrand - \showsetupA{abstandlinkerrand} \abstandlinkerrand - \showsetupA{linkemarginal} \linkemarginalbreite - \showsetupA{linkemarginalafstand} \linkemarginalafstand - \showsetupA{textbreite} \textbreite - \showsetupA{rechtemarginalafstand}\rechtemarginalafstand - \showsetupA{rechtemarginal} \rechtemarginalbreite - \showsetupA{abstandrechterrand} \abstandrechterrand - \showsetupA{rechterrand} \breiterechterrand - \showsetupB{fliesstext} \the \globalbodyfontsize - \showsetupB{linie} \relax \normallineheight - \showsetupB{hoehe} \relax \strutheightfactor - \showsetupB{tiefe} \relax \strutdepthfactor - \showsetupB{topskip} \relax \topskipfactor - \showsetupB{maxdepth} \relax \maxdepthfactor}}} - -\stopinterface - -\startinterface czech - -\gdef\showsetups% - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{vyskapapiru} \vyskapapiru - \showsetupA{sirkapapiru} \sirkapapiru - \showsetupA{vyskatiskpapiru} \vyskatiskpapiru - \showsetupA{sirkatiskpapiru} \sirkatiskpapiru - \showsetupA{hornimezera} \hornimezera - \showsetupA{spodnimezera} \spodnimezera - \showsetupA{vyska} \vyskasazby - \showsetupA{breite} \sirkasazby - \showsetupA{vyskatextu} \vyskatextu - \showsetupA{sirkatextu} \sirkatextu - \showsetupA{horejsek} \vyskahorejsku - \showsetupA{vzdalenosthorejsku} \vzdalenosthorejsku - \showsetupA{zahlavi} \vyskazahlavi - \showsetupA{vzdalenostzahlavi} \vzdalenostzahlavi - \showsetupA{fusszeileabstand} \vzdalenostupati - \showsetupA{upati} \vyskaupati - \showsetupA{vzdalenostspodku} \vzdalenostspodku - \showsetupA{spodek} \vyakaspodku - \showsetupA{levyokraj} \sirkalevehookraje - \showsetupA{vzdalenostlevehookraje} \vzdalenostlevehookraje - \showsetupA{levamarginalie} \sirkalevemarginalie - \showsetupA{vzdalenostlevemarginalie} \vzdalenostlevemarginalie - \showsetupA{vzdalenostpravemarginalie}\vzdalenostpravemarginalie - \showsetupA{pravamarginalie} \sirkapravemarginalie - \showsetupA{vzdalenostpravehookraje} \vzdalenostpravehookraje - \showsetupA{pravyokraj} \sirkapravehookraje - \showsetupB{zakladnivelikost} \the \globalbodyfontsize - \showsetupB{linka} \relax \normallineheight - \showsetupB{vyska} \relax \strutheightfactor - \showsetupB{hloubka} \relax \strutdepthfactor - \showsetupB{topskip} \relax \topskipfactor - \showsetupB{maxdepth} \relax \maxdepthfactor}}} - -\stopinterface - -\startinterface romanian - -\gdef\showsetups% - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{paperheight} \paperheight - \showsetupA{paperwidth} \paperwidth - \showsetupA{printpaperheight} \printpaperheight - \showsetupA{printpaperwidth} \printpaperwidth - \showsetupA{topspace} \topspace - \showsetupA{backspace} \backspace - \showsetupA{height} \makeupheight - \showsetupA{width} \makeupwidth - \showsetupA{top} \topheight - \showsetupA{topdistance} \topdistance - \showsetupA{header} \headerheight - \showsetupA{headerdistance} \headerdistance - \showsetupA{textheight} \textheight - \showsetupA{footerdistance} \footerdistance - \showsetupA{footer} \footerheight - \showsetupA{bottomdistance} \bottomdistance - \showsetupA{bottom} \bottomheight - \showsetupA{leftedge} \leftedgewidth - \showsetupA{leftedgedistance} \leftedgedistance - \showsetupA{leftmargin} \leftmarginwidth - \showsetupA{leftmargindistance} \leftmargindistance - \showsetupA{textwidth} \textwidth - \showsetupA{rightmargindistance}\rightmargindistance - \showsetupA{rightmargin} \rightmarginwidth - \showsetupA{rightedgedistance} \rightedgedistance - \showsetupA{rightedge} \rightedgewidth - \showsetupB{bodyfontsize} \the \globalbodyfontsize - \showsetupB{line} \relax \normallineheight - \showsetupB{height} \relax \strutheightfactor - \showsetupB{depth} \relax \strutdepthfactor - \showsetupB{topskip} \relax \topskipfactor - \showsetupB{maxdepth} \relax \maxdepthfactor}}} - -\stopinterface + {\ctxlua{commands.showlayoutvariables()}} \gdef\showlayout % interfereert lelijk met een \typefile er na {\bgroup diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index fb40c81a5..5b8575219 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -266,7 +266,7 @@ local function setlanguage(l,m,d) z_mappings = data.z_mappings p_mappings = data.p_mappings -- - method = predefinedmethods[method] or method + method = predefinedmethods[variables[method]] or method data.method = method -- data.digits = digite diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 6075ae6a1..b366fb801 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 10/29/10 18:15:03 +-- merge date : 11/01/10 12:14:26 do -- begin closure to overcome local limits and interference @@ -1062,7 +1062,7 @@ table.serialize_inline = true local noquotes, hexify, handle, reduce, compact, inline, functions -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key +local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } @@ -1682,7 +1682,7 @@ file = file or { } local file = file local insert, concat = table.insert, table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char +local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower local lpegmatch = lpeg.match local getcurrentdir, attributes = lfs.currentdir, lfs.attributes @@ -1838,8 +1838,8 @@ function file.splitpath(str,separator) -- string return checkedsplit(str,separator or io.pathseparator) end -function file.joinpath(tab) -- table - return concat(tab,io.pathseparator) -- can have trailing // +function file.joinpath(tab,separator) -- table + return concat(tab,separator or io.pathseparator) -- can have trailing // end -- we can hash them weakly @@ -1935,8 +1935,13 @@ file.collapse_path = file.collapsepath --~ test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..") --~ test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..") -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) +function file.robustname(str,strict) + str = gsub(str,"[^%a%d%/%-%.\\]+","-") + if strict then + return lower(gsub(str,"^%-*(.-)%-*$","%1")) + else + return str + end end file.readdata = io.loaddata @@ -2099,6 +2104,7 @@ if not modules then modules = { } end modules ['l-io'] = { local io = io local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format local concat = table.concat +local type = type if string.find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator = "\\", ";" @@ -2157,12 +2163,19 @@ function io.size(filename) end function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 + if type(f) == "string" then + local f = io.open(filename) + local n = f and io.noflines(f) or 0 + assert(f:close()) + return n + else + local n = 0 + for _ in f:lines() do + n = n + 1 + end + f:seek('set',0) + return n end - f:seek('set',0) - return n end local nextchar = { @@ -2254,6 +2267,7 @@ function io.ask(question,default,options) io.write(format(" [%s]",default)) end io.write(format(" ")) + io.flush() local answer = io.read() answer = gsub(answer,"^%s*(.*)%s*$","%1") if answer == "" and default then |