From c6e9f914fe93f3f674c20fded71bf7e18b8df600 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 30 Aug 2009 12:25:00 +0200 Subject: beta 2009.08.30 12:25 --- metapost/context/base/mp-chem.mp | 1 - scripts/context/ruby/base/ctx.rb | 5 + tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/font-ctx.lua | 2 + tex/context/base/font-ini.mkiv | 14 ++- tex/context/base/pack-obj.mkiv | 1 + tex/context/base/pret-xml.lua | 136 ++++++++++++++++++++++++++++ tex/context/base/strc-flt.mkiv | 2 + tex/context/base/strc-num.mkiv | 6 +- tex/context/base/strc-sec.mkiv | 7 +- tex/context/base/strc-syn.lua | 12 ++- tex/context/base/strc-syn.mkiv | 8 +- tex/context/base/syst-aux.mkiv | 17 +++- tex/context/base/syst-ini.tex | 2 +- tex/generic/context/luatex-fonts-merged.lua | 2 +- 16 files changed, 197 insertions(+), 22 deletions(-) create mode 100644 tex/context/base/pret-xml.lua diff --git a/metapost/context/base/mp-chem.mp b/metapost/context/base/mp-chem.mp index 1a5be8416..1537b84cd 100644 --- a/metapost/context/base/mp-chem.mp +++ b/metapost/context/base/mp-chem.mp @@ -726,4 +726,3 @@ def chem_init_all = enddef ; chem_init_all ; - diff --git a/scripts/context/ruby/base/ctx.rb b/scripts/context/ruby/base/ctx.rb index a077297f2..13b4045af 100644 --- a/scripts/context/ruby/base/ctx.rb +++ b/scripts/context/ruby/base/ctx.rb @@ -124,6 +124,11 @@ class CtxRunner report("loading ctx file #{@ctxname}") end + if @xmldata then + # out if a sudden rexml started to be picky about namespaces + @xmldata.gsub!(//,"") + end + begin @xmldata = REXML::Document.new(@xmldata) rescue diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 6f305f989..2c4dba4bb 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{2009.08.28 14:44} +\newcontextversion{2009.08.30 12:25} %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 add7d037e..c4c4523a9 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{2009.08.28 14:44} +\edef\contextversion{2009.08.30 12:25} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index 23f745130..54e724dd0 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['font-ctx'] = { license = "see context related readme files" } +-- needs a cleanup: merge of replace, lang/script etc + local texsprint, count = tex.sprint, tex.count local format, concat, gmatch, match, find, lower = string.format, table.concat, string.gmatch, string.match, string.find, string.lower local tostring, next = tostring, next diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index c39bdb8b7..705cb12d2 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -2731,6 +2731,12 @@ [%mode=node,% liga=yes,kern=yes,tlig=yes,trep=yes,onum=yes] % texligatures=yes,texquotes=yes + +\definefontfeature % == default unless redefined + [ligatures] + [%mode=node,% + liga=yes,kern=yes,tlig=yes,trep=yes] + \definefontfeature % can be used for type1 fonts [complete] [liga=yes,kern=yes,compose=yes,tlig=yes,trep=yes] @@ -2818,10 +2824,10 @@ \def\setfontfeature #1{\edef\currentfeature{#1}\attribute\zerocount\featureattribute{#1}\relax} \def\resetfontfeature#1{\let\currentfeature\empty\attribute\zerocount\zerocount} % initial value -\def\addfontfeaturetoset #1{\ctxlua{fonts.withset("#1", 1)}} -\def\subtractfontfeaturefromset #1{\ctxlua{fonts.withset("#1",-1)}} -\def\addfontfeaturetofont #1{\ctxlua{fonts.withfnt("#1", 2)}} -\def\subtractfontfeaturefromfont#1{\ctxlua{fonts.withfnt("#1",-2)}} +\def\addfontfeaturetoset #1{\ctxlua{fonts.withset("#1", 1)}} % merge +\def\subtractfontfeaturefromset #1{\ctxlua{fonts.withset("#1",-1)}} % merge +\def\addfontfeaturetofont #1{\ctxlua{fonts.withfnt("#1", 2)}} % overload +\def\subtractfontfeaturefromfont#1{\ctxlua{fonts.withfnt("#1",-2)}} % overload \let\setff\setfontfeature \let\addfs\addfontfeaturetoset diff --git a/tex/context/base/pack-obj.mkiv b/tex/context/base/pack-obj.mkiv index 14afef623..cea526ef0 100644 --- a/tex/context/base/pack-obj.mkiv +++ b/tex/context/base/pack-obj.mkiv @@ -304,6 +304,7 @@ %\vss\box\scratchbox \vss\hbox to #4\scaledpoint{\box\scratchbox\hss}% fix Chof \fi\fi}}% + \forcecolorhack % needed in order to use layers etc \box\scratchbox \endgroup} diff --git a/tex/context/base/pret-xml.lua b/tex/context/base/pret-xml.lua new file mode 100644 index 000000000..b11dccb99 --- /dev/null +++ b/tex/context/base/pret-xml.lua @@ -0,0 +1,136 @@ +if not modules then modules = { } end modules ['pret-xml'] = { + version = 1.001, + comment = "companion to buff-ver.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- line by line, no check because can be snippet (educational) and +-- a somewhat simplified view on xml; we forget about dtd's and +-- cdata (some day i'll make a visualizer for valid xml using the +-- built in parser) + +local utf = unicode.utf8 + +local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues +local utfbyte, utffind = utf.byte, utf.find +local rep = string.rep +local texsprint, texwrite = tex.sprint, tex.write +local ctxcatcodes = tex.ctxcatcodes + +local visualizer = buffers.newvisualizer("xml") + +local colors = { + "prettytwo", + "prettyone", + "prettythree", + "prettyfour" +} + +local states = { + ['"']=2, ["'"]=2, + ["-"]=1, ["?"]=1, ["!"]=1, [":"]=1, ["_"]=1, ["/"]=1, +} + +local change_state, finish_state = buffers.change_state, buffers.finish_state + +local state, intag, dotag, inentity, inquote + +function visualizer.reset() + state, intag, dotag, inentity, inquote = 0, false, false, false, false +end + +function visualizer.flush_line(str,nested) + buffers.currentcolors = colors + for c in utfcharacters(str) do + if c == "&" then + inentity = true -- no further checking + state = change_state(3, state) + texwrite(c) + elseif c == ";" then + if inentity then + inentity = false + state = change_state(3, state) + texwrite(c) + state = finish_state(state) + else + texwrite(c) + end + elseif inentity then + state = change_state(3, state) + texwrite(c) + elseif c == " " then + state = finish_state(state) + texsprint(ctxcatcodes,"\\obs") + intag = false + elseif c == "\t" then + state = finish_state(state) + texsprint(ctxcatcodes,"\\obs") + if buffers.visualizers.enabletab then + texsprint(ctxcatcodes,rep("\\obs ",i%buffers.visualizers.tablength)) + end + intag = false + elseif c == "<" then + if intag then + state = finish_state(state) + -- error + else + intag = 1 + dotag = true + state = change_state(1, state) + end + texwrite(c) + elseif c == ">" then + if intag then + texwrite(c) + state = finish_state(state) + intag, dotag = false, false + elseif dotag then + state = change_state(1, state) + texwrite(c) + state = finish_state(state) + intag, dotag = false, false + else + state = finish_state(state) + texwrite(c) + end + elseif intag then + if utffind(c,"^[%S]$") then + state = change_state(1, state) + texwrite(c) + intag = intag + 1 + else + intag = false + state = finish_state(state) + texwrite(c) + end + elseif dotag then + if c == "'" or c == '"' then + if inquote then + if c == inquote then + state = change_state(states[c], state) -- 2 + texwrite(c) + state = finish_state(state) + inquote = false + else + texwrite(c) + end + else + inquote = c + state = change_state(states[c], state) + texwrite(c) + state = finish_state(state) + end + elseif inquote then + texwrite(c) + else + state = change_state(states[c], state) + texwrite(c) + end + else + texwrite(c) + end + end + state = finish_state(state) +end diff --git a/tex/context/base/strc-flt.mkiv b/tex/context/base/strc-flt.mkiv index bb19146a1..2ccf3ea6a 100644 --- a/tex/context/base/strc-flt.mkiv +++ b/tex/context/base/strc-flt.mkiv @@ -734,6 +734,8 @@ % todo: optional user pars +\let\currentfloatattribute\empty % to be checked + \def\floatcaptionattribute {\iflocation \ifnofloatnumber \else \ifnofloatcaption \else attr \destinationattribute \currentfloatattribute diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index 9f6733a6c..b839d3656 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -440,11 +440,15 @@ \xdef\laststructurecountersynchronize{\ctxlatelua{structure.lists.enhance(\laststructurecounternumber)}}% \else \glet\laststructurecounternumber \relax - \glet\laststructurecounterattribute \relax + \glet\laststructurecounterattribute \attributeunsetvalue \glet\laststructurecountersynchronize\relax \fi \endgroup} +\let\laststructurecounternumber \relax +\let\laststructurecounterattribute \relax +\let\laststructurecountersynchronize\relax + \def\dostructurecountersetup#1#2% name \someparameter {\setupstructurecounter [#1] diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index 478fd6ddb..507efc41c 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -652,8 +652,8 @@ % \chapter{some} \setupheadnumber[chapter][3] \chapter{more} % \setupheadnumber[section][8] \section{b} \section{c} \setupheadnumber[section][-1] \section{d} -\def\thecurrentstructureheadlevel#1% - {\getcurrentstructurelevel{#1}} +% \def\thecurrentstructureheadlevel#1% +% {\getcurrentstructurelevel{#1}} \def\thenamedstructureheadlevel#1% {\structuresectionlevel{\structuresectionheadsection{\structuresectionheadcoupling{#1}}}} @@ -677,7 +677,8 @@ {\dosingleempty\dostructureheadnumber} \def\dostructureheadnumber[#1]% simple case is just a number - {\getfullstructurenumber{\iffirstargument\thecurrentstructureheadlevel{#1}\fi}} +% {\getfullstructurenumber{\iffirstargument\thecurrentstructureheadlevel{#1}\fi}} + {\getfullstructurenumber{\iffirstargument\thenamedstructureheadlevel{#1}\fi}} % compatibility code (after all, we might offer different structure handlers as well % but we might as well remove the 'structure' substring at some point (we needed it diff --git a/tex/context/base/strc-syn.lua b/tex/context/base/strc-syn.lua index a99a4a9af..7e2a346eb 100644 --- a/tex/context/base/strc-syn.lua +++ b/tex/context/base/strc-syn.lua @@ -24,7 +24,9 @@ local function initializer() end local function finalizer() - tobesaved.hash = nil + for entry, data in next, tobesaved do + data.hash = nil + end end job.register('joblists.collected', joblists.tobesaved, initializer, finalizer) @@ -137,19 +139,19 @@ end function joblists.flush(data,options) -- maybe pass the settings differently local kind = data.metadata.kind -- hack, will be done better - texsprint(ctxcatcodes,format("\\start%soutput",kind)) +--~ texsprint(ctxcatcodes,format("\\start%soutput",kind)) local result = data.result for k, letter in ipairs(table.sortedkeys(result)) do local sublist = result[letter] local data = sublist.data - texsprint(ctxcatcodes,format("\\start%ssection{%s}",kind,sublist.tag)) +--~ texsprint(ctxcatcodes,format("\\start%ssection{%s}",kind,sublist.tag)) for d=1,#data do local entry = data[d].definition texsprint(ctxcatcodes,format("\\%sentry{%s}{%s}{%s}",kind,d,entry.synonym,entry.meaning)) end - texsprint(ctxcatcodes,format("\\stop%ssection",kind)) +--~ texsprint(ctxcatcodes,format("\\stop%ssection",kind)) end - texsprint(ctxcatcodes,format("\\stop%soutput",kind)) +--~ texsprint(ctxcatcodes,format("\\stop%soutput",kind)) -- for now, maybe at some point we will do a multipass or so data.result = nil data.metadata.sorted = false diff --git a/tex/context/base/strc-syn.mkiv b/tex/context/base/strc-syn.mkiv index a6a7eac71..97073b3e8 100644 --- a/tex/context/base/strc-syn.mkiv +++ b/tex/context/base/strc-syn.mkiv @@ -15,6 +15,9 @@ \registerctxluafile{strc-syn}{1.001} +% todo: add 'define only' option to descriptions, then add sorting (also based on key) +% and call to definition -> replaces this module + \unprotect % general help, can be shared @@ -267,9 +270,8 @@ \presetheadtext[#2=\Word{#2}]% after \ifthirdargument -) %\ctxlua{joblists.define('#1')}% \setvalue{\e!setup #2\e!endsetup}{\dodoubleargument\getparameters[\??so#1]}% to be obsolete - \setvalue{\e!place \e!listof#2}{\doplacelistofsortings{#1}{#2}}% - \setvalue{\e!complete\e!listof#2}{\docompletelistofsortings{#1}{#2}}} - + \setvalue{\e!place \e!listof#2}{\doplacelistofsorts{#1}{#2}}% + \setvalue{\e!complete\e!listof#2}{\docompletelistofsorts{#1}{#2}}} \def\definesort {\dotripleempty\dodefinesort} diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index fe41f0906..3873bf326 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -4131,7 +4131,22 @@ \afterassignment\BeforeGroup \let\next=} -\long\def\HandleNoGroup#1#2% +% \long\def\HandleNoGroup#1#2% +% {\long\def\AfterGroup{#2\egroup}% +% \bgroup\aftergroup\AfterGroup#1} + +\long\def\HandleNoGroup % retrofit into mkii + {\ifnum\currentgrouptype=\@@semisimplegroup + \expandafter\HandleNoGroupA + \else + \expandafter\HandleNoGroupB + \fi} + +\long\def\HandleNoGroupA#1#2% + {\long\def\AfterGroup{#2\endgroup}% + \begingroup\aftergroup\AfterGroup#1} + +\long\def\HandleNoGroupB#1#2% {\long\def\AfterGroup{#2\egroup}% \bgroup\aftergroup\AfterGroup#1} diff --git a/tex/context/base/syst-ini.tex b/tex/context/base/syst-ini.tex index 2a04f1112..0c3770294 100644 --- a/tex/context/base/syst-ini.tex +++ b/tex/context/base/syst-ini.tex @@ -442,7 +442,7 @@ \chardef\@@active = 13 \chardef\active = 13 \chardef\@@comment = 14 -%D Constants to be used with \type {\grouptype}. +%D Constants to be used with \type {\currentgrouptype}. \chardef\@@bottomlevelgroup = 0 \chardef\@@simplegroup = 1 diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 3fc613fb8..ccb86d261 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 : 08/28/09 14:46:34 +-- merge date : 08/30/09 12:27:16 do -- begin closure to overcome local limits and interference -- cgit v1.2.3