diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2011-06-01 08:54:21 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2011-06-01 08:54:21 +0000 |
commit | d7ccb42582f85acf30568913610ccf4d602023fb (patch) | |
tree | 7292e3545a420676878e7451b68892d360c62cb6 /Master/texmf-dist/scripts/context/lua/mtx-chars.lua | |
parent | 2d62a6fe9b80def59c392268022f1f9a2d6e358f (diff) |
commit context 2011.05.18
git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-chars.lua')
-rw-r--r-- | Master/texmf-dist/scripts/context/lua/mtx-chars.lua | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-chars.lua b/Master/texmf-dist/scripts/context/lua/mtx-chars.lua index 6acacfbd22e..dc760c4e7e6 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-chars.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-chars.lua @@ -6,6 +6,20 @@ if not modules then modules = { } end modules ['mtx-chars'] = { license = "see context related readme files" } +local helpinfo = [[ +--stix convert stix table to math table +--xtx generate xetx-*.tex (used by xetex) +--pdf generate pdfr-def.tex (used by pdftex) +]] + +local application = logs.application { + name = "mtx-chars", + banner = "MkII Character Table Generators 0.10", + helpinfo = helpinfo, +} + +local report = application.report + local format, concat, utfchar, upper = string.format, table.concat, unicode.utf8.char, string.upper scripts = scripts or { } @@ -24,13 +38,13 @@ scripts.chars = scripts.chars or { } --~ --~ function scripts.chars.stixtomkiv(inname,outname) --~ if inname == "" then ---~ logs.report("aquiring math data","invalid datafilename") +--~ report("aquiring math data, invalid datafilename") --~ end --~ local f = io.open(inname) --~ if not f then ---~ logs.report("aquiring math data","invalid datafile") +--~ report("aquiring math data, invalid datafile") --~ else ---~ logs.report("aquiring math data","processing " .. inname) +--~ report("aquiring math data, processing %s",inname) --~ if not outname or outname == "" then --~ outname = "char-mth.lua" --~ end @@ -72,9 +86,9 @@ scripts.chars = scripts.chars or { } --~ end --~ if not valid then --~ g:write("\t-- The data file is corrupt, invalid or maybe the format has changed.\n") ---~ logs.report("aquiring math data","problems with data table") +--~ report("aquiring math data, problems with data table") --~ else ---~ logs.report("aquiring math data","table saved in " .. outname) +--~ report("aquiring math data, table saved in %s",outname) --~ end --~ g:write("}\n") --~ g:close() @@ -83,7 +97,7 @@ scripts.chars = scripts.chars or { } --~ end function scripts.chars.stixtomkiv(inname,outname) - logs.report("we no longer use this options but use our own tables instead") + report("we no longer use this options but use our own tables instead") end local banner_pdf_1 = [[ @@ -101,7 +115,7 @@ local banner_pdf_2 = [[ ]] function scripts.chars.makepdfr() - local chartable = resolvers.find_file("char-def.lua") or "" + local chartable = resolvers.findfile("char-def.lua") or "" if chartable ~= "" then dofile(chartable) if characters and characters.data then @@ -143,6 +157,11 @@ local banner_utf_patch = [[ \setXTXcharcodes "201C "201C "201C \setXTXcharcodes "201D "201D "201D + +% patch needed for french + +\setXTXcharcodes "2019 "2019 "2019 + ]] local banner_utf_names = [[ @@ -174,13 +193,13 @@ local xtxclasses = { } function scripts.chars.makeencoutf() - local chartable = resolvers.find_file("char-def.lua") or "" + local chartable = resolvers.findfile("char-def.lua") or "" if chartable ~= "" then dofile(chartable) local function open(name,banner) local f = io.open(name,'w') if f then - logs.simple("writing '%s'",name) + report("writing '%s'",name) f:write(format(banner_utf_module,name)) f:write(banner) f:write() @@ -234,13 +253,14 @@ function scripts.chars.makeencoutf() end end end + local template = "\\def\\%-".. length .. "s{\\char\"%05X } %% %s: %s\n" for i=1,#list do local code = list[i] if code > 0x5B and code <= 0xFFFF then local chr = data[code] if chr and chr.contextname then local ch = utfchar(code) - f:write(format("\\def\\%s{\\char\"%05X } %% %s: %s\n", chr.contextname:rpadd(length," "), code, chr.description, ch)) + f:write(format(template, chr.contextname, code, chr.description, ch)) end end end @@ -301,14 +321,6 @@ function scripts.chars.makeencoutf() end end -logs.extendbanner("MkII Character Table Generators 0.10") - -messages.help = [[ ---stix convert stix table to math table ---xtx generate xetx-*.tex (used by xetex) ---pdf generate pdfr-def.tex (used by pdftex) -]] - if environment.argument("stix") then local inname = environment.files[1] or "" local outname = environment.files[2] or "" @@ -318,5 +330,5 @@ elseif environment.argument("xtx") then elseif environment.argument("pdf") then scripts.chars.makepdfr() else - logs.help(messages.help) + application.help() end |