diff options
Diffstat (limited to 'tex/context/modules')
-rw-r--r-- | tex/context/modules/mkii/m-quest.mkii | 232 | ||||
-rw-r--r-- | tex/context/modules/mkii/m-streams.mkii | 446 | ||||
-rw-r--r-- | tex/context/modules/mkiv/m-chart.lua | 72 | ||||
-rw-r--r-- | tex/context/modules/mkiv/m-graph.mkiv | 5 | ||||
-rw-r--r-- | tex/context/modules/mkiv/s-inf-01.mkvi | 21 | ||||
-rw-r--r-- | tex/context/modules/mkiv/x-html.mkiv | 4 | ||||
-rw-r--r-- | tex/context/modules/mkiv/x-math-svg.mkvi | 65 |
7 files changed, 803 insertions, 42 deletions
diff --git a/tex/context/modules/mkii/m-quest.mkii b/tex/context/modules/mkii/m-quest.mkii new file mode 100644 index 000000000..596abaa0a --- /dev/null +++ b/tex/context/modules/mkii/m-quest.mkii @@ -0,0 +1,232 @@ +%D \module +%D [ file=m-invull, +%D version=1995.01.10, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Exercise, +%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. + +%I Invuloefeningen kunnen worden vormgegeven met het +%I de commando's: +%I +%I \definieerinvulwoord[trefwoord]{woord,woord} +%I \invulwoord[trefwoord] +%I \invulwoord{woord,woord,...} +%I +%I Daarbij kan het een en ander worden ingesteld met +%I +%I \stelinvullenin[status=,nummer=,links=,rechts=,letter=] +%P +%I Er zijn drie manieren om woorden in te vullen. De meest +%I eenvoudige is die waarbij de in te vullen woorden in de +%I tekst staan. +%I +%I bla bla \invulwoord{een,alfa} bla bla bla bla bla bla +%I bla bla bla bla bla bla bla bla \invulwoord{twee,beta}. +%I +%I De gezette tekst hangt af van de instellingen: +%I +%I [status=leeg] ________ +%I [status=vol,nummer=1] 'een' respectievelijk 'twee' +%I [status=vol,nummer=2] 'alfa' respectievelijk 'beta' +%I +%I Het nummer heeft dus betrekking op het volgnummer in de +%I opgegeven reeks. +%P +%I Bij de tweede manier worden eerste de alternatieven +%I gedefinieerd: +%I +%I \definieerinvulwoord{een,alfa} +%I \definieerinvulwoord{twee,beta} +%I +%I die vervolgens worden opgeroepen: +%I +%I bla \invulwoord[+] bla bla bla bla bla bla bla bla bla +%I bla bla bla bla bla bla bla bla bla bla \invulwoord[+]. +%I +%I De mogelijke instellingen komen overeen met die van de +%I eerste manier. +%P +%I De derde manier is een variant op de tweede. Bij grote +%I teksten kan men het overzicht kwijtraken. Het is daarom +%I mogelijk 'logische' namen toe te kennen aan woorden. +%I +%I \definieerinvulwoord[a]{een,alfa} +%I \definieerinvulwoord[b]{twee,beta} +%I +%I die vervolgens worden opgeroepen: +%I +%I bla \invulwoord[a] bla bla bla bla bla bla bla bla bla +%I bla bla bla bla bla bla bla bla bla bla \invulwoord[b]. +%I +%I Dit maakt het bovendien mogelijk woorden meerdere malen +%I (in een willekeurige volgorde op te roepen: +%I +%I bla \invulwoord[a] bla \invulwoord[b] bla bla bla bla +%I bla bla bla bla \invulwoord[b] bla bla \invulwoord[a]. +%P +%I Bij [status=leeg] wordt een streep gezet die in breedte +%I overeenkomt met het woord dat er eigenlijk hoort te +%I staan. De ingevulde tekst komt visueel daardoor overeen +%I met de in te vullen tekst, wat vergelijken vereenvoudigd. +%I +%I Met [status=reset] worden enkele tellers weer op 0 gezet. +%I Dit kan nodig zijn als meerdere invuloefeningen in een +%I tekst worden gezet. +%I +%I Als \versie[voorlopig] is ingesteld, worden bij invullers +%I zonder logische namen tussen haakjes de volgnummers +%I getoond. + +%S \startsetup +%S \command +%S [stelinvullenin] +%S \type +%S [\c!vars!] +%S \variable +%S [\c!letter] +%S [\v!normaal,\v!vet,\v!schuin,\v!vetschuin,\v!type,\v!kap, +%S \v!klein...,\c!command!] +%S [\v!vet] +%S \variable +%S [\c!links] +%S [\c!text!] +%S [] +%S \variable +%S [\c!rechts] +%S [\c!text!] +%S [] +%S \variable +%S [\c!status] +%S [\v!leeg,\v!vol,\v!reset] +%S [\v!vol] +%S \variable +%S [\c!nummer] +%S [\c!number!] +%S [1] +%S \variable +%S [\c!lijn] +%S [\v!aan,\v!uit] +%S [\v!aan] +%S \stopsetup + +%S \startsetup +%S \command +%S [invulwoord] +%S \type +%S [\c!ref!,\c!opt!\c!val!\c!opt!\c!args!] +%S \value +%S [\c!text!] +%S \stopsetup + +%S \startsetup +%S \command +%S [definieerinvulwoord] +%S \type +%S [\c!ref!,\c!opt!\c!val!\c!args!] +%S \value +%S [\c!text!] +%S \stopsetup + +% Mogelijke uitbreidingen +% +% - [breedte=<maat>,passend,ruim] +% - invullijst met nummers +% - weergeven lijst tijdens definitie blokkeren +% - door elkaar definieren + +\unprotect + +\definesystemvariable {iv} + +\definereferenceconstant {fillin} {:iv:} + +\newcount\invulteller \newcount\invulput \newcount\invulget + +\def\stelinvullenin + {\dosingleargument\dostelinvullenin} + +\def\dostelinvullenin[#1]% + {\getparameters[\??iv][#1]% + \doif\@@ivstate\v!reset + {\global\invulput\zerocount + \global\invulget\zerocount + \let\@@ivstate\empty}} + +\def\definieerinvulwoord + {\dosingleempty\dodefinieerinvulwoord} + +\def\dodefinieerinvulwoord[#1]#2% + {\iffirstargument + \setgvalue{\r!fillin#1}{\simpleinvulwoord{#2}}% + \else + \global\advance\invulput \plusone + \setgvalue{\r!fillin\the\invulput}{\simpleinvulwoord{#2}}% + \fi + \doifconcepttracing + {\ifnum\invulput>\zerocount + \setbox\scratchbox\hbox{~\ttx(\the\invulput)}% + \wd\scratchbox\zeropoint + \box\scratchbox + \par + \fi}} + +\def\dosimpleinvulwoord#1% + {\ifnum\@@ivnumber>\zerocount \advance\invulteller \plusone \fi + \ifnum\invulteller=\@@ivnumber\relax + \bgroup + \doconvertfont\@@ivstyle + {\@@ivleft + \doifelse\@@ivstate\v!empty + {\doifelse\@@ivrule\v!on\leeginvulwoord\geeninvulwoord} + {\doifelse\@@ivrule\v!on\underbar \firstofoneargument}% + {#1}% + \@@ivright}% + \egroup + \fi}% + +\def\simpleinvulwoord#1% + {\ifnum\@@ivnumber>0 + \invulteller\zerocount + \processcommalist[#1]\dosimpleinvulwoord + \else + \dosimpleinvulwoord{#1}% + \fi} + +\def\complexinvulwoord[#1]% + {\bgroup + \doifsomething{#1} + {\global\advance\invulget \plusone + \doconvertfont\@@ivstyle + {\@@ivleft\getvalue{\r!fillin\the\invulget}\@@ivright}} + {\doconvertfont\@@ivstyle + {\@@ivleft\getvalue{\r!fillin #1}\@@ivright}}% + \egroup} + +\definecomplexorsimple\invulwoord + +\def\leeginvulwoord#1% + {{\let\redounderbar\dodounderbar + \def\dodounderbar##1{\redounderbar{\hphantom{##1}}}% + \underbar{#1}}} + +\def\geeninvulwoord#1% + {{\def\dodounderbar##1{\hphantom{##1}}% + \underbar{#1}}} + +% when nummer > 0, then commalist processing; beware of $(1,2)$, use { } there + +\stelinvullenin + [\c!number=0, + \c!style=\v!bold, + \c!rule=\v!on, + \c!left=, + \c!right=, + \c!state=] + +\protect \endinput diff --git a/tex/context/modules/mkii/m-streams.mkii b/tex/context/modules/mkii/m-streams.mkii new file mode 100644 index 000000000..a8589a89c --- /dev/null +++ b/tex/context/modules/mkii/m-streams.mkii @@ -0,0 +1,446 @@ +%D \module +%D [ file=m-streams, +%D version=2006.03.21, +%D title=\CONTEXT\ Modules, +%D subtitle=Streams, +%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 First we implement a simple left||right synchronization +%D mechanism, which we may perfect and extend over time. + +\unprotect + +\defineoutputstream [\v!left] +\defineoutputstream [\v!right] + +\definemarknote[\v!left] +\definemarknote[\v!right] + +\startsetups stream:\v!left:bottom + \flushmarknotes[\v!left] +\stopsetups +\startsetups stream:\v!right:bottom + \flushmarknotes[\v!right] +\stopsetups +\startsetups stream:\v!left:reset + \erasemarknotes[\v!left] +\stopsetups +\startsetups stream:\v!right:reset + \erasemarknotes[\v!right] +\stopsetups + +\def\LeftNote {\setmarknote [\v!left]} % {#1} +\def\RightNote {\setmarknote [\v!right]} % {#1} +\def\SwitchToLeft {\enableoutputstream [\v!left]} +\def\SwitchToRight {\enableoutputstream [\v!right]} +\def\SwitchToNormal {\enableoutputstream [\s!default]} +\def\SynchronizeLeftAndRight{\synchronizeoutputstreams[\v!left,\v!right]} +\def\FlushLeftAndRight {\flushoutputstreampages [\v!left,\v!right]} + +\protect + +% \topskip \strutheight +% \splittopskip\strutheight + +%D Example of usage: +%D +%D \starttyping +%D \nopenalties \setupinterlinespace[top=height] \setupcolors[state=start] +%D +%D \showgrid \showstruts +%D +%D \starttext +%D +%D \title{Whatever} \page +%D +%D \dorecurse {5} { +%D \let\RecurseLevel\recurselevel +%D \SwitchToLeft \dorecurse{10}{\dontleavehmode{\tf\RecurseLevel:l \begstrut \input tufte \endstrut \endgraf}} +%D \SwitchToRight \dorecurse{10}{\dontleavehmode{\sl\RecurseLevel:r \begstrut \input knuth \endstrut \endgraf}} +%D \SwitchToNormal \SynchronizeLeftAndRight +%D \SwitchToLeft \dorecurse{10}{\dontleavehmode{\bf\RecurseLevel:l \begstrut \input zapf \endstrut \endgraf}} +%D \SwitchToRight \dorecurse{10}{\dontleavehmode{\bs\RecurseLevel:r \begstrut \input davis \endstrut \endgraf}} +%D \SwitchToNormal \SynchronizeLeftAndRight +%D } +%D +%D \FlushLeftAndRight +%D +%D \stoptext +%D \stoptyping +%D +%D Another example: +%D +%D \starttyping +%D \nopenalties \setupinterlinespace[top=height] \setupcolors[state=start] +%D +%D \showgrid \showstruts +%D +%D \starttext +%D +%D \SwitchToNormal \FlushLeftAndRight \page +%D +%D \def\StartCouple{\page\SwitchToNormal} +%D \def\StopCouple {\SwitchToNormal \SynchronizeLeftAndRight \FlushLeftAndRight} +%D +%D \def\Original {\SwitchToNormal\SynchronizeLeftAndRight\SwitchToLeft} +%D \def\Translation{\SwitchToRight} +%D +%D \StartCouple +%D \dorecurse{10} { +%D \Original o: \begstrut \inright{\blackrule}\input tufte \endstrut \LeftNote {tufte} \endgraf +%D \Translation t: \begstrut \inleft {\blackrule}\input zapf \endstrut \RightNote{zapf} \endgraf +%D \Original o: \begstrut \inright{\blackrule}\input knuth \endstrut \LeftNote {knuth} \endgraf +%D \Translation t: \begstrut \inleft {\blackrule}\input davis \endstrut \RightNote{davis} \endgraf +%D \Original o: \begstrut \inright{\blackrule}\input douglas \endstrut \LeftNote {douglas} \endgraf +%D \Translation t: \begstrut \inleft {\blackrule}\input bryson \endstrut \RightNote{bryson} \endgraf +%D } +%D \StopCouple +%D \stoptext +%D \stoptyping + +%D Next we implement stream layers. + +\unprotect + +\def\overloadtextwidth#1% + {\makeupwidth#1\relax + \textwidth\makeupwidth + \hsize\makeupwidth} + +\startsetups streamlayer:default:settings + % set hsize etc, like \overloadtextwidth{12cm} +\stopsetups + +\startsetups streamlayer:default:extras + % flush goodies, like local floats +\stopsetups + +\startsetups streamlayer:default:place + \setlayer + [\currentstreamlayer] + [\c!preset=\v!left\v!top] + {\outputstreambox[\currentstreamlayer]}% +\stopsetups + +\startsetups streamlayer:default:copy + \setlayer + [\currentstreamlayer] + [\c!preset=\v!left\v!top] + {\outputstreamcopy[\currentstreamlayer]}% +\stopsetups + +\startsetups streamlayer:default:reset + \outputstreambox[\currentstreamlayer] +\stopsetups + +\startsetups streamlayer:default:flush + \tightlayer[\currentstreamlayer] +\stopsetups + +\def\definestreamlayer + {\dodoubleempty\dodefinestreamlayer} + +\def\dodefinestreamlayer[#1][#2]% + {\defineoutputstream[#1]% + \defineoutputstream[main]% + \definelayer[#1][\c!method=\v!fit,\c!width=\textwidth,#2]} + +\def\dostreamsetups#1% + {\doifsetupselse{streamlayer:\currentstreamlayer:#1} + {\directsetup{streamlayer:\currentstreamlayer:#1}} + {\directsetup{streamlayer:\s!default:#1}}} + +\def\startstreamlayer[#1]% + {\bgroup +% \def\startstreamlayer[##1]{\bgroup\let\stopstreamlayer\egroup}% + \edef\currentstreamlayer{#1}% + \enableoutputstream[main]% + \synchronizeoutput + \enableoutputstream[\currentstreamlayer]% + \bgroup + \dostreamsetups{settings}} + +\def\stopstreamlayer + {\endgraf + \egroup + \disableoutputstream % \enableoutputstream[\s!default]% + \outputstreambox[main]% +% \dostreamsetups{place}% +% \dostreamsetups{extras}% +% \dostreamsetups{flush}% + \egroup} + +\def\preparestreamlayer{\dosingleempty\dopreparestreamlayer} +\def\flushstreamlayer {\dosingleempty\doflushstreamlayer } +\def\placestreamlayer {\dosingleempty\doplacestreamlayer } + +\def\dopreparestreamlayer[#1]% + {\bgroup + \edef\currentstreamlayer{\iffirstargument#1\else\currentstreamlayer\fi}% + \dostreamsetups{place}% + \dostreamsetups{extras}% +% \dostreamsetups{flush}% + \egroup} + +\def\doflushstreamlayer[#1]% + {\bgroup + \edef\currentstreamlayer{\iffirstargument#1\else\currentstreamlayer\fi}% + \dostreamsetups{flush}% + \egroup} + +\def\doplacestreamlayer[#1]% + {\preparestreamlayer[#1]% + \flushstreamlayer[#1]} + +\protect + +%D Usage: + +%D \starttyping +%D \setupinterlinespace[top=height] +%D +%D \setupcolors[state=start] +%D +%D \definestreamlayer[block] +%D +%D \definemeasure[localtextwidth] [\dimexpr.7\textwidth\relax] +%D \definemeasure[localfloatwidth][\dimexpr.3\textwidth-2\bodyfontsize\relax] +%D +%D \startsetups streamlayer:block:settings +%D \hsize=\measure{localtextwidth} +%D \setupfloat[figure][maxwidth=\measure{localfloatwidth}] +%D \stopsetups +%D +%D \startsetups streamlayer:block:extras +%D \setuplocalfloats +%D [before=\blank, +%D after=\blank, +%D inbetween=\blank] +%D \setbox\scratchbox\vbox{\hsize\measure{localfloatwidth}\getlocalfloats} +%D \ifdim\ht\scratchbox>\thelayerheight\currentstreamlayer\relax +%D % more float than text +%D \setlayerframed +%D [\currentstreamlayer] +%D [preset=righttop] +%D [frame=off, +%D offset=overlay] +%D {\box\scratchbox} +%D \else +%D % more text than float +%D \setuplocalfloats +%D [before=\vfill, +%D after=\removedepth\vfill, +%D inbetween=\removedepth\vfill] +%D \setlayerframed +%D [\currentstreamlayer] +%D [preset=righttop] +%D [frame=off, +%D offset=overlay] +%D {\vbox to \thelayerheight\currentstreamlayer {\hsize\measure{localfloatwidth}\getlocalfloats}} +%D \fi +%D \resetlocalfloats +%D \stopsetups +%D +%D \startsetups streamlayer:block:place +%D \setlayerframed +%D [\currentstreamlayer] +%D [preset=lefttop] +%D [frame=off, +%D offset=overlay] +%D {\outputstreambox[\currentstreamlayer]}% +%D \stopsetups +%D +%D \startsetups streamlayer:block:flush +%D \framed +%D [offset=overlay, +%D frame=off, +%D background=color, +%D backgroundcolor=red] +%D {\tightlayer[\currentstreamlayer]} +%D \stopsetups +%D +%D \setupbodyfont[small] +%D +%D \starttext +%D +%D \dorecurse {10} { +%D \startstreamlayer[block] +%D \title{Sample \recurselevel} +%D \input tufte \endgraf +%D \placefigure[local]{}{} +%D \placefigure[local]{}{} +%D \ifodd\recurselevel\relax \placefigure[local]{}{} \fi +%D \startitemize[columns] +%D \item xxx +%D \item xxx +%D \item xxx +%D \item xxx +%D \item xxx +%D \stopitemize +%D \stopstreamlayer +%D \placestreamlayer[block] +%D } +%D +%D \dorecurse {10} { +%D \startstreamlayer[block] +%D \title{Sample \recurselevel} +%D \startcolumns +%D \input tufte +%D \stopcolumns +%D \stopstreamlayer +%D \placestreamlayer[block] +%D } +%D +%D \stoptext +%D \stoptyping + +\def\starttextstreamlayer + {\startstreamlayer} + +\def\stoptextstreamlayer + {\endgraf + % maybe depth if no proper depth and no skip + \removelastskip + \stopstreamlayer} + +\def\placetextstreamlayer{\placestreamlayer} + +%D \starttyping +%D \definestreamlayer[whatever][width=12cm] +%D +%D \startstreamlayer[whatever] +%D \startitemize[columns,two][after=] +%D \item one +%D \item two +%D \item three +%D \item four +%D \stopitemize +%D \stopstreamlayer +%D +%D \framed[strut=no,align=normal]{\placestreamlayer[whatever]\obeydepth} +%D +%D \starttextstreamlayer[whatever] +%D \startitemize[columns,two] +%D \item one +%D \item two +%D \item three +%D \item four +%D \stopitemize +%D \stoptextstreamlayer +%D +%D \framed[strut=no]{\placetextstreamlayer[whatever]} +%D \stoptyping + +\endinput + +\setupinterlinespace[top=height] + +\setupcolors[state=start] + +\definestreamlayer[block] + +\definemeasure[localtextwidth] [\dimexpr.7\textwidth\relax] +\definemeasure[localfloatwidth][\dimexpr.3\textwidth-2\bodyfontsize\relax] + +\startsetups streamlayer:block:settings + \hsize=\measure{localtextwidth} + \setupfloat[figure][maxwidth=\measure{localfloatwidth}] +\stopsetups + +\startsetups streamlayer:block:extras + \setuplocalfloats + [before=\whitespace\blank, + after=\whitespace\blank, + inbetween=\whitespace\blank] + \setbox\scratchbox\vbox{\hsize\measure{localfloatwidth}\getlocalfloats} + \ifdim\ht\scratchbox>\thelayerheight\currentstreamlayer\relax + % more float than text + \setlayerframed + [\currentstreamlayer] + [preset=righttop] + [frame=off, + offset=overlay] + {\box\scratchbox} + \else + % more text than float + \setuplocalfloats + [before=\vfill, + after=\removedepth\vfill, + inbetween=\removedepth\vfill] + \setlayerframed + [\currentstreamlayer] + [preset=righttop] + [frame=off, + offset=overlay] + {\vbox to \thelayerheight\currentstreamlayer {\hsize\measure{localfloatwidth}\getlocalfloats}} + \fi + \resetlocalfloats +\stopsetups + +\startsetups streamlayer:block:place + \setlayerframed + [\currentstreamlayer] + [preset=lefttop] + [frame=off, + offset=overlay] + {\outputstreambox[\currentstreamlayer]}% +\stopsetups + +\startsetups streamlayer:block:flush + \framed + [offset=overlay, + frame=off, + background=color, + backgroundcolor=red] + {\tightlayer[\currentstreamlayer]} +\stopsetups + +\setupbodyfont[small] + +\starttext + +% \definestreamlayer[block] +% +% \startstreamlayer[block] +% \title{Sample \recurselevel} +% \startcolumns +% \dorecurse{4}{\input tufte \par} +% \stopcolumns +% \stopstreamlayer +% \placestreamlayer[block] + +\dorecurse {10} { + \startstreamlayer[block] + \title{Sample \recurselevel} + \input tufte \endgraf + \placefigure[local]{}{} + \placefigure[local]{}{} + \ifodd\recurselevel\relax \placefigure[local]{}{} \fi + \startitemize[columns] + \item xxx + \item xxx + \item xxx + \item xxx + \item xxx + \stopitemize + \stopstreamlayer + \placestreamlayer[block] +} + +\dorecurse {10} { + \startstreamlayer[block] + \title{Sample \recurselevel} + \startcolumns + \input tufte + \stopcolumns + \stopstreamlayer + \placestreamlayer[block] +} + +\stoptext diff --git a/tex/context/modules/mkiv/m-chart.lua b/tex/context/modules/mkiv/m-chart.lua index 549b3c213..5a9311387 100644 --- a/tex/context/modules/mkiv/m-chart.lua +++ b/tex/context/modules/mkiv/m-chart.lua @@ -581,6 +581,7 @@ local function process_connections(chart,xoffset,yoffset) local settings = chart.settings for i=1,#data do local cell = visible(chart,data[i]) +-- local cell = data[i] if cell then local connections = cell.connections for j=1,#connections do @@ -590,7 +591,7 @@ local function process_connections(chart,xoffset,yoffset) if othercell then -- and visible(chart,data[i]) then local cellx, celly = cell.x, cell.y local otherx, othery, location = othercell.x, othercell.y, connection.location - if otherx > 0 and othery > 0 and cellx > 0 and celly > 0 and connection.location then + if otherx > 0 and othery > 0 and cellx > 0 and celly > 0 and location then local what_cell, where_cell, what_other, where_other = lpegmatch(what,location) if what_cell and where_cell and what_other and where_other then local linesettings = settings.line @@ -733,7 +734,6 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny) print("no such chart",chartname) return end --- chart = table.copy(chart) chart = expanded(chart,settings) local chartsettings = chart.settings.chart local autofocus = chart.settings.chart.autofocus @@ -762,6 +762,14 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny) if miny == 0 or y > maxy then maxy = y end end end +-- optional: +if x + nx > maxx then + nx = maxx - x + 1 +end +if y + ny > maxy then + ny = maxy - y + 1 +end + -- -- print("1>",x,y,nx,ny) -- print("2>",minx, miny, maxx, maxy) -- check of window should be larger (maybe autofocus + nx/ny?) @@ -878,9 +886,9 @@ local function makechart(chart) context("flow_chart_offset := %p ;",offset) -- context("flow_reverse_y := true ;") -if chartsettings.option == v_test then - context("flow_draw_test_shapes ;") -end + if chartsettings.option == v_test then + context("flow_draw_test_shapes ;") + end process_cells(chart,0,0) process_connections(chart,0,0) process_texts(chart,0,0) @@ -919,9 +927,9 @@ local function splitchart(chart) if done then last_x = to_x end --- if first_x >= to_x then --- break --- end + -- if first_x >= to_x then + -- break + -- end local part_y = 0 local first_y = from_y while true do @@ -931,31 +939,31 @@ local function splitchart(chart) if done then last_y = to_y end --- if first_y >= to_y then --- break --- end + -- if first_y >= to_y then + -- break + -- end -- -local data = chart.data -for i=1,#data do - local cell = data[i] --- inspect(cell) - local cx, cy = cell.x, cell.y - if cx >= first_x and cx <= last_x then - if cy >= first_y and cy <= last_y then - report_chart("part (%s,%s) of %a is split from (%s,%s) -> (%s,%s)",part_x,part_y,name,first_x,first_y,last_x,last_y) - local x = first_x - local y = first_y - local nx = last_x - first_x + 1 - local ny = last_y - first_y + 1 - context.beforeFLOWsplit() - context.handleFLOWsplit(function() - makechart(getchart(settings,x,y,nx,ny)) -- we need to pass frozen settings ! - end) - context.afterFLOWsplit() - break - end - end -end + local data = chart.data + for i=1,#data do + local cell = data[i] + -- inspect(cell) + local cx, cy = cell.x, cell.y + if cx >= first_x and cx <= last_x then + if cy >= first_y and cy <= last_y then + report_chart("part (%s,%s) of %a is split from (%s,%s) -> (%s,%s)",part_x,part_y,name,first_x,first_y,last_x,last_y) + local x = first_x + local y = first_y + local nx = last_x - first_x + 1 + local ny = last_y - first_y + 1 + context.beforeFLOWsplit() + context.handleFLOWsplit(function() + makechart(getchart(settings,x,y,nx,ny)) -- we need to pass frozen settings ! + end) + context.afterFLOWsplit() + break + end + end + end -- if done then break diff --git a/tex/context/modules/mkiv/m-graph.mkiv b/tex/context/modules/mkiv/m-graph.mkiv index 71af14cc8..8946732d0 100644 --- a/tex/context/modules/mkiv/m-graph.mkiv +++ b/tex/context/modules/mkiv/m-graph.mkiv @@ -26,6 +26,7 @@ \startMPdefinitions{graph} loadmodule "grap" ; +% input mp-grap.mpiv ; \stopMPdefinitions \protect @@ -71,8 +72,6 @@ label.rt(formatted("(@j,@j)",(1.23,4.56)),(0cm,-5.0cm)) ; \stopMPpage -\stoptext - % \startMPpage[instance=graph] % draw begingraph(3in,2in); % gdraw "t:/metapost/grphdata/agepop91.d"; @@ -131,3 +130,5 @@ % autogrid(otick.bot,otick.rt); % endgraph; % \stopMPpage + +\stoptext diff --git a/tex/context/modules/mkiv/s-inf-01.mkvi b/tex/context/modules/mkiv/s-inf-01.mkvi index 2c0c1681e..2fda9997a 100644 --- a/tex/context/modules/mkiv/s-inf-01.mkvi +++ b/tex/context/modules/mkiv/s-inf-01.mkvi @@ -39,7 +39,7 @@ "colo%-pan.tex", ".*test.*" } local types = { - "tex", "mkii", "mkiv", "mkvi", "lua" + "tex", "mkii", "mkiv", "mkvi", "lua", -- "mpiv" } local patterns = { "^([a-z][a-z][a-z][a-z])%-[a-z0-9%-]+%.[a-z]+", @@ -150,7 +150,7 @@ for k, v in table.sortedpairs(what) do local c = what == size and comp[k] or nope context.NC() - context("%s~%s~~%s~~%s", + context("\\bf %s~%s~~%s~~%s", (used.mkii[k] and "ii") or "~~", (used.mkiv[k] and "iv") or "~~", (used.mkvi[k] and "vi") or "~~", @@ -197,7 +197,7 @@ \starttexdefinition Top #what#fraction#total#bigones \hbox to 5em{\hss#total}% \enspace - \hbox {#what\ifnum#total=#bigones\else~#bigones\rlap{~+}\fi\hss}% + \hbox {{\bf#what}\ifnum#total=#bigones\else~#bigones\rlap{~+}\fi\hss}% \stoptexdefinition \starttexdefinition Bar #color#size#nobigones#fraction @@ -225,19 +225,26 @@ \stoptexdefinition \starttexdefinition Up #color#width - \scratchdimen#width\dimexpr 16em\relax +% \scratchdimen#width\dimexpr 16em\relax + \scratchdimen#width\dimexpr 40em\relax \ifdim\scratchdimen=\zeropoint \kern1em + \else\ifdim\scratchdimen>13em + \blackrule[color=bar:#color,height=15em,width=1em]% + \hskip-1.1em + \blackrule[color=white,height=14em,width=1.2em]% + \hskip-1.1em + \blackrule[color=bar:#color,height=13em,width=1em]% \else \ifdim\scratchdimen<\onepoint \scratchdimen\onepoint \fi \blackrule[color=bar:#color,height=\scratchdimen,width=1em]% - \fi + \fi\fi \stoptexdefinition \starttexdefinition Show #title#how#what \startTEXpage[offset=1em,width=fit] \hbox{\tttf\strut\currentdate~-~#title} - \par + \blank[line] \ctxlua{document.context_state_\number#how("#what")} \stopTEXpage \stoptexdefinition @@ -249,7 +256,7 @@ {The number of files used in ConTeXt (base modules and styles).} {1}{number} \Show - {The size of (core) files used in ConTeXt (- indicates exclusion of large data files; + indicates inclusion of large data files; comment and spaces removed.)} + {The size of (core) files used in ConTeXt (- : large data files excluded; + : large data files included; comment and spaces removed)} {1}{size} \Show {The relative number of files used in ConTeXt (tex, mkii, mkiv, mkvi, lua).} diff --git a/tex/context/modules/mkiv/x-html.mkiv b/tex/context/modules/mkiv/x-html.mkiv index e1806eb9e..723872dfd 100644 --- a/tex/context/modules/mkiv/x-html.mkiv +++ b/tex/context/modules/mkiv/x-html.mkiv @@ -148,9 +148,11 @@ % % we can also use \xmlmap for border etc +% \registerctxluafile{lxml-css}{1.001} + \starttexdefinition cssgetsinglepadding #1 \ctxlua { - context((moduledata.css.padding( + context((xml.css.padding( "#1", \number\dimexpr0.1ex, \number\dimexpr0.01\hsize, diff --git a/tex/context/modules/mkiv/x-math-svg.mkvi b/tex/context/modules/mkiv/x-math-svg.mkvi new file mode 100644 index 000000000..4645f75d8 --- /dev/null +++ b/tex/context/modules/mkiv/x-math-svg.mkvi @@ -0,0 +1,65 @@ +%D \module +%D [ file=x-math-svg, +%D version=2014.09.19, +%D title=\CONTEXT\ XML Modules, +%D subtitle=\MATHML\ to \SVG, +%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 XML Macros / MathML to SVG Converter} + +\usemodule[x][mathml] + +\registerctxluafile{x-math-svg}{} + +\starttexdefinition MakeSVGMath #index#page#mode + \setbox\scratchbox\hbox\bgroup + \xmlprocessbuffer{main}{math-#page}{} + \egroup + \ctxlua { + moduledata.svgmath.register(#index, #page, { + mode = "#mode", + width = \number\wd\scratchbox, + height = \number\ht\scratchbox, + depth = \number\dp\scratchbox, + } ) + } + \startTEXpage + \box\scratchbox + \stopTEXpage +\stoptexdefinition + +\starttexdefinition ReuseSVGMath #index#page + \ctxlua { + moduledata.svgmath.register(#index,#page) + } +\stoptexdefinition + +% assume the same font .. what to do with size + +\startluacode + + local svgstyle = document.arguments.svgstyle or "" + + if type(svgstyle) == "string" and svgstyle ~= "" then + context.environment { svgstyle } + else + context.setupbodyfont { "pagella" } + end + +\stopluacode + +% \continueifinputfile{x-math-svg.mkvi} + +\starttext + + \startluacode + moduledata.svgmath.process(environment.arguments.inputfile) + \stopluacode + +\stoptext |