diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-05-21 16:14:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-05-21 16:14:00 +0200 |
commit | 9d8e8c6d368abc72eae60cc0b24984cc2506a1bf (patch) | |
tree | 8eb26e90f7d428280d9d66c7b03430053fffcae0 /tex/context/base | |
parent | bd95a21d2b31a5fab1b4cc7c2b0334823fb3a3e9 (diff) | |
download | context-9d8e8c6d368abc72eae60cc0b24984cc2506a1bf.tar.gz |
beta 2013.05.21 16:14
Diffstat (limited to 'tex/context/base')
22 files changed, 494 insertions, 265 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index ecf92987c..ca982e6c5 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.05.20 02:00} +\newcontextversion{2013.05.21 16:14} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 87a6493a9..37755f842 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 1ec2a4366..34f457df9 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.05.20 02:00} +\edef\contextversion{2013.05.21 16:14} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index f25490749..deaaca735 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -115,11 +115,23 @@ local function suffixonly(name) return name and lpegmatch(pattern,name) or "" end -file.pathpart = pathpart -file.basename = basename -file.nameonly = nameonly -file.suffixonly = suffixonly -file.suffix = suffixonly +local pattern = (noslashes^0 * slashes)^0 * noperiod^1 * ((period * C(noperiod^1))^1) * -1 + Cc("") + +local function suffixesonly(name) + if name then + return lpegmatch(pattern,name) + else + return "" + end +end + +file.pathpart = pathpart +file.basename = basename +file.nameonly = nameonly +file.suffixonly = suffixonly +file.suffix = suffixonly +file.suffixesonly = suffixesonly +file.suffixes = suffixesonly file.dirname = pathpart -- obsolete file.extname = suffixonly -- obsolete diff --git a/tex/context/base/l-gzip.lua b/tex/context/base/l-gzip.lua new file mode 100644 index 000000000..5100e4722 --- /dev/null +++ b/tex/context/base/l-gzip.lua @@ -0,0 +1,54 @@ +if not modules then modules = { } end modules ['l-gzip'] = { + version = 1.001, + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +if not gzip then + + -- no fallback yet + + return + +end + +local suffix, suffixes = file.suffix, file.suffixes + +function gzip.load(filename) + local f = io.open(filename,"rb") + if not f then + -- invalid file + elseif suffix(filename) == "gz" then + f:close() + local g = gzip.open(filename,"rb") + if g then + local str = g:read("*all") + g:close() + return str + end + else + local str = f:read("*all") + f:close() + return str + end +end + +function gzip.save(filename,data) + if suffix(filename) ~= "gz" then + filename = filename .. ".gz" + end + local f = io.open(filename,"wb") + if f then + local s = zlib.compress(data or "",9,nil,15+16) + f:write(s) + f:close() + return #s + end +end + +function gzip.suffix(filename) + local suffix, extra = suffixes(filename) + local gzipped = extra == "gz" + return suffix, gzipped +end diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua index b79bd0661..642213253 100644 --- a/tex/context/base/lang-ini.lua +++ b/tex/context/base/lang-ini.lua @@ -130,11 +130,15 @@ local function loaddefinitions(tag,specification) dataused[definition] = definition local filename = "lang-" .. definition .. ".lua" local fullname = resolvers.findfile(filename) or "" + if fullname == "" then + fullname = resolvers.findfile(filename .. ".gz") or "" + end if fullname ~= "" then if trace_patterns then report_initialization("loading definition %a for language %a from %a",definition,tag,fullname) end - local defs = dofile(fullname) -- use regular loader instead + local suffix, gzipped = gzip.suffix(fullname) + local defs = table.load(fullname,gzipped and gzip.load) if defs then -- todo: version test ok, nofloaded = true, nofloaded + 1 -- instance:patterns (defs.patterns and defs.patterns .data or "") diff --git a/tex/context/base/luat-bas.mkiv b/tex/context/base/luat-bas.mkiv index ddf901424..a38912716 100644 --- a/tex/context/base/luat-bas.mkiv +++ b/tex/context/base/luat-bas.mkiv @@ -26,6 +26,7 @@ \registerctxluafile{l-io} {1.001} \registerctxluafile{l-os} {1.001} \registerctxluafile{l-file} {1.001} +\registerctxluafile{l-gzip} {1.001} \registerctxluafile{l-md5} {1.001} \registerctxluafile{l-dir} {1.001} \registerctxluafile{l-unicode} {1.001} diff --git a/tex/context/base/phys-dim.mkiv b/tex/context/base/phys-dim.mkiv index 73cc2ea25..fe0f3f3b9 100644 --- a/tex/context/base/phys-dim.mkiv +++ b/tex/context/base/phys-dim.mkiv @@ -518,15 +518,24 @@ ″\else\phys_units_text_doubleprime\fi\else\phys_units_text_doubleprime \fi} -\unexpanded\def\checkedtextcelsius - {\iffontchar\font"2103\relax - ℃\else\phys_units_text_celsius - \fi} - -\unexpanded\def\checkedtextfahrenheit - {\iffontchar\font"2109\relax - ℉\else\phys_units_text_fahrenheit - \fi} +% \unexpanded\def\checkedtextcelsius +% {\ifmmode +% \phys_units_text_celsius +% \else\iffontchar\font"2103\relax +% ℃\else\phys_units_text_celsius +% \fi\fi} +% +% \unexpanded\def\checkedtextfahrenheit +% {\ifmmode +% \phys_units_text_fahrenheit +% \else\iffontchar\font"2109\relax +% ℉\else\phys_units_text_fahrenheit +% \fi\fi} +% +% % but, as users don't like this ... + +\let\checkedtextcelsius \phys_units_text_celsius +\let\checkedtextfahrenheit\phys_units_text_fahrenheit \setelementnature[unit] [mixed] \setelementnature[quantity][mixed] diff --git a/tex/context/base/s-lan-03.mkiv b/tex/context/base/s-lan-03.mkiv deleted file mode 100644 index 6b46a49b1..000000000 --- a/tex/context/base/s-lan-03.mkiv +++ /dev/null @@ -1,40 +0,0 @@ -%D \module -%D [ file=s-lan-03, -%D version=2010.10.21, -%D title=\CONTEXT\ Style File, -%D subtitle=Language Environment 3, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\startluacode -languages.words.tracers = languages.words.tracers or { } - -function languages.words.tracers.showwords(filename) - filename = filename or file.addsuffix(tex.jobname,"words") - if lfs.isfile(filename) then - local w = dofile(filename) - if w then - -- table.print(w) - for cname, category in table.sortedpairs(w.categories) do - for lname, language in table.sortedpairs(category.languages) do - context.bold(string.format("category: %s, language: %s, total: %s, unique: %s:", - cname, lname, language.total or 0, language.unique or 0) - ) - for word, n in table.sortedpairs(language.list) do - context(" %s (%s)",word,n) - end - context.par() - end - end - end - end -end -\stopluacode - -\ctxlua{languages.words.tracers.showwords("words-003.words")} - diff --git a/tex/context/base/s-lan-04.mkiv b/tex/context/base/s-lan-04.mkiv deleted file mode 100644 index c04be9466..000000000 --- a/tex/context/base/s-lan-04.mkiv +++ /dev/null @@ -1,153 +0,0 @@ -%D \module -%D [ file=s-lan-04, -%D version=2011.05.01, -%D title=\CONTEXT\ Style File, -%D subtitle=Language Environment 4, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D For Mojca. - -\startluacode - local a_colormodel = attributes.private('colormodel') - - local nodecodes = nodes.nodecodes - local nodepool = nodes.pool - local disc = nodecodes.disc - local glyph = nodecodes.glyph - local quads = fonts.hashes.quads - local newkern = nodepool.kern - local newrule = nodepool.rule - local newglue = nodepool.glue - - local get_attribute = node.has_attribute - - local tracers = nodes.tracers - local colortracers = tracers and tracers.colors - local setnodecolor = colortracers.set - - local function identify(head,marked) - local current, prev = head, nil - while current do - local id = current.id - local next = current.next - if id == disc then - if prev and next.id == glyph then -- catch other usage of disc - marked[#marked+1] = prev - end - elseif id == glyph then - prev = current - end - current = next - end - end - - local function strip(head,marked) - for i=1,#marked do - local prev = marked[i] - nodes.remove(head,prev.next,true) - end - end - - local function mark(head,marked,what,how) - for i=1,#marked do - local prev = marked[i] - local font = prev.font - local quad = quads[font] - head, prev = node.insert_after(head,prev,newkern(-quad/40)) - if what then - local rule = newrule(quad/20,.75*quad,0) - head, prev = node.insert_after(head,prev,rule) - setnodecolor(rule,how,get_attribute(prev,a_colormodel)) - else - local rule = newrule(quad/20,0,.5*quad) - head, prev = node.insert_after(head,prev,rule) - setnodecolor(rule,how,get_attribute(prev,a_colormodel)) - end - head, prev = node.insert_after(head,prev,newkern(-quad/40)) - head, prev = node.insert_after(head,prev,newglue(0)) - end - end - - local language_one, language_two, tag_one, tag_two - - function nodes.showhyphens(head) - local marked_1, marked_2 = { }, { } - if language_one then - for n in node.traverse_id(glyph,head) do - n.lang = language_one - end - lang.hyphenate(head,node.slide(head)) - identify(head,marked_1) - strip(head,marked_1) - end - if language_two then - for n in node.traverse_id(glyph,head) do - n.lang = language_two - end - lang.hyphenate(head,node.slide(head)) - identify(head,marked_2) - strip(head,marked_2) - end - if tag_one then - mark(head,marked_1,true,"hyphenation:"..tag_one) - end - if tag_two then - mark(head,marked_2,false,"hyphenation:"..tag_two) - end - return head, true - end - - function languages.startcomparepatterns(list) - local list = utilities.parsers.settings_to_array(list) - tag_one = list[1] - tag_two = list[2] - language_one = tag_one and languages.getnumber(tag_one) - language_two = tag_two and languages.getnumber(tag_two) - -- nodes.tasks.appendaction("processors","words","nodes.showhyphens") - nodes.tasks.appendaction("processors","before","nodes.showhyphens") - nodes.tasks.enableaction("processors","nodes.showhyphens") - end - - function languages.stopcomparepatterns() - nodes.tasks.disableaction("processors","nodes.showhyphens") - end - -\stopluacode - -\unprotect - -\def\startcomparepatterns[#1]% - {\bgroup - \language\zerocount - \setupalign[\v!nothyphenated]% - \ctxlua{languages.startcomparepatterns("#1")}} - -\def\stopcomparepatterns - {\ctxlua{languages.stopcomparepatterns()}% - \egroup} - -\protect - -\definecolor[hyphenation:en] [r=.8] -\definecolor[hyphenation:de] [g=.8] -\definecolor[hyphenation:nl] [b=.8] - -\continueifinputfile{s-lan-04.mkiv} - -\starttext - - \startcomparepatterns[en,de] - \input tufte\par - \stopcomparepatterns - - \startcomparepatterns[de,nl] - \input tufte\par - \stopcomparepatterns - -\stoptext diff --git a/tex/context/base/s-lan-06.mkiv b/tex/context/base/s-lan-06.mkiv deleted file mode 100644 index 43d59a2d1..000000000 --- a/tex/context/base/s-lan-06.mkiv +++ /dev/null @@ -1,53 +0,0 @@ -%D \module -%D [ file=s-lan-06, -%D version=2013.03.22, -%D title=\CONTEXT\ Style File, -%D subtitle=Language Environment 6, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\startluacode - -languages.tracers = languages.tracers or { } - -function languages.tracers.showfrequencies(language) - local t = languages.frequencies.getdata(language or "en") - context.starttabulate { "|lT|cw(2em)|r|" } - context.NC() - context.formatted.rlap("%s: %p",t.language,languages.frequencies.averagecharwidth(t.language)) - context.NC() - context.NC() - context.NR() - context.HL() - for k, v in table.sortedhash(t.frequencies) do - context.NC() - context("%U",k) - context.NC() - context("%c",k) - context.NC() - context("%0.3f",v) - context.NC() - context.NR() - end - context.stoptabulate() -end - -\stopluacode - -\unexpanded\def\ShowLanguageFrequencies#1% - {\ctxlua{languages.tracers.showfrequencies("#1")}} - -\continueifinputfile{s-lan-06.mkiv} - -\starttext - - \hsize65\averagecharwidth \input ward \par - - \ShowLanguageFrequencies\currentmainlanguage - -\stoptext diff --git a/tex/context/base/s-languages-counters.lua b/tex/context/base/s-languages-counters.lua new file mode 100644 index 000000000..436e64a64 --- /dev/null +++ b/tex/context/base/s-languages-counters.lua @@ -0,0 +1,52 @@ +if not modules then modules = { } end modules ['s-languages-counters'] = { + version = 1.001, + comment = "companion to s-languages-counters.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.languages = moduledata.languages or { } +moduledata.languages.counters = moduledata.languages.counters or { } + +local data = converters.verbose.data + +function moduledata.languages.counters.showverbose(specification) + specification = interfaces.checkedspecification(specification) + local list = utilities.parsers.settings_to_array(specification.language or "") + if #list == 0then + return + end + local used = { } + local words = { } + for i=1,#list do + local ai = list[i] + local di = data[ai] + if di and di.words then + used[#used+1] = ai + table.merge(words,di.words) + end + end + context.starttabulate { string.rep("|l",#used) .. "|r|" } + context.HL() + context.NC() + for i=1,#used do + context.bold(used[i]) + context.NC() + end + context.bold("number") + context.NC() + context.NR() + context.HL() + for k, v in table.sortedhash(words) do + context.NC() + for i=1,#used do + context(data[used[i]].words[k] or "") + context.NC() + end + context(k) + context.NC() + context.NR() + end + context.stoptabulate() +end diff --git a/tex/context/base/s-languages-counters.mkiv b/tex/context/base/s-languages-counters.mkiv new file mode 100644 index 000000000..fa938d65a --- /dev/null +++ b/tex/context/base/s-languages-counters.mkiv @@ -0,0 +1,30 @@ +%D \module +%D [ file=s-languages-counters, % s-lan-05, +%D version=2011.05.01, % older +%D title=\CONTEXT\ Style File, +%D subtitle=Language Counters, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmodule[languages-counters] + +\registerctxluafile{s-languages-counters}{} + +\installmodulecommandluasingle \showverbosecounters {moduledata.languages.counters.showverbose} + +\stopmodule + +\continueifinputfile{s-languages-counters.mkiv} + +\usemodule[art-01] + +\starttext + + \showverbosecounters[language={en,es}] + +\stoptext diff --git a/tex/context/base/s-languages-frequencies.lua b/tex/context/base/s-languages-frequencies.lua new file mode 100644 index 000000000..16213a412 --- /dev/null +++ b/tex/context/base/s-languages-frequencies.lua @@ -0,0 +1,33 @@ +if not modules then modules = { } end modules ['s-languages-frequencies'] = { + version = 1.001, + comment = "companion to s-languages-frequencies.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.languages = moduledata.languages or { } +moduledata.languages.frequencies = moduledata.languages.frequencies or { } + +function moduledata.languages.frequencies.showlist(specification) + specification = interfaces.checkedspecification(specification) + local t = languages.frequencies.getdata(specification.language or languages.current()) + context.starttabulate { "|lT|cw(2em)|r|" } + context.NC() + context.formatted.rlap("%s: %p",t.language,languages.frequencies.averagecharwidth(t.language)) + context.NC() + context.NC() + context.NR() + context.HL() + for k, v in table.sortedhash(t.frequencies) do + context.NC() + context("%U",k) + context.NC() + context("%c",k) + context.NC() + context("%0.3f",v) + context.NC() + context.NR() + end + context.stoptabulate() +end diff --git a/tex/context/base/s-languages-frequencies.mkiv b/tex/context/base/s-languages-frequencies.mkiv new file mode 100644 index 000000000..01a1f5682 --- /dev/null +++ b/tex/context/base/s-languages-frequencies.mkiv @@ -0,0 +1,38 @@ +%D \module +%D [ file=s-languages-frequencies, % s-lan-06, +%D version=2013.03.22, +%D title=\CONTEXT\ Style File, +%D subtitle=Language Frequencies, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmodule[languages-frequencies] + +\registerctxluafile{s-languages-frequencies}{} + +\installmodulecommandluasingle \showfrequencies {moduledata.languages.frequencies.showlist} + +\stopmodule + +\continueifinputfile{s-languages-frequencies.mkiv} + +\usemodule[art-01] + +\starttext + + \hsize65\averagecharwidth \the\hsize: \input ward \par + + \showfrequencies \page + + \mainlanguage[de] + + \hsize65\averagecharwidth \the\hsize: \input ward \par + + \showfrequencies \page + +\stoptext diff --git a/tex/context/base/s-languages-hyphenation.lua b/tex/context/base/s-languages-hyphenation.lua new file mode 100644 index 000000000..660392f80 --- /dev/null +++ b/tex/context/base/s-languages-hyphenation.lua @@ -0,0 +1,135 @@ +if not modules then modules = { } end modules ['s-languages-hyphenation'] = { + version = 1.001, + comment = "companion to s-languages-hyphenation.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.languages = moduledata.languages or { } +moduledata.languages.hyphenation = moduledata.languages.hyphenation or { } + +local a_colormodel = attributes.private('colormodel') + +local nodecodes = nodes.nodecodes +local nodepool = nodes.pool +local disc = nodecodes.disc +local glyph = nodecodes.glyph +local emwidths = fonts.hashes.emwidths +local exheights = fonts.hashes.exheights +local newkern = nodepool.kern +local newrule = nodepool.rule +local newglue = nodepool.glue + +local insert_node_after = node.insert_after +local traverse_by_id = node.traverse_id +local hyphenate = lang.hyphenate +local find_tail = node.slide +local remove_node = nodes.remove + +local tracers = nodes.tracers +local colortracers = tracers and tracers.colors +local setnodecolor = colortracers.set + +local function identify(head,marked) + local current, prev = head, nil + while current do + local id = current.id + local next = current.next + if id == disc then + if prev and next.id == glyph then -- catch other usage of disc + marked[#marked+1] = prev + end + elseif id == glyph then + prev = current + end + current = next + end +end + +local function strip(head,marked) + for i=1,#marked do + local prev = marked[i] + remove_node(head,prev.next,true) + end +end + +local function mark(head,marked,w,h,d,how) + for i=1,#marked do + local prev = marked[i] + local font = prev.font + local em = emwidths[font] + local ex = exheights[font] + local width = w*em + local rule = newrule(width,h*ex,d*ex) + head, prev = insert_node_after(head,prev,newkern(-width/2)) + head, prev = insert_node_after(head,prev,rule) + head, prev = insert_node_after(head,prev,newkern(-width/2)) + head, prev = insert_node_after(head,prev,newglue(0)) + setnodecolor(rule,how,prev[a_colormodel]) + end +end + +local langs, tags, noflanguages = { }, { }, 0 + +local colorbytag = false + +function moduledata.languages.hyphenation.showhyphens(head) + if noflanguages > 0 then + local marked = { } + for i=1,noflanguages do + local m = { } + local l = langs[i] + marked[i] = m + for n in traverse_by_id(glyph,head) do + n.lang = l + end + hyphenate(head,find_tail(head)) + identify(head,m) + strip(head,m) + end + for i=noflanguages,1,-1 do + local l = noflanguages - i + 1 + mark(head,marked[i],1/16,l/2,l/4,"hyphenation:"..(colorbytag and tags[i] or i)) + end + return head, true + else + return head, false + end +end + +local savedlanguage + +function moduledata.languages.hyphenation.startcomparepatterns(list) + if list and list ~= "" then + tags = utilities.parsers.settings_to_array(list) + end + savedlanguage = tex.language + tex.language = 0 + noflanguages = #tags + for i=1,noflanguages do + langs[i] = tags[i] and languages.getnumber(tags[i]) + end + nodes.tasks.enableaction("processors","moduledata.languages.hyphenation.showhyphens") +end + +function moduledata.languages.hyphenation.stopcomparepatterns() + noflanguages = 0 + tex.language = savedlanguage or tex.language + nodes.tasks.disableaction("processors","moduledata.languages.hyphenation.showhyphens") +end + +function moduledata.languages.hyphenation.showcomparelegend(list) + if list and list ~= "" then + tags = utilities.parsers.settings_to_array(list) + end + for i=1,#tags do + if i > 1 then + context.enspace() + end + context.color( { "hyphenation:"..(colorbytag and tags[i] or i) }, tags[i]) + end +end + +nodes.tasks.appendaction("processors","before","moduledata.languages.hyphenation.showhyphens") +nodes.tasks.disableaction("processors","moduledata.languages.hyphenation.showhyphens") diff --git a/tex/context/base/s-languages-hyphenation.mkiv b/tex/context/base/s-languages-hyphenation.mkiv new file mode 100644 index 000000000..769c3d059 --- /dev/null +++ b/tex/context/base/s-languages-hyphenation.mkiv @@ -0,0 +1,75 @@ +%D \module +%D [ file=s-languages-hyphenation, % s-lan-04, +%D version=2011.05.01, +%D title=\CONTEXT\ Style File, +%D subtitle=Language Hyphenation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D For Mojca. + +\startmodule[languages-hyphenation] + +\registerctxluafile{s-languages-hyphenation}{} + +\unprotect + +\unexpanded\def\startcomparepatterns + {\dosingleempty\module_languages_hyphenation_start} + +\unexpanded\def\module_languages_hyphenation_start[#1]% + {\begingroup + \par + % \language\zerocount + \setupalign[\v!nothyphenated]% + \ctxlua{moduledata.languages.hyphenation.startcomparepatterns("#1")}} + +\unexpanded\def\stopcomparepatterns + {\par + \ctxlua{moduledata.languages.hyphenation.stopcomparepatterns()}% + \endgroup} + +\installmodulecommandluasingle \showcomparepatternslegend {moduledata.languages.hyphenation.showcomparelegend} + +\protect + +\definecolor[hyphenation:1] [r=.8] +\definecolor[hyphenation:2] [g=.8] +\definecolor[hyphenation:3] [b=.8] +\definecolor[hyphenation:4] [r=.4,g=.4] + +\definecolor[hyphenation:en] [hyphenation:1] +\definecolor[hyphenation:de] [hyphenation:2] +\definecolor[hyphenation:nl] [hyphenation:3] +\definecolor[hyphenation:fr] [hyphenation:4] + +\stopmodule + +\continueifinputfile{s-languages-hyphenation.mkiv} + +\usemodule[art-01] + +\starttext + + \startsubject{Normal text} + \input tufte + \stopsubject + + \startsubject{Compare hyphenation points of \showcomparepatternslegend[en,de]} + \startcomparepatterns + \input tufte \quad (\showcomparepatternslegend) + \stopcomparepatterns + \stopsubject + + \startsubject{Compare hyphenation points} + \startcomparepatterns[de,nl,en,fr] + \input tufte \quad (\showcomparepatternslegend) + \stopcomparepatterns + \stopsubject + +\stoptext diff --git a/tex/context/base/scrp-ini.mkiv b/tex/context/base/scrp-ini.mkiv index 289409933..fe62295bb 100644 --- a/tex/context/base/scrp-ini.mkiv +++ b/tex/context/base/scrp-ini.mkiv @@ -75,6 +75,8 @@ \definescript [latin] [\c!method=] % resets the attribute (also currentscript) +\definescript [test] [\c!method=test] + % a new trick (at some point we will predefine more scripts and consider a link with the above) \appendtoks diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex af025dafd..52886b14d 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 515324e4b..165f0a0cc 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index a112d644b..efd84f854 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -4302,6 +4302,21 @@ return { }, { category = "lua", + filename = "s-languages-counters", + status = "okay", + }, + { + category = "lua", + filename = "s-languages-frequencies", + status = "okay", + }, + { + category = "lua", + filename = "s-languages-hyphenation", + status = "okay", + }, + { + category = "lua", filename = "s-languages-sorting", status = "okay", }, @@ -5400,6 +5415,21 @@ return { status = "todo", }, { + category = "lua", + filename = "s-languages-counters", + status = "okay", + }, + { + category = "lua", + filename = "s-languages-frequencies", + status = "okay", + }, + { + category = "lua", + filename = "s-languages-hyphenation", + status = "okay", + }, + { category = "mkiv", filename = "s-languages-sorting", status = "okay", diff --git a/tex/context/base/util-tab.lua b/tex/context/base/util-tab.lua index ecf36b137..a47c0cb77 100644 --- a/tex/context/base/util-tab.lua +++ b/tex/context/base/util-tab.lua @@ -406,9 +406,9 @@ end -- inspect(table.fastserialize { a = 1, b = { 4, { 5, 6 } }, c = { d = 7, e = 'f"g\nh' } }) -function table.load(filename) +function table.load(filename,loader) if filename then - local t = io.loaddata(filename) + local t = (loader or io.loaddata)(filename) if t and t ~= "" then t = load(t) if type(t) == "function" then |