From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/58863 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: czech sorting in MiIV Date: Sat, 15 May 2010 21:42:42 +0200 Message-ID: <4BEEF932.4020100@wxs.nl> References: <7B5C7D08E39F42AB89B01B6686E2814B@PustaPC> <4BEEB18B.1080603@wxs.nl> <4BEECACA.3080000@wxs.nl> <4BEED963.9030104@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030607020406050401010807" X-Trace: dough.gmane.org 1273952582 1686 80.91.229.12 (15 May 2010 19:43:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 15 May 2010 19:43:02 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat May 15 21:43:01 2010 connect(): No such file or directory Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ODNGE-0003Ct-IA for gctc-ntg-context-518@m.gmane.org; Sat, 15 May 2010 21:42:58 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4E3EAC9B8C; Sat, 15 May 2010 21:42:55 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 59Zxam3+DJQ6; Sat, 15 May 2010 21:42:52 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 88112C9B66; Sat, 15 May 2010 21:42:52 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AC3AAC9B66 for ; Sat, 15 May 2010 21:42:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id tnnY1O-8wQIH for ; Sat, 15 May 2010 21:42:47 +0200 (CEST) Original-Received: from smtp.ziggozakelijk.nl (sc-162.r-213-125-29.schoolconnect.nu [213.125.29.162]) by balder.ntg.nl (Postfix) with ESMTP id C300FC9AE3 for ; Sat, 15 May 2010 21:42:47 +0200 (CEST) X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.195; Original-Received: from [10.100.1.195] (unverified [10.100.1.195]) by controller-9 (SurgeMail 4.3e) with ESMTP id 719-1713362 for multiple; Sat, 15 May 2010 21:42:32 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 In-Reply-To: X-Authenticated-User: hagen@controller-9 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:58863 Archived-At: This is a multi-part message in MIME format. --------------030607020406050401010807 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: quoted-printable On 15-5-2010 8:14, Tom=E1=B9 Pusteln=EDk wrote: > Thanks, it's working now, but still it sort some words bit different > compared to MkII. But it's ok for now, I will check czech norm and try > to fix it if needed. we can support several norms if needed > Also I have question. In my bachelor thesis I'm describe language > support for ConTeXt and when I tried add some experimental language int= o > ConTeXt (I define system constants and add \loadcorefile{lang-exp} to > context.mkii and context.mkiv) and when generating format for MkII > everything was ok but for MkIV ConTeXt complained he can't find file > lang-exp.tex (I paste it in base folder to other source codes). Any ide= a > whats wrong? In MkIV must I change something else as well? Ah .. you look in the wrong spot. There's a file: mult-def.lua and interfaces are defined there. I generate the mult-* files using mtxrun interface --context Now, if you just want to experiment, you need to patch mult-def.lua. You can make a mult-def-mine.lua: local t =3D require "mult-def.lua" t.commands.framed.xx =3D "frmd" -- print(table.serialize(t.commands.framed)) return t I patched mtx-interface.lua so that you can say; mtxrun interface --context mult-def-mine.lua There is also --messages for the message files. Of course you have to make a cont-xx.tex file as well. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- --------------030607020406050401010807 Content-Type: text/x-lua; name="mtx-interface.lua" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mtx-interface.lua" if not modules then modules = { } end modules ['mtx-cache'] = { version = 1.001, comment = "companion to mtxrun.lua", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } local format = string.format scripts = scripts or { } scripts.interface = scripts.interface or { } local flushers = { } local userinterfaces = { 'en','cs','de','it','nl','ro','fr','pe' } local messageinterfaces = { 'en','cs','de','it','nl','ro','fr','pe','no' } function flushers.scite(interface,collection) local result, i = {}, 0 result[#result+1] = format("keywordclass.macros.context.%s=",interface) for _, command in ipairs(collection) do if i==0 then result[#result+1] = "\\\n" i = 5 else i = i - 1 end result[#result+1] = format("%s ",command) end io.savedata(format("cont-%s-scite.properties",interface), table.concat(result),"\n") io.savedata(format("cont-%s-scite.lua",interface), table.serialize(collection,true)) end function flushers.jedit(interface,collection) local result = {} result[#result+1] = "" result[#result+1] = "\n" result[#result+1] = "" result[#result+1] = "\t" result[#result+1] = "\t\t" for _, command in ipairs(collection) do result[#result+1] = format("\t\t\t%s",command) end result[#result+1] = "\t\t" result[#result+1] = "\t" result[#result+1] = "" io.savedata(format("context-jedit-%s.xml",interface), table.concat(result),"\n") end function flushers.bbedit(interface,collection) local result = {} result[#result+1] = "" result[#result+1] = "BBLMKeywordList" result[#result+1] = "" for _, command in ipairs(collection) do result[#result+1] = format("\t\\%s",command) end result[#result+1] = "" io.savedata(format("context-bbedit-%s.xml",interface), table.concat(result),"\n") end function flushers.raw(interface,collection) for _, command in ipairs(collection) do logs.simple(command) end end function scripts.interface.editor(editor) local interfaces= environment.files if #interfaces == 0 then interfaces= userinterfaces end local xmlfile = resolvers.find_file("cont-en.xml") or "" if xmlfile == "" then logs.simple("unable to locate cont-en.xml") end for _, interface in ipairs(interfaces) do local keyfile = resolvers.find_file(format("keys-%s.xml",interface)) or "" if keyfile == "" then logs.simple("unable to locate keys-*.xml") else local collection = { } local mappings = { } local x = xml.load(keyfile) for e, d, k in xml.elements(x,"cd:command") do local at = d[k].at local name, value = at.name, at.value if name and value then mappings[name] = value end end local x = xml.load(xmlfile) for e, d, k in xml.elements(x,"cd:command") do local at = d[k].at local name, type = at.name, at["type"] if name and name ~= "" then local remapped = mappings[name] or name if type == "environment" then collection[#collection+1] = "start" .. remapped collection[#collection+1] = "stop" .. remapped else collection[#collection+1] = remapped end end end if #collection > 0 then table.sort(collection) flushers[editor](interface,collection) end end end end function scripts.interface.check() local xmlfile = resolvers.find_file("cont-en.xml") or "" if xmlfile ~= "" then local f = io.open("cont-en-check.tex","w") if f then f:write("\\starttext\n") local x = xml.load(xmlfile) for e, d, k in xml.elements(x,"cd:command") do local dk = d[k] local at = dk.at if at then local name = xml.filter(dk,"cd:sequence/cd:string/attribute(value)") if name and name ~= "" then if at.type == "environment" then name = "start" .. name end f:write(format("\\doifundefined{%s}{\\writestatus{check}{command '%s' is undefined}}\n",name,name)) end end end f:write("\\stoptext\n") f:close() end end end function scripts.interface.context() local filename = resolvers.find_file(environment.files[1] or "mult-def.lua") or "" if filename ~= "" then local interface = dofile(filename) if interface and next(interface) then local variables, constants, commands, elements = interface.variables, interface.constants, interface.commands, interface.elements local filename = resolvers.find_file("cont-en.xml") or "" local xmldata = filename ~= "" and (io.loaddata(filename) or "") local function flush(texresult,xmlresult,language,what,tag) local t = interface[what] texresult[#texresult+1] = format("%% definitions for interface %s for language %s\n%%",what,language) xmlresult[#xmlresult+1] = format("\t\n",what,language) xmlresult[#xmlresult+1] = format("\t",what) for _, key in ipairs(table.sortedkeys(t)) do local v = t[key] local value = v[language] or v["en"] if not value then logs.simple(format("warning, no value for key '%s' for language '%s'",key,language)) else local value = t[key][language] or t[key].en texresult[#texresult+1] = format("\\setinterface%s{%s}{%s}",tag,key,value) xmlresult[#xmlresult+1] = format("\t\t",tag,key,value) end end xmlresult[#xmlresult+1] = format("\t\n",tag) end local function replace(str, element, attribute, category, othercategory, language) return str:gsub(format("(<%s[^>]-%s=)([\"\'])([^\"\']-)([\"\'])",element,attribute), function(a,b,c) local cc = category[c] if not cc and othercategory then cc = othercategory[c] end if cc then ccl = cc[language] if ccl then return a .. b .. ccl .. b end end return a .. b .. c .. b end) end for language, _ in pairs(commands.setuplayout) do local texresult, xmlresult = { }, { } texresult[#texresult+1] = format("%% this file is auto-generated, don't edit this file\n%%") xmlresult[#xmlresult+1] = format("\n",tag) xmlresult[#xmlresult+1] = format("\n",language) flush(texresult,xmlresult,language,"variables","variable") flush(texresult,xmlresult,language,"constants","constant") flush(texresult,xmlresult,language,"elements", "element") flush(texresult,xmlresult,language,"commands", "command") texresult[#texresult+1] = format("%%\n\\endinput") xmlresult[#xmlresult+1] = format("") local texfilename = format("mult-%s.tex",language) local xmlfilename = format("keys-%s.xml",language) io.savedata(texfilename,table.concat(texresult,"\n")) logs.simple(format("saving interface definitions '%s'",texfilename)) io.savedata(xmlfilename,table.concat(xmlresult,"\n")) logs.simple(format("saving interface translations '%s'",xmlfilename)) if language ~= "en" and xmldata ~= "" then local newdata = xmldata:gsub("(