From 48d928765209d3a13f205bb89ece46dabc30fdff Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 22 Jul 2011 02:40:13 +0300 Subject: beta 2011.07.22 01:29 --- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 3 +- tex/context/base/data-tex.lua | 7 ++ tex/context/base/file-job.lua | 73 ++++++++++---------- tex/context/base/file-job.mkvi | 19 ++++-- tex/context/base/m-markdown.mkiv | 2 +- tex/context/base/meta-imp-fen.mkiv | 40 ++++++++++- tex/context/base/pack-fen.mkiv | 75 +++++++++++++++++++++ tex/context/base/pack-rul.mkiv | 18 ++--- tex/context/base/status-files.pdf | Bin 23801 -> 23778 bytes tex/context/base/status-lua.pdf | Bin 162205 -> 162201 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 14 files changed, 184 insertions(+), 61 deletions(-) create mode 100644 tex/context/base/pack-fen.mkiv diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index e59582530..51b1adfd6 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.07.21 19:17} +\newcontextversion{2011.07.22 01:29} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 13cc66be2..60229019e 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{2011.07.21 19:17} +\newcontextversion{2011.07.22 01:29} %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.mkii b/tex/context/base/context.mkii index f9e00a44c..2488232d9 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.07.21 19:17} +\edef\contextversion{2011.07.22 01:29} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 8bf36d10f..67aa0fe4e 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.07.21 19:17} +\edef\contextversion{2011.07.22 01:29} %D For those who want to use this: @@ -192,6 +192,7 @@ \loadmkvifile{pack-mis} \loadmarkfile{pack-rul} +\loadmarkfile{pack-fen} \loadmarkfile{lxml-ini} \loadmarkfile{lxml-sor} diff --git a/tex/context/base/data-tex.lua b/tex/context/base/data-tex.lua index 4b3fba33b..bf4e30413 100644 --- a/tex/context/base/data-tex.lua +++ b/tex/context/base/data-tex.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['data-tex'] = { license = "see context related readme files" } +local char = string.char + local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) local report_tex = logs.reporter("resolvers","tex") @@ -46,6 +48,9 @@ appendgroup(textlineactions,"before") -- user appendgroup(textlineactions,"system") -- private appendgroup(textlineactions,"after" ) -- user +local ctrl_d = char( 4) -- unix +local ctrl_z = char(26) -- windows + function helpers.textopener(tag,filename,filehandle,coding) local lines local t_filehandle = type(filehandle) @@ -111,6 +116,8 @@ function helpers.textopener(tag,filename,filehandle,coding) return nil elseif content == "" then return "" + -- elseif content == ctrl_d or ctrl_z then + -- return nil -- we need this as \endinput does not work in prints else if textlineactions.dirty then lineprocessor = sequencers.compile(textlineactions) -- maybe use autocompile diff --git a/tex/context/base/file-job.lua b/tex/context/base/file-job.lua index 4c7811fc5..8c9b69527 100644 --- a/tex/context/base/file-job.lua +++ b/tex/context/base/file-job.lua @@ -400,25 +400,25 @@ luatex.registerstopactions(logtree) -- product : combination of components local processors = utilities.storage.allocate { - [v_outer] = { - [v_text] = { "many", context.processfilemany }, - [v_project] = { "once", context.processfileonce }, - [v_environment] = { "once", context.processfileonce }, - [v_product] = { "many", context.processfileonce }, - [v_component] = { "many", context.processfilemany }, - }, + -- [v_outer] = { + -- [v_text] = { "many", context.processfilemany }, + -- [v_project] = { "once", context.processfileonce }, + -- [v_environment] = { "once", context.processfileonce }, + -- [v_product] = { "many", context.processfileonce }, + -- [v_component] = { "many", context.processfilemany }, + -- }, [v_text] = { [v_text] = { "many", context.processfilemany }, - [v_project] = { "once", context.processfileonce }, -- none * + [v_project] = { "none", context.processfileonce }, -- none [v_environment] = { "once", context.processfileonce }, -- once - [v_product] = { "once", context.processfileonce }, -- none * + [v_product] = { "none", context.processfileonce }, -- none [v_component] = { "many", context.processfilemany }, -- many }, [v_project] = { [v_text] = { "many", context.processfilemany }, [v_project] = { "none", context.processfilenone }, -- none [v_environment] = { "once", context.processfileonce }, -- once - [v_product] = { "none", context.processfilenone }, -- once * + [v_product] = { "once", context.processfilenone }, -- once [v_component] = { "none", context.processfilenone }, -- many * }, [v_environment] = { @@ -432,7 +432,7 @@ local processors = utilities.storage.allocate { [v_text] = { "many", context.processfilemany }, [v_project] = { "once", context.processfileonce }, -- once [v_environment] = { "once", context.processfileonce }, -- once - [v_product] = { "many", context.processfilemany }, -- none * + [v_product] = { "none", context.processfilemany }, -- none [v_component] = { "many", context.processfilemany }, -- many }, [v_component] = { @@ -468,29 +468,29 @@ local function topofstack(what) end local done = { } -local tolerant = true +local tolerant = false -- too messy, mkii user with the wrong sructure should adapt local function process(what,name) local depth = #typestack local process - if not tolerant then +-- if not tolerant then -- okay, would be best but not compatible with mkii process = processors[currenttype][what] - elseif depth == 0 then - -- could be a component, product or (brr) project - if trace_jobfiles then - report_jobfiles("%s : %s > %s (case 1)",depth,currenttype,v_outer) - end - process = processors[v_outer][what] - elseif depth == 1 and typestack[1] == v_text then - -- we're still not doing a component or product - if trace_jobfiles then - report_jobfiles("%s : %s > %s (case 2)",depth,currenttype,v_outer) - end - process = processors[v_outer][what] - else - process = processors[currenttype][what] - end +-- elseif depth == 0 then +-- -- could be a component, product or (brr) project +-- if trace_jobfiles then +-- report_jobfiles("%s : %s > %s (case 1)",depth,currenttype,v_outer) +-- end +-- process = processors[v_outer][what] +-- elseif depth == 1 and typestack[1] == v_text then +-- -- we're still not doing a component or product +-- if trace_jobfiles then +-- report_jobfiles("%s : %s > %s (case 2)",depth,currenttype,v_outer) +-- end +-- process = processors[v_outer][what] +-- else +-- process = processors[currenttype][what] +-- end if process then local method = process[1] if method == "none" then @@ -533,15 +533,17 @@ function commands.usecomponent (name) process(v_component, name) end -- -- todo: setsystemmode to currenttype local start = { - [v_project] = context.starttext, - [v_product] = context.starttext, - [v_component] = context.starttext, + [v_project] = context.starttext, + [v_product] = context.starttext, + [v_component] = context.starttext, + [v_environment] = nil, } local stop = { - [v_project] = context.stoptext, - [v_product] = context.stoptext, - [v_component] = context.stoptext, + [v_project] = function() context.stoptext() context.signalendofinput(v_project) end, + [v_product] = function() context.stoptext() context.signalendofinput(v_product) end, + [v_component] = function() context.stoptext() context.signalendofinput(v_component) end, + [v_environment] = function() context.signalendofinput(v_environment) end, } local function gotonextlevel(what,name) -- todo: something with suffix name @@ -564,7 +566,8 @@ local function gotopreviouslevel(what) currentpath = remove(pathstack) or "." currenttype = remove(typestack) or v_text remove(stacks[what]) -- not currenttype ... weak recovery - context.endinput() + -- context.endinput() -- does not work + context.signalendofinput(what) end function commands.startproject (name) gotonextlevel(v_project, name) end diff --git a/tex/context/base/file-job.mkvi b/tex/context/base/file-job.mkvi index b33bb9e19..47509754b 100644 --- a/tex/context/base/file-job.mkvi +++ b/tex/context/base/file-job.mkvi @@ -137,10 +137,21 @@ \unexpanded\def\dostartcomponent [#name]{\ctxcommand{startcomponent ("#name")}} \unexpanded\def\dostartenvironment[#name]{\ctxcommand{startenvironment("#name")}} -\unexpanded\def\stopproject {\ctxcommand{stopproject ()}} -\unexpanded\def\stopproduct {\ctxcommand{stopproduct ()}} -\unexpanded\def\stopcomponent {\ctxcommand{stopcomponent ()}} -\unexpanded\def\stopenvironment {\ctxcommand{stopenvironment()}} +\newconditional\endofinput % hack, needed because \endinput happens one level down in the input when we write from lua + +\unexpanded\def\signalendofinput#1% argument just for tracing + {\global\settrue\endofinput} + +\unexpanded\def\honorendofinput + {\ifconditional\endofinput + \global\setfalse\endofinput + \endinput + \fi} + +\unexpanded\def\stopproject {\ctxcommand{stopproject ()}\honorendofinput} +\unexpanded\def\stopproduct {\ctxcommand{stopproduct ()}\honorendofinput} +\unexpanded\def\stopcomponent {\ctxcommand{stopcomponent ()}\honorendofinput} +\unexpanded\def\stopenvironment {\ctxcommand{stopenvironment()}\honorendofinput} \def\currentproject {\ctxcommand{currentproject ()}} \def\currentproduct {\ctxcommand{currentproduct ()}} diff --git a/tex/context/base/m-markdown.mkiv b/tex/context/base/m-markdown.mkiv index ac862abaa..71bc3442f 100644 --- a/tex/context/base/m-markdown.mkiv +++ b/tex/context/base/m-markdown.mkiv @@ -49,7 +49,7 @@ \definedelimitedtext [markdownblockquote] - [markdownquotation] + [quotation] \definehighlight [markdownemphasis] diff --git a/tex/context/base/meta-imp-fen.mkiv b/tex/context/base/meta-imp-fen.mkiv index e130f0636..307a59b4d 100644 --- a/tex/context/base/meta-imp-fen.mkiv +++ b/tex/context/base/meta-imp-fen.mkiv @@ -15,7 +15,7 @@ %D \CONTEXT\ list and due to request by Aditya has been turned into %D library. -\startMPinclusions +\startMPextensions vardef BasicBraceSymbol (expr rotation) = save p ; path p ; z1 = (-233, 0) ; @@ -52,6 +52,18 @@ p := p ysized 100 ; p shifted - center p enddef ; + vardef RawLeftBraceSymbol = + fill BasicBraceSymbol(0) ysized OverlayHeight withcolor OverlayColor ; + enddef ; + vardef RawRightBraceSymbol = + fill BasicBraceSymbol(180) ysized OverlayHeight withcolor OverlayColor ; + enddef ; + vardef RawTopBraceSymbol = + fill BasicBraceSymbol(270) xsized OverlayWidth withcolor OverlayColor ; + enddef ; + vardef RawBottomBraceSymbol = + fill BasicBraceSymbol(90) xsized OverlayWidth withcolor OverlayColor ; + enddef ; vardef LeftBraceSymbol = save p, b ; path p, b ; b := fullsquare xscaled OverlayWidth yscaled OverlayHeight ; setbounds currentpicture to b ; @@ -80,7 +92,12 @@ fill p shifted (0,ypart lrcorner currentpicture - ypart lrcorner p) withcolor OverlayColor ; setbounds currentpicture to b ; enddef ; -\stopMPinclusions +\stopMPextensions + +\startuniqueMPgraphic{raw_brace_left} RawLeftBraceSymbol ; \stopuniqueMPgraphic +\startuniqueMPgraphic{raw_brace_right} RawRightBraceSymbol ; \stopuniqueMPgraphic +\startuniqueMPgraphic{raw_brace_top} RawTopBraceSymbol ; \stopuniqueMPgraphic +\startuniqueMPgraphic{raw_brace_bottom} RawBottomBraceSymbol ; \stopuniqueMPgraphic \startuniqueMPgraphic{brace_left} LeftBraceSymbol ; \stopuniqueMPgraphic \startuniqueMPgraphic{brace_right} RightBraceSymbol ; \stopuniqueMPgraphic @@ -92,10 +109,29 @@ \defineoverlay[topbrace] [\uniqueMPgraphic{brace_top}] \defineoverlay[bottombrace][\uniqueMPgraphic{brace_bottom}] +\installleftframerenderer {brace}{\uniqueMPgraphic{raw_brace_left}} +\installrightframerenderer {brace}{\uniqueMPgraphic{raw_brace_right}} +\installtopframerenderer {brace}{\uniqueMPgraphic{raw_brace_top}} +\installbottomframerenderer{brace}{\uniqueMPgraphic{raw_brace_bottom}} + \continueifinputfile{meta-imp-fen.mkiv} \starttext +\startTEXpage[offset=10pt] + + \framed + [offset=1ex, + leftframe=brace, + rightframe=brace, + topframe=brace, + bottomframe=brace, + background=color, + backgroundcolor=red] + {OEPS} + +\stopTEXpage + \startTEXpage \uniqueMPgraphic{brace_left} \stopTEXpage \startTEXpage \uniqueMPgraphic{brace_right} \stopTEXpage \startTEXpage \uniqueMPgraphic{brace_top} \stopTEXpage diff --git a/tex/context/base/pack-fen.mkiv b/tex/context/base/pack-fen.mkiv new file mode 100644 index 000000000..ad25e130e --- /dev/null +++ b/tex/context/base/pack-fen.mkiv @@ -0,0 +1,75 @@ +%D \module +%D [ file=pack-fen, +%D version=2011.07.21, +%D title=\CONTEXT\ Packaging Macros, +%D subtitle= Fences for Ruled Content, +%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. + +\writestatus{loading}{ConTeXt Packaging Macros / Fences for Ruled Content} + +% we can move the main fences here too + +\unprotect + +\def\installleftframerenderer#1#2% + {\setvalue{l\@@frame@@\v!on#1}{\whateverleftframe{#2}}% + \expandafter\let\csname l\@@frame@@\v!off#1\expandafter\endcsname\csname l\@@frame@@\v!on#1\endcsname} + +\def\installrightframerenderer#1#2% + {\setvalue{r\@@frame@@\v!on#1}{\whateverrightframe{#2}}% + \expandafter\let\csname r\@@frame@@\v!off#1\expandafter\endcsname\csname r\@@frame@@\v!on#1\endcsname} + +\def\installtopframerenderer#1#2% + {\setvalue{t\@@frame@@\v!on#1}{\whatevertopframe{#2}}% + \expandafter\let\csname t\@@frame@@\v!off#1\expandafter\endcsname\csname t\@@frame@@\v!on#1\endcsname} + +\def\installbottomframerenderer#1#2% + {\setvalue{b\@@frame@@\v!on#1}{\whateverbottomframe{#2}}% + \expandafter\let\csname b\@@frame@@\v!off#1\expandafter\endcsname\csname b\@@frame@@\v!on#1\endcsname} + +\def\setinstalledframedimensions + {\edef\overlayheight{\the\dimexpr\frameddimenht+\frameddimendp}% + \edef\overlaywidth {\the\frameddimenwd}} + +\newbox\specialframebox + +\def\whateverleftframe#1% + {\setinstalledframedimensions + \setbox\specialframebox\vbox to \overlayheight{\vss#1\vss}% + \setbox\specialframebox\hbox to \zeropoint{\box\specialframebox\hss}% + \ht\specialframebox\zeropoint + \dp\specialframebox\zeropoint + \box\specialframebox} + +\def\whateverrightframe#1% + {\setinstalledframedimensions + \setbox\specialframebox\vbox to \overlayheight{\vss#1\vss}% + \setbox\specialframebox\hbox to \zeropoint{\hss\box\specialframebox}% + \ht\specialframebox\zeropoint + \dp\specialframebox\zeropoint + \box\specialframebox} + +\def\whatevertopframe#1% + {\setinstalledframedimensions + \setbox\specialframebox\hbox to \overlaywidth{\hss#1\hss}% + \setbox\specialframebox\vbox to \zeropoint{\box\specialframebox\vss}% + \ht\specialframebox\zeropoint + \dp\specialframebox\zeropoint + \box\specialframebox + \nointerlineskip} + +\def\whateverbottomframe#1% + {\setinstalledframedimensions + \setbox\specialframebox\hbox to \overlaywidth{\hss#1\hss}% + \setbox\specialframebox\vbox to \zeropoint{\vss\box\specialframebox}% + \ht\specialframebox\zeropoint + \dp\specialframebox\zeropoint + \box\specialframebox} + +\protect \endinput diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index c07331a8b..1afc498a3 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -476,18 +476,21 @@ \dostrokedroundbox \fi\fi} -\def\dostrokedlinedbox + +\def\dostrokedlinedbox % will move to pack-rul {\setbox\scratchbox\emptyhbox \wd\scratchbox\frameddimenwd \ht\scratchbox\frameddimenht \dp\scratchbox\frameddimendp \setbox\scratchbox\vbox \bgroup \csname t\@@frame@@\framedparameter\c!frame\framedparameter\c!topframe \endcsname +\nointerlineskip % new (needed for fences), maybe \offinterlineskip \hbox \bgroup \csname l\@@frame@@\framedparameter\c!frame\framedparameter\c!leftframe \endcsname \box\scratchbox \csname r\@@frame@@\framedparameter\c!frame\framedparameter\c!rightframe \endcsname \egroup +\nointerlineskip % new (needed for fences) \csname b\@@frame@@\framedparameter\c!frame\framedparameter\c!bottomframe\endcsname \egroup \wd\scratchbox\frameddimenwd @@ -497,19 +500,6 @@ \def\@@frame@@{@@frame@@} -% \setvalue{t\@@frame@@\v!on \v!on}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth} -% \setvalue{t\@@frame@@\v!off\v!on}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth} -% \setvalue{t\@@frame@@\v!on }{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth} -% \setvalue{b\@@frame@@\v!on \v!on}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth} -% \setvalue{b\@@frame@@\v!off\v!on}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth} -% \setvalue{b\@@frame@@\v!on }{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth} -% \setvalue{l\@@frame@@\v!on \v!on}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth} -% \setvalue{l\@@frame@@\v!off\v!on}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth} -% \setvalue{l\@@frame@@\v!on }{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth} -% \setvalue{r\@@frame@@\v!on \v!on}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth} -% \setvalue{r\@@frame@@\v!off\v!on}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth} -% \setvalue{r\@@frame@@\v!on }{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth} - \def\@@frame@@trule{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth} \def\@@frame@@brule{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth} \def\@@frame@@rrule{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 2ddaeab2c..c7141d863 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 025410651..90891fed7 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b1d46ed0b..f576220d3 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/21/11 19:17:10 +-- merge date : 07/22/11 01:29:16 do -- begin closure to overcome local limits and interference -- cgit v1.2.3