diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-01-04 19:48:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-01-04 19:48:00 +0100 |
commit | 20c4037f15e32fe45d05807514f75249d7d416e8 (patch) | |
tree | 95c8263be9c48adac48d89eabf6a24a2b6d883cc /tex | |
parent | 19719774e5f0a521cb21bc09f26a8f82f4dab56c (diff) | |
download | context-20c4037f15e32fe45d05807514f75249d7d416e8.tar.gz |
beta 2010.01.04 19:48
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/bibl-bib.lua | 13 | ||||
-rw-r--r-- | tex/context/base/bibl-bib.mkiv | 6 | ||||
-rw-r--r-- | tex/context/base/bibl-tst.lua | 2 | ||||
-rw-r--r-- | tex/context/base/chem-str.mkiv | 3 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 1 | ||||
-rw-r--r-- | tex/context/base/font-mis.lua | 2 | ||||
-rw-r--r-- | tex/context/base/font-otf.lua | 7 | ||||
-rw-r--r-- | tex/context/base/font-tfm.lua | 2 | ||||
-rw-r--r-- | tex/context/base/lxml-sor.lua | 26 | ||||
-rw-r--r-- | tex/context/base/lxml-sor.mkiv | 4 | ||||
-rw-r--r-- | tex/context/base/lxml-tex.lua | 10 | ||||
-rw-r--r-- | tex/context/base/m-chemic.mkiv | 5 | ||||
-rw-r--r-- | tex/context/base/pack-rul.mkiv | 26 | ||||
-rw-r--r-- | tex/context/base/spac-ver.mkiv | 41 | ||||
-rw-r--r-- | tex/context/base/strc-ref.lua | 36 | ||||
-rw-r--r-- | tex/context/base/strc-ref.mkiv | 9 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 11 |
17 files changed, 161 insertions, 43 deletions
diff --git a/tex/context/base/bibl-bib.lua b/tex/context/base/bibl-bib.lua index 4172e2408..2df2f9507 100644 --- a/tex/context/base/bibl-bib.lua +++ b/tex/context/base/bibl-bib.lua @@ -12,7 +12,7 @@ bibtex files and converts them to xml so that the we access the content in a convenient way. Actually handling the data takes place elsewhere.</p> --ldx]]-- -local lower, format = string.lower, string.format +local lower, format, gsub = string.lower, string.format, string.gsub local next = next local lpegmatch = lpeg.match @@ -125,6 +125,16 @@ end local escaped_pattern = xml.escaped_pattern +local ihatethis = { + f = "\\f", + n = "\\n", + r = "\\r", + s = "\\s", + t = "\\t", + v = "\\v", + z = "\\z", +} + function bibtex.toxml(session) -- we can always speed this up if needed -- format slows down things a bit but who cares @@ -139,6 +149,7 @@ function bibtex.toxml(session) if not entries or entries[name] then result[#result+1] = format(" <e n='%s'>",name) for key, value in next, entry do + value = gsub(value,"\\(.)",ihatethis) value = lpegmatch(escaped_pattern,value) if value ~= "" then result[#result+1] = format(" <v n='%s'>%s</v>",key,value) diff --git a/tex/context/base/bibl-bib.mkiv b/tex/context/base/bibl-bib.mkiv index e0476c473..36ba61d9d 100644 --- a/tex/context/base/bibl-bib.mkiv +++ b/tex/context/base/bibl-bib.mkiv @@ -19,11 +19,13 @@ \def\definebibtexsession [#1]{\ctxlua{commands.definebibtexsession("#1")}} \def\preparebibtexsession [#1]{\ctxlua{commands.preparebibtexsession("#1")}} + \def\registerbibtexfile {\dodoubleargument\doregisterbibtexfile} -\def\doregisterbibtexfile [#1][#2]{\ctxlua{commands.registerbibtexfile("#1","#2")}} % also the fast one \def\registerbibtexentry {\dodoubleargument\doregisterbibtexentry} -\def\doregisterbibtexentry [#1][#2]{\ctxlua{commands.registerbibtexentry("#1","#2")}} % also the fast one \def\applytobibtexsession {\dodoubleargument\doapplytobibtexsession} + +\def\doregisterbibtexfile [#1][#2]{\ctxlua{commands.registerbibtexfile("#1","#2")}} % also the fast one +\def\doregisterbibtexentry [#1][#2]{\ctxlua{commands.registerbibtexentry("#1","#2")}} % also the fast one \def\doapplytobibtexsession[#1][#2]{\xmlprocessregistered{bibtex:#1}{#2}{#2}} \protect \endinput diff --git a/tex/context/base/bibl-tst.lua b/tex/context/base/bibl-tst.lua index a1b85b0f7..5ff8f4570 100644 --- a/tex/context/base/bibl-tst.lua +++ b/tex/context/base/bibl-tst.lua @@ -11,8 +11,8 @@ bibtex.load(session,"texgraph.bib") bibtex.load(session,"texjourn.bib") bibtex.load(session,"texnique.bib") bibtex.load(session,"tugboat.bib") +print(bibtex.size,statistics.elapsedtime(bibtex)) bibtex.toxml(session) - print(bibtex.size,statistics.elapsedtime(bibtex)) --~ print(table.serialize(session.data)) diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv index 29c6fe939..ea8c8827f 100644 --- a/tex/context/base/chem-str.mkiv +++ b/tex/context/base/chem-str.mkiv @@ -100,6 +100,9 @@ \def\dochemicaltext#1% in ppchtex we had a more clever alignment {\dosetchemicaltext\strut#1} % maybe also \setstrut +\def\dochemicaltext#1% + {\mathematics{\dosetchemicaltext\strut\ifcase\currentxfontsize\or\scriptstyle\or\scriptscriptstyle\fi#1}} + \newconditional\indisplaychemical \unexpanded\def\startchemical diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 36f4f375d..f6c578db3 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -151,6 +151,7 @@ \loadmarkfile{pack-rul} \loadmarkfile{lxml-ini} +\loadmarkfile{lxml-sor} \loadmarkfile{strc-ini} \loadmarkfile{strc-doc} diff --git a/tex/context/base/font-mis.lua b/tex/context/base/font-mis.lua index 043560565..c2a733ebb 100644 --- a/tex/context/base/font-mis.lua +++ b/tex/context/base/font-mis.lua @@ -11,7 +11,7 @@ local lower, strip = string.lower, string.strip fonts.otf = fonts.otf or { } -fonts.otf.version = fonts.otf.version or 2.642 +fonts.otf.version = fonts.otf.version or 2.643 fonts.otf.pack = true fonts.otf.cache = containers.define("fonts", "otf", fonts.otf.version, true) diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 1cf514804..d01c5d7e9 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -84,7 +84,7 @@ otf.features.default = otf.features.default or { } otf.enhancers = otf.enhancers or { } otf.glists = { "gsub", "gpos" } -otf.version = 2.642 -- beware: also sync font-mis.lua +otf.version = 2.643 -- beware: also sync font-mis.lua otf.pack = true -- beware: also sync font-mis.lua otf.syncspace = true otf.notdef = false @@ -530,6 +530,7 @@ otf.enhancers["analyse unicodes"] = function(data,filename) end local cidinfo, cidnames, cidcodes = data.cidinfo local usedmap = cidinfo and cidinfo.usedname + usedmap = usedmap and lower(usedmap) usedmap = usedmap and fonts.cid.map[usedmap] if usedmap then oparser = usedmap and fonts.map.make_name_parser(cidinfo.ordering) @@ -551,7 +552,9 @@ otf.enhancers["analyse unicodes"] = function(data,filename) local foundindex = lpegmatch(oparser,name) if foundindex then unicode = cidcodes[foundindex] -- name to number - if not unicode then + if unicode then + originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 + else local reference = cidnames[foundindex] -- number to name if reference then local foundindex = lpegmatch(oparser,reference) diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua index 4bb47cf04..c5140ff7c 100644 --- a/tex/context/base/font-tfm.lua +++ b/tex/context/base/font-tfm.lua @@ -487,7 +487,7 @@ t.colorscheme = tfmtable.colorscheme --~ end local s = sharedkerns[vk] if not s then - local s = {} + s = { } for k,v in next, vk do s[k] = v*hdelta end sharedkerns[vk] = s end diff --git a/tex/context/base/lxml-sor.lua b/tex/context/base/lxml-sor.lua index daeb9ec7b..7aebef79d 100644 --- a/tex/context/base/lxml-sor.lua +++ b/tex/context/base/lxml-sor.lua @@ -60,12 +60,32 @@ function lxml.sorters.show(name) local entries = list and list.entries local NC, NR, bold = context.NC, context.NR, context.bold -- somehow bold is not working if entries then - context.starttabulate { "|Tr|Tr|Tl|" } - NC() bold("n") NC() bold("id") NC() bold("entry") NR() context.HL() + local maxn = 1 + for i=1,#entries do + if #entries[i][2] > maxn then maxn = #entries[i][2] end + end + context.starttabulate { "|Tr|Tr|" .. string.rep("Tlp|",maxn) } + NC() bold("n") + NC() bold("id") + if maxn > 1 then + for i=1,maxn do + NC() bold("entry " .. i) + end + else + NC() bold("entry") + end + NC() NR() + context.HL() for i=1,#entries do local entry = entries[i] local document, node = lxml.splitid(entry[1]) - NC() context(i) NC() context(node) NC() context(concat(entry[2]," ")) NR() + NC() context(i) + NC() context(node) + local e = entry[2] + for i=1,#e do + NC() context.detokenize(e[i]) + end + NC() NR() end context.stoptabulate() end diff --git a/tex/context/base/lxml-sor.mkiv b/tex/context/base/lxml-sor.mkiv index 06ef5b6ab..14425967b 100644 --- a/tex/context/base/lxml-sor.mkiv +++ b/tex/context/base/lxml-sor.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D THIS IS VERY EXPERIMENTAL! + \writestatus{loading}{ConTeXt XML Support / Sorting} \registerctxluafile{lxml-sor}{1.001} @@ -18,7 +20,7 @@ \unprotect \def\xmlresetsorter #1{\ctxlua{lxml.sorters.reset("#1")}} -\def\xmladdsortentry#1#2#3{\ctxlua{lxml.sorters.add("#1","#2","#3")}} +\def\xmladdsortentry#1#2#3{\ctxlua{lxml.sorters.add("#1","#2",\!!bs#3\!!es)}} \def\xmlshowsorter #1{\ctxlua{lxml.sorters.show("#1")}} \def\xmlflushsorter #1#2{\ctxlua{lxml.sorters.flush("#1","#2")}} \def\xmlsortentries #1{\ctxlua{lxml.sorters.sort("#1")}} diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index 9726a5661..a2a295614 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -985,6 +985,14 @@ local function text(collected) end end +local function ctxtext(collected) + if collected then + for c=1,#collected do + texsprint(ctxcatcodes,collected[1].dt) + end + end +end + local function number(collected) if collected then local n = 0 @@ -1031,6 +1039,8 @@ finalizers.count = count finalizers.command = command finalizers.attribute = attribute finalizers.text = text +finalizers.ctxtext = ctxtext +finalizers.context = ctxtext finalizers.position = position finalizers.match = match finalizers.index = index diff --git a/tex/context/base/m-chemic.mkiv b/tex/context/base/m-chemic.mkiv index 4cc1e3bd8..bd4cb093e 100644 --- a/tex/context/base/m-chemic.mkiv +++ b/tex/context/base/m-chemic.mkiv @@ -12,8 +12,9 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\usemodule[pictex] % we will get rid of this +\writestatus{ppchtex}{not loaded as support for chemistry in now built in} -\input ppchtex.mkiv \relax +% \usemodule[pictex] % we will get rid of this +% \input ppchtex.mkiv \relax \endinput diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index bd3a127e3..b0b2592b5 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -770,24 +770,38 @@ %D Because it is used so often the he next macro is (and %D looks) rather optimized. +% \def\s!root{root} % maybe configurable + \let\postprocessframebox\relax \let\@@framed\s!unknown -\def\framedparameter #1{\csname\doframedparameter\@@framed#1\endcsname} +% \def\framedparameter #1{\csname\doframedparameter\@@framed#1\endcsname} +% \def\framedparameterhash#1{\doframedparameterhash \@@framed#1} +% +% \def\doframedparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\doframedparentparameter \csname#1\s!parent\endcsname#2\fi} +% \def\doframedparameterhash#1#2{\ifcsname#1#2\endcsname #1\else\expandafter\doframedparentparameterhash\csname#1\s!parent\endcsname#2\fi} +% +% \def\doframedparentparameter #1#2{\ifx#1\relax\s!empty\else\doframedparameter #1#2\fi} +% \def\doframedparentparameterhash#1#2{\ifx#1\relax \else\doframedparameterhash#1#2\fi} +% +% \def\doframedparentparameter#1#2{\ifx#1\relax\doframedrootparameter#2\else\doframedparameter#1#2\fi} +% \def\doframedrootparameter #1{\ifcsname\??oi#1\endcsname\??oi#1\else\s!empty\fi} + +\def\framedparameter #1{\csname\doframedparameter\@@framed{#1}\endcsname} \def\framedparameterhash#1{\doframedparameterhash \@@framed#1} -\def\doframedparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\doframedparentparameter \csname#1\s!parent\endcsname#2\fi} +\def\doframedparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\doframedparentparameter \csname#1\s!parent\endcsname{#2}\fi} \def\doframedparameterhash#1#2{\ifcsname#1#2\endcsname #1\else\expandafter\doframedparentparameterhash\csname#1\s!parent\endcsname#2\fi} -\def\doframedparentparameter #1#2{\ifx#1\relax\s!empty\else\doframedparameter #1#2\fi} +\def\doframedparentparameter #1#2{\ifx#1\relax\s!empty\else\doframedparameter #1{#2}\fi} \def\doframedparentparameterhash#1#2{\ifx#1\relax \else\doframedparameterhash#1#2\fi} -% \def\s!root{root} % maybe configurable - -\def\doframedparentparameter#1#2{\ifx#1\relax\doframedrootparameter#2\else\doframedparameter#1#2\fi} +\def\doframedparentparameter#1#2{\ifx#1\relax\doframedrootparameter#2\else\doframedparameter#1{#2}\fi} \def\doframedrootparameter #1{\ifcsname\??oi#1\endcsname\??oi#1\else\s!empty\fi} +\def\frameddimension#1{\the\dimexpr\framedparameter{#1}\relax} + \def\dosetframedattributes#1#2% style color {\edef\fontattributehash {\framedparameterhash#1}% \edef\colorattributehash{\framedparameterhash#2}% diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index b6594476a..b0e2603f3 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -113,17 +113,38 @@ \let\currentrelativeinterlinespace\empty +% \def\setuprelativeinterlinespace[#1]% +% {\processallactionsinset +% [#1] +% [ \v!on=>\oninterlineskip, +% \v!off=>\offinterlineskip, +% \v!reset=>\let\currentrelativeinterlinespace\empty +% \let\setrelativeinterlinespace\relax +% \setfontparameters, +% \v!auto=>\let\setrelativeinterlinespace\dosetrelativeinterlinespace, +% \s!unknown=>\assignvalue\commalistelement\currentrelativeinterlinespace{1.00}{1.25}{1.50}% +% \spacing\currentrelativeinterlinespace]} + +\setvalue{\??it::\v!on }{\oninterlineskip} +\setvalue{\??it::\v!off }{\offinterlineskip} +\setvalue{\??it::\v!reset}{\let\currentrelativeinterlinespace\empty + \let\setrelativeinterlinespace\relax + \setfontparameters} +\setvalue{\??it::\v!auto }{\let\setrelativeinterlinespace\dosetrelativeinterlinespace} + +\def\dosetspecifiedrelativeinterlinespace#1% + {\assignvalue{#1}\currentrelativeinterlinespace{1.00}{1.25}{1.50}% + \spacing\currentrelativeinterlinespace} + \def\setuprelativeinterlinespace[#1]% - {\processallactionsinset - [#1] - [ \v!on=>\oninterlineskip, - \v!off=>\offinterlineskip, - \v!reset=>\let\currentrelativeinterlinespace\empty - \let\setrelativeinterlinespace\relax - \setfontparameters, - \v!auto=>\let\setrelativeinterlinespace\dosetrelativeinterlinespace, - \s!unknown=>\assignvalue\commalistelement\currentrelativeinterlinespace{1.00}{1.25}{1.50}% - \spacing\currentrelativeinterlinespace]} + {\processcommalist[#1]\dosetuprelativeinterlinespace} + +\def\dosetuprelativeinterlinespace#1% + {\ifcsname\??it::#1\endcsname + \csname\??it::#1\endcsname + \else + \dosetspecifiedrelativeinterlinespace{#1}% + \fi} \def\dosetrelativeinterlinespace {\ifx\currentrelativeinterlinespace\empty\else diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 001a52a75..7c4efe5ba 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -290,28 +290,52 @@ function jobreferences.whatfrom(name) texsprint(ctxcatcodes,(urls[name] and variables.url) or (files[name] and variables.file) or variables.unknown) end +--~ function jobreferences.from(name) +--~ local u = urls[name] +--~ if u then +--~ local url, file, description = u[1], u[2], u[3] +--~ if description ~= "" then +--~ texsprint(ctxcatcodes,format("\\dofromurldescription{%s}",description)) +--~ -- ok +--~ elseif file and file ~= "" then +--~ texsprint(ctxcatcodes,format("\\dofromurlliteral{%s}",url .. "/" .. file)) +--~ else +--~ texsprint(ctxcatcodes,format("\\dofromurlliteral{%s}",url)) +--~ end +--~ else +--~ local f = files[name] +--~ if f then +--~ local description, file = f[1], f[2] +--~ if description ~= "" then +--~ texsprint(ctxcatcodes,format("\\dofromfiledescription{%s}",description)) +--~ else +--~ texsprint(ctxcatcodes,format("\\dofromfileliteral{%s}",file)) +--~ end +--~ end +--~ end +--~ end + function jobreferences.from(name) local u = urls[name] if u then local url, file, description = u[1], u[2], u[3] if description ~= "" then + context.dofromurldescription(description) -- ok elseif file and file ~= "" then - description = url .. "/" .. file + context.dofromurlliteral(url .. "/" .. file) else - description = url + context.dofromurlliteral(url) end - texsprint(ctxcatcodes,format("\\dofromurl{%s}",description)) else local f = files[name] if f then local description, file = f[1], f[2] if description ~= "" then - -- + context.dofromfiledescription(description) else - description = file + context.dofromfileliteral(file) end - texsprint(ctxcatcodes,format("\\dofromfile{%s}",description)) end end end diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv index 91643fc72..71dd8f6b8 100644 --- a/tex/context/base/strc-ref.mkiv +++ b/tex/context/base/strc-ref.mkiv @@ -1281,13 +1281,16 @@ {\dontleavehmode \goto{\ctxlua{jobreferences.from("#1")}}[fileorurl(#1)]} -\def\dofromurl#1% +\def\dofromurldescription#1% + {#1} + +\def\dofromurlliteral#1% {\dosetfontattribute \??ur\c!style \dosetcolorattribute\??ur\c!color \hyphenatedurl{#1}} -\def\dofromfile#1% - {\hyphenatedurl{#1}} +\let\dofromfiledescription\dofromurldescription +\let\dofromfileliteral \dofromurlliteral % maybe some day setupfile that inherits from url %D We also support: %D diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 6449817db..e6da53fad 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 01/03/10 13:02:01 +-- merge date : 01/04/10 19:52:31 do -- begin closure to overcome local limits and interference @@ -3810,7 +3810,7 @@ t.colorscheme = tfmtable.colorscheme --~ end local s = sharedkerns[vk] if not s then - local s = {} + s = { } for k,v in next, vk do s[k] = v*hdelta end sharedkerns[vk] = s end @@ -5380,7 +5380,7 @@ otf.features.default = otf.features.default or { } otf.enhancers = otf.enhancers or { } otf.glists = { "gsub", "gpos" } -otf.version = 2.642 -- beware: also sync font-mis.lua +otf.version = 2.643 -- beware: also sync font-mis.lua otf.pack = true -- beware: also sync font-mis.lua otf.syncspace = true otf.notdef = false @@ -5826,6 +5826,7 @@ otf.enhancers["analyse unicodes"] = function(data,filename) end local cidinfo, cidnames, cidcodes = data.cidinfo local usedmap = cidinfo and cidinfo.usedname + usedmap = usedmap and lower(usedmap) usedmap = usedmap and fonts.cid.map[usedmap] if usedmap then oparser = usedmap and fonts.map.make_name_parser(cidinfo.ordering) @@ -5847,7 +5848,9 @@ otf.enhancers["analyse unicodes"] = function(data,filename) local foundindex = lpegmatch(oparser,name) if foundindex then unicode = cidcodes[foundindex] -- name to number - if not unicode then + if unicode then + originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 + else local reference = cidnames[foundindex] -- number to name if reference then local foundindex = lpegmatch(oparser,reference) |