diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-10-24 21:26:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-10-24 21:26:00 +0200 |
commit | dff2745dae03ba945f2de644fb53218a47044e08 (patch) | |
tree | 74089de409cb9c40b52067e815e935029e817586 | |
parent | 833cf5633ca02333e5a4880647cc3e69b71a314f (diff) | |
download | context-dff2745dae03ba945f2de644fb53218a47044e08.tar.gz |
beta 2011.10.24 21:26
72 files changed, 1039 insertions, 1393 deletions
diff --git a/metapost/context/base/mp-char.mpiv b/metapost/context/base/mp-char.mpiv index 91d50b912..28fe41512 100644 --- a/metapost/context/base/mp-char.mpiv +++ b/metapost/context/base/mp-char.mpiv @@ -16,6 +16,9 @@ %D when used in \CONTEXT\ but it does not pay off now to look into %D that. +%D For historic reason we first build and then flush but we could +%D as well flush directly which would save us caching. + if unknown context_shap : input "mp-shap.mpiv" ; fi ; if known context_flow : endinput ; fi ; @@ -73,6 +76,10 @@ numeric flow_shape_left ; flow_shape_left := 67 ; numeric flow_shape_up ; flow_shape_up := 68 ; numeric flow_shape_down ; flow_shape_down := 69 ; +numeric flow_label_offset ; flow_label_offset := 0 ; +numeric flow_exit_offset ; flow_exit_offset := 0 ; +numeric flow_comment_offset ; flow_comment_offset := 0 ; + % vardef some_shape_path (expr type) == imported from mp-shap def flow_show_shapes(expr n) = @@ -107,6 +114,9 @@ def flow_new_chart = flow_connection_smooth_size := 5pt ; flow_connection_arrow_size := 4pt ; flow_connection_dash_size := 3pt ; + flow_label_offset := 0 ; + flow_exit_offset := 0 ; + flow_comment_offset := 0 ; flow_max_x := 6 ; flow_max_y := 4 ; @@ -135,17 +145,9 @@ def flow_new_chart = numeric flow_xyline [][] ; boolean flow_xypeep [][] ; picture flow_xytext [][] ; - picture flow_xylabel_l [][] ; - picture flow_xylabel_r [][] ; - picture flow_xylabel_t [][] ; - picture flow_xylabel_b [][] ; - picture flow_xyexit_l [][] ; - picture flow_xyexit_r [][] ; - picture flow_xyexit_t [][] ; - picture flow_xyexit_b [][] ; - picture flow_xycomment_txt[][][][] ; - string flow_xycomment_loc[][][][] ; - numeric flow_xycomment_len[][][][] ; + picture flow_xylabel [][] ; + picture flow_xyexit [][] ; + picture flow_xycomment [][] ; path flow_cpaths [] ; numeric flow_cline [] ; color flow_ccolor [] ; @@ -156,7 +158,7 @@ def flow_new_chart = picture flow_bpicture [][] ; picture flow_lpicture [][] ; picture flow_rpicture [][] ; - path flow_centers [][][] ; + path flow_connections[][][] ; predefined_shapes[61] := (fullcircle scaled (1.5*predefined_shapes_yradius) xscaled (flow_grid_height/flow_grid_width)) ; predefined_shapes[62] := (fullcircle scaled (2.0*predefined_shapes_yradius) xscaled (flow_grid_height/flow_grid_width)) ; @@ -399,9 +401,9 @@ def flow_draw_connection(expr i,xfrom,yfrom,xto,yto) = % 'i' is a comment refere flow_cdash[flow_cpath] := flow_dashline ; flow_ccross[flow_cpath] := flow_showcrossing ; if flow_reverse_connection : - flow_centers[xto] [yto] [i] := flow_cpaths[flow_cpath] ; + flow_connections[xto] [yto] [i] := flow_cpaths[flow_cpath] ; else : - flow_centers[xfrom][yfrom][i] := flow_cpaths[flow_cpath] ; + flow_connections[xfrom][yfrom][i] := flow_cpaths[flow_cpath] ; fi ; else : message("no connection defined") ; @@ -461,108 +463,131 @@ def flow_draw_midpoint (expr n) = endgroup ; enddef ; -def flow_flush_picture(expr x, yy) = % more in lua +def flow_flush_picture(expr x, yy) = begingroup ; save y ; numeric y ; - y := flow_y_pos(yy) ; - if known flow_xytext[x][y] : % maybe test on path for comments - begingroup ; - % flow_xypath[x][y] - save p, offset ; path p ; pair offset ; - offset := flow_xy_offset((x+0.5)*flow_grid_width,(flow_max_y-y+1.5)*flow_grid_height) ; - offset := offset shifted (-flow_xyline[x][y]/4,-flow_xyline[x][y]/4) ; % terrible hack (some compensation) - p := fullsquare xscaled flow_grid_width yscaled flow_grid_height shifted offset ; - % - save loc ; string loc ; - save len ; numeric len ; - save txt ; picture txt ; - save cen ; path cen ; - % - txt := flow_xytext[x][y] ; if known txt : - draw txt shifted offset ; - fi ; - % is simple comment (sort of obsolete) - txt := flow_xylabel_t[x][y] ; if known txt : - label.urt(txt,0.5[ulcorner p,urcorner p]) ; - fi ; - txt := flow_xylabel_b[x][y] ; if known txt : - label.lrt(txt,0.5[llcorner p,lrcorner p]) ; - fi ; - txt := flow_xylabel_l[x][y] ; if known txt : - label.ulft(txt,0.5[ulcorner p,llcorner p]) ; - fi ; - txt := flow_xylabel_r[x][y] ; if known txt : - label.urt (txt,0.5[urcorner p,lrcorner p]) ; - fi ; - % is shifted comment - txt := flow_xyexit_t[x][y] ; if known txt : - label.top(txt,0.5[ulcorner p,urcorner p] shifted (0, flow_grid_height/2)) ; - fi ; - txt := flow_xyexit_b[x][y] ; if known txt : - label.bot(txt,0.5[llcorner p,lrcorner p] shifted (0,-flow_grid_height/2)) ; - fi ; - txt := flow_xyexit_l[x][y] ; if known txt : - label.lft(txt,0.5[ulcorner p,llcorner p] shifted (-flow_grid_width/2,0)) ; - fi ; - txt := flow_xyexit_r[x][y] ; if known txt : - label.rt (txt,0.5[urcorner p,lrcorner p] shifted ( flow_grid_width/2,0)) ; - fi ; - % along the path or anchored - for i=1 upto infinity : - cen := flow_centers[x][y][i] ; - if unknown cen : - break ; - else : - for j=1 upto infinity : - txt := flow_xycomment_txt[x][y][i][j] ; - if unknown txt : - break ; - else : % todo: see how we can store suffix - loc := flow_xycomment_loc[x][y][i][j] ; - len := flow_xycomment_len[x][y][i][j] ; - pair a ; - if len <> 0 : - a := point len along cen ; - fi ; - if loc = "tl" : label.ulft(txt,if len = 0 : 0.5[ulcorner p,urcorner p] else : a fi) ; - elseif loc = "t" : label.top (txt,if len = 0 : 0.5[ulcorner p,urcorner p] else : a fi) ; - elseif loc = "tr" : label.urt (txt,if len = 0 : 0.5[ulcorner p,urcorner p] else : a fi) ; - elseif loc = "bl" : label.llft(txt,if len = 0 : 0.5[llcorner p,lrcorner p] else : a fi) ; - elseif loc = "b" : label.bot (txt,if len = 0 : 0.5[llcorner p,lrcorner p] else : a fi) ; - elseif loc = "br" : label.lrt (txt,if len = 0 : 0.5[llcorner p,lrcorner p] else : a fi) ; - elseif loc = "lt" : label.ulft(txt,if len = 0 : 0.5[ulcorner p,llcorner p] else : a fi) ; - elseif loc = "l" : label.lft (txt,if len = 0 : 0.5[ulcorner p,llcorner p] else : a fi) ; - elseif loc = "lb" : label.lrt (txt,if len = 0 : 0.5[ulcorner p,llcorner p] else : a fi) ; - elseif loc = "rt" : label.urt (txt,if len = 0 : 0.5[urcorner p,lrcorner p] else : a fi) ; - elseif loc = "r" : label.rt (txt,if len = 0 : 0.5[urcorner p,lrcorner p] else : a fi) ; - elseif loc = "rb" : label.lrt (txt,if len = 0 : 0.5[urcorner p,lrcorner p] else : a fi) ; fi ; - fi ; - endfor ; - fi ; - endfor ; - endgroup ; + y := flow_y_pos(yy) ; % maybe move this to the makers + if known flow_xytext[x][y] : + draw flow_xytext[x][y] ; + fi ; + if known flow_xylabel[x][y] : + draw flow_xylabel[x][y] ; + fi ; + if known flow_xyexit[x][y] : + draw flow_xyexit[x][y] ; + fi ; + if known flow_xycomment[x][y] : + draw flow_xycomment[x][y] ; fi ; endgroup ; enddef ; +vardef flow_offset(expr x, y) = + flow_xy_offset((x+0.5)*flow_grid_width,(flow_max_y-y+1.5)*flow_grid_height) + shifted (-flow_xyline[x][y]/4,-flow_xyline[x][y]/4) % terrible hack (some compensation) +enddef ; + def flow_chart_draw_text(expr x, y, p) = - flow_xytext[x][y] := p ; + if known flow_xytext[x][y] : + addto flow_xytext[x][y] also + else : + flow_xytext[x][y] := + fi + p shifted flow_offset(x,y) ; enddef ; -def flow_chart_draw_label_t (expr x, y, p) = flow_xylabel_t [x][y] := p ; enddef ; -def flow_chart_draw_label_b (expr x, y, p) = flow_xylabel_b [x][y] := p ; enddef ; -def flow_chart_draw_label_l (expr x, y, p) = flow_xylabel_l [x][y] := p ; enddef ; -def flow_chart_draw_label_r (expr x, y, p) = flow_xylabel_r [x][y] := p ; enddef ; +def flow_chart_draw_label (expr x, y, loc, txt) = + begingroup ; + save p, s ; path p ; picture s ; + p := fullsquare xscaled flow_grid_width yscaled flow_grid_height ; + p := p shifted flow_offset(x,y) ; + s := txt ; + setbounds s to boundingbox s enlarged flow_label_offset ; + if known flow_xylabel[x][y] : + addto flow_xylabel[x][y] also + else : + flow_xylabel[x][y] := + fi + if loc = "tr" : anchored.llft(s,0.5[ulcorner p,urcorner p]) ; + elseif loc = "t" : anchored.bot (s,0.5[ulcorner p,urcorner p]) ; + elseif loc = "tl" : anchored.lrt (s,0.5[ulcorner p,urcorner p]) ; + elseif loc = "br" : anchored.ulft(s,0.5[llcorner p,lrcorner p]) ; + elseif loc = "b" : anchored.top (s,0.5[llcorner p,lrcorner p]) ; + elseif loc = "bl" : anchored.urt (s,0.5[llcorner p,lrcorner p]) ; + elseif loc = "lb" : anchored.urt (s,0.5[ulcorner p,llcorner p]) ; + elseif loc = "l" : anchored.rt (s,0.5[ulcorner p,llcorner p]) ; + elseif loc = "lt" : anchored.lrt (s,0.5[ulcorner p,llcorner p]) ; + elseif loc = "rb" : anchored.ulft(s,0.5[urcorner p,lrcorner p]) ; + elseif loc = "r" : anchored.lft (s,0.5[urcorner p,lrcorner p]) ; + elseif loc = "rt" : anchored.llft(s,0.5[urcorner p,lrcorner p]) ; + else : anchored (s,center p) ; + fi ; + endgroup ; +enddef ; -def flow_chart_draw_exit_t (expr x, y, p) = flow_xyexit_t [x][y] := p ; enddef ; -def flow_chart_draw_exit_b (expr x, y, p) = flow_xyexit_b [x][y] := p ; enddef ; -def flow_chart_draw_exit_l (expr x, y, p) = flow_xyexit_l [x][y] := p ; enddef ; -def flow_chart_draw_exit_r (expr x, y, p) = flow_xyexit_r [x][y] := p ; enddef ; +def flow_chart_draw_exit (expr x, y, loc, txt) = + begingroup ; + save p, s ; path p ; picture s ; + p := fullsquare xscaled flow_grid_width yscaled flow_grid_height ; + p := p shifted flow_offset(x,y) ; + s := txt ; + setbounds s to boundingbox s enlarged flow_exit_offset ; + if known flow_xyexit[x][y] : + addto flow_xyexit[x][y] also + else : + flow_xyexit[x][y] := + fi + if loc = "t" : anchored.top(s,0.5[ulcorner p,urcorner p]) ; + elseif loc = "b" : anchored.bot(s,0.5[llcorner p,lrcorner p]) ; + elseif loc = "l" : anchored.lft(s,0.5[ulcorner p,llcorner p]) ; + elseif loc = "r" : anchored.rt (s,0.5[urcorner p,lrcorner p]) ; + else : anchored (s,center p) ; + fi ; + endgroup ; +enddef ; -def flow_chart_draw_comment (expr x, y, i, j, p, l, n) = - flow_xycomment_txt[x][y][i][j] := p ; - flow_xycomment_loc[x][y][i][j] := l ; - flow_xycomment_len[x][y][i][j] := n ; +def flow_chart_draw_comment (expr x, y, i, loc, len, txt) = % per connection + begingroup ; + if known flow_connections[x][y][i] : + save p, q, s ; path p, q ; picture s ; + p := fullsquare xscaled flow_shape_width yscaled flow_shape_height ; + p := p shifted flow_offset(x,y) ; + q := flow_connections[x][y][i] ; % already relocated + s := txt ; + setbounds s to boundingbox s enlarged flow_comment_offset ; + if known flow_xycomment[x][y] : + addto flow_xycomment[x][y] also + else : + flow_xycomment[x][y] := + fi + if loc = "tr" : anchored.llft(s,if len = 0 : 0.5[ulcorner p,urcorner p] else : point len along q fi) ; + elseif loc = "t" : anchored.bot (s,if len = 0 : 0.5[ulcorner p,urcorner p] else : point len along q fi) ; + elseif loc = "tl" : anchored.lrt (s,if len = 0 : 0.5[ulcorner p,urcorner p] else : point len along q fi) ; + elseif loc = "br" : anchored.ulft(s,if len = 0 : 0.5[llcorner p,lrcorner p] else : point len along q fi) ; + elseif loc = "b" : anchored.top (s,if len = 0 : 0.5[llcorner p,lrcorner p] else : point len along q fi) ; + elseif loc = "bl" : anchored.urt (s,if len = 0 : 0.5[llcorner p,lrcorner p] else : point len along q fi) ; + elseif loc = "lb" : anchored.urt (s,if len = 0 : 0.5[ulcorner p,llcorner p] else : point len along q fi) ; + elseif loc = "l" : anchored.rt (s,if len = 0 : 0.5[ulcorner p,llcorner p] else : point len along q fi) ; + elseif loc = "lt" : anchored.lrt (s,if len = 0 : 0.5[ulcorner p,llcorner p] else : point len along q fi) ; + elseif loc = "rb" : anchored.ulft(s,if len = 0 : 0.5[urcorner p,lrcorner p] else : point len along q fi) ; + elseif loc = "r" : anchored.lft (s,if len = 0 : 0.5[urcorner p,lrcorner p] else : point len along q fi) ; + elseif loc = "rt" : anchored.llft(s,if len = 0 : 0.5[urcorner p,lrcorner p] else : point len along q fi) ; + elseif loc = "tr:*" : anchored.llft(s,point 0 of q) ; + elseif loc = "t:*" : anchored.bot (s,point 0 of q) ; + elseif loc = "tl:*" : anchored.lrt (s,point 0 of q) ; + elseif loc = "br:*" : anchored.ulft(s,point 0 of q) ; + elseif loc = "b:*" : anchored.top (s,point 0 of q) ; + elseif loc = "bl:*" : anchored.urt (s,point 0 of q) ; + elseif loc = "lb:*" : anchored.urt (s,point 0 of q) ; + elseif loc = "l:*" : anchored.rt (s,point 0 of q) ; + elseif loc = "lt:*" : anchored.lrt (s,point 0 of q) ; + elseif loc = "rb:*" : anchored.ulft(s,point 0 of q) ; + elseif loc = "r:*" : anchored.lft (s,point 0 of q) ; + elseif loc = "rt:*" : anchored.llft(s,point 0 of q) ; + else : anchored (s,point 0 of q) ; + fi ; + fi ; + endgroup ; enddef ; boolean flow_reverse_connection ; flow_reverse_connection := false ; diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv index b0b360cee..329683f8c 100644 --- a/metapost/context/base/mp-mlib.mpiv +++ b/metapost/context/base/mp-mlib.mpiv @@ -527,10 +527,10 @@ enddef ; % Positions def register (expr label, width, height, offset) = - image ( +% draw image ( addto currentpicture doublepath unitsquare xscaled width yscaled height shifted offset withprescript "ps_label=" & label ; - ) ; % no transformations +% ) ; % no transformations enddef ; % Housekeeping diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv index 65a76f8fa..e489e7819 100644 --- a/metapost/context/base/mp-tool.mpiv +++ b/metapost/context/base/mp-tool.mpiv @@ -1189,8 +1189,8 @@ primarydef pct along pat = % also negative (arctime (pct * (arclength pat)) of pat) of pat enddef ; -primarydef len on pat = - ((arctime if len>0 : len else : (arclength(pat)+len) fi of pat) of pat) +primarydef len on pat = % no outer ( ) .. somehow fails + (arctime if len>0 : len else : (arclength(pat)+len) fi of pat) of pat enddef ; % this cuts of a piece from both ends diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 91101fce3..08d6b4c0a 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -1211,7 +1211,8 @@ local temporary_runfiles = { "tui", "tua", "tup", "ted", "tes", "top", "log", "tmp", "run", "bck", "rlg", "mpt", "mpx", "mpd", "mpo", "mpb", "ctl", - "synctex.gz", "pgf" + "synctex.gz", "pgf", + "prep", } local persistent_runfiles = { diff --git a/scripts/context/lua/mtx-modules.lua b/scripts/context/lua/mtx-modules.lua index 8f3ab89cf..902b12ac3 100644 --- a/scripts/context/lua/mtx-modules.lua +++ b/scripts/context/lua/mtx-modules.lua @@ -47,46 +47,60 @@ local report = application.report -- start-stop commands. The suffix specificaction can be overruled at runtime, -- but defaults to the file extension. This specification can be used for language -- depended verbatim typesetting. +-- +-- In the mkiv variant we filter the \module settings so that we don't have +-- to mess with global document settings. -local find, format, sub, is_empty, strip = string.find, string.format, string.sub, string.is_empty, string.strip +local find, format, sub, is_empty, strip, gsub = string.find, string.format, string.sub, string.is_empty, string.strip, string.gsub local function source_to_ted(inpname,outname,filetype) - local inp = io.open(inpname) - if not inp then - report("unable to open '%s'",inpname) - return - end - local out = io.open(outname,"w") - if not out then - report("unable to open '%s'",outname) + local data = io.loaddata(inpname) + if data == "" then + report("invalid module name '%s'",inpname) return end report("converting '%s' to '%s'",inpname,outname) local skiplevel, indocument, indefinition = 0, false, false - out:write(format("\\startmodule[type=%s]\n",filetype or file.suffix(inpname))) - for line in inp:lines() do ---~ line = strip(line) + local started = false + local settings = format("type=%s",filetype or file.suffix(inpname)) + local preamble, n = lpeg.match(lpeg.Cs((1-lpeg.patterns.newline^2)^1) * lpeg.Cp(),data) + if preamble then + preamble = string.match(preamble,"\\module.-%[(.-)%]") + if preamble then + preamble = gsub(preamble,"%%D *","") + preamble = gsub(preamble,"%%(.-)[\n\r]","") + preamble = gsub(preamble,"[\n\r]","") + preamble = strip(preamble) + settings = format("%s,%s",settings,preamble) + data = string.sub(data,n,#data) + end + end + local lines = string.splitlines(data) + local result = { } + result[#result+1] = format("\\startmoduledocumentation[%s]",settings) + for i=1,#lines do + local line = lines[i] if find(line,"^%%D ") or find(line,"^%%D$") then if skiplevel == 0 then - local someline = (#line < 3 and "") or sub(line,4,#line) + local someline = #line < 3 and "" or sub(line,4,#line) if indocument then - out:write(format("%s\n",someline)) + result[#result+1] = someline else if indefinition then - out:write("\\stopdefinition\n") + result[#result+1] = "\\stopdefinition" indefinition = false end if not indocument then - out:write("\n\\startdocumentation\n") + result[#result+1] = "\\startdocumentation" end - out:write(format("%s\n",someline)) + result[#result+1] = someline indocument = true end end elseif find(line,"^%%M ") or find(line,"^%%M$") then if skiplevel == 0 then local someline = (#line < 3 and "") or sub(line,4,#line) - out:write(format("%s\n",someline)) + result[#result+1] = someline end elseif find(line,"^%%S B") then skiplevel = skiplevel + 1 @@ -99,36 +113,36 @@ local function source_to_ted(inpname,outname,filetype) inlocaldocument = false local someline = line if indocument then - out:write("\\stopdocumentation\n") + result[#result+1] = "\\stopdocumentation" indocument = false end if indefinition then if is_empty(someline) then - out:write("\\stopdefinition\n") + result[#result+1] = "\\stopdefinition" indefinition = false else - out:write(format("%s\n",someline)) + result[#result+1] = someline end elseif not is_empty(someline) then - out:write("\n\\startdefinition\n") + result[#result+1] = "\n" + result[#result+1] = "\\startdefinition" indefinition = true if inlocaldocument then -- nothing else - out:write(format("%s\n",someline)) + result[#result+1] = someline end end end end if indocument then - out:write("\\stopdocumentation\n") + result[#result+1] = "\\stopdocumentation" end if indefinition then - out:write("\\stopdefinition\n") + result[#result+1] = "\\stopdefinition" end - out:write("\\stopmodule\n") - out:close() - inp:close() + result[#result+1] = "\\stopmoduledocumentation" + io.savedata(outname,table.concat(result,"\n")) return true end @@ -150,7 +164,7 @@ function scripts.modules.process(runtex) end local done = source_to_ted(shortname,longname) if done and runtex then - os.execute(format("mtxrun --script context --usemodule=mod-01 %s",longname)) + os.execute(format("mtxrun --script context --usemodule=mod-01 --purge %s",longname)) processed[#processed+1] = longname end end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index dd2ba551f..13d78333b 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -8160,6 +8160,7 @@ local function collect(list,collected,c) end return c end + apply_axis['descendant'] = function(list) local collected, c = { }, 0 for l=1,#list do diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index 339f3d490..f6493a3fc 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -606,12 +606,12 @@ end #D structured as: #D #D \starttypen -#D \startmodule[type=suffix] +#D \startmoduledocumentation[type=suffix] #D \startdocumentation #D \stopdocumentation #D \startdefinition #D \stopdefinition -#D \stopmodule +#D \stopmoduledocumentation #D \stoptypen #D #D Macro definitions specific to the documentation are not @@ -661,7 +661,7 @@ class Commands else tex.rewind # seek(0) end - ted.puts("\\startmodule[type=#{filetype}]\n") + ted.puts("\\startmoduledocumentation[type=#{filetype}]\n") while str = tex.gets do if skippingbang then skippingbang = false @@ -737,7 +737,7 @@ class Commands if indefinition then ted.puts("\\stopdefinition\n") end - ted.puts("\\stopmodule\n") + ted.puts("\\stopmoduledocumentation\n") ted.close if nofdocuments == 0 && nofdefinitions == 0 then diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index dd2ba551f..13d78333b 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -8160,6 +8160,7 @@ local function collect(list,collected,c) end return c end + apply_axis['descendant'] = function(list) local collected, c = { }, 0 for l=1,#list do diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index dd2ba551f..13d78333b 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -8160,6 +8160,7 @@ local function collect(list,collected,c) end return c end + apply_axis['descendant'] = function(list) local collected, c = { }, 0 for l=1,#list do diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 1f5aefb86..dd6e13515 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -2129,9 +2129,15 @@ local function cleanxhtmltree(xmltree) -- todo: inject xhtmlpreamble (xmlns should have be enough) local wrapper = { tg = "a", ns = "xhtml", at = { href = "unknown" } } for e in xml.collected(xmltree,"link") do - local location = e.at.location - if location then - wrapper.at.href = "#" .. gsub(location,":","_") + local at = e.at + local href + if at.url then + href = at.url + elseif at.location then + at.href = "#" .. gsub(at.location,":","_") + end + if href then + wrapper.at.href = href xmlwrap(e,wrapper) end end diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index cca92cc67..7ceb90954 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -142,6 +142,7 @@ \appendtoks \normalexpanded{\dodefinetyping{\currenttyping}}% + \normalexpanded{\definelinenumbering[\currenttyping]}% \to \everydefinetyping \unexpanded\def\dodefinetyping#1% diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua index 38c61a023..ed86c2923 100644 --- a/tex/context/base/cldf-ini.lua +++ b/tex/context/base/cldf-ini.lua @@ -172,6 +172,9 @@ local verbose = lpegC((1-space-newline)^1) local beginstripper = (lpegS(" \t")^1 * newline^1) / "" local endstripper = beginstripper * lpegP(-1) +local justaspace = space * lpegCc("") +local justanewline = newline * lpegCc("") + local function n_content(s) flush(contentcatcodes,s) end @@ -208,8 +211,9 @@ function context.newtexthandler(specification) -- can also be used for verbose local f_emptyline = specification.emptyline or n_emptyline local f_simpleline = specification.simpleline or n_simpleline local f_content = specification.content or n_content + local f_space = specification.space -- - local p_exception = specification.exception + local p_exception = specification.exception -- if s_catcodes then f_content = function(s) @@ -218,27 +222,48 @@ function context.newtexthandler(specification) -- can also be used for verbose end -- local pattern - if p_exception then - local content = lpegC((1-spacing-p_exception)^1) - pattern = - simpleline / f_simpleline - + - ( - emptyline / f_emptyline - + endofline / f_endofline - + p_exception - + content / f_content - )^0 + if f_space then + if p_exception then + local content = lpegC((1-spacing-p_exception)^1) + pattern = + ( + justaspace / f_space + + justanewline / f_endofline + + p_exception + + content / f_content + )^0 + else + local content = lpegC((1-space-endofline)^1) + pattern = + ( + justaspace / f_space + + justanewline / f_endofline + + content / f_content + )^0 + end else - local content = lpegC((1-spacing)^1) - pattern = - simpleline / f_simpleline - + - ( - emptyline / f_emptyline - + endofline / f_endofline - + content / f_content - )^0 + if p_exception then + local content = lpegC((1-spacing-p_exception)^1) + pattern = + simpleline / f_simpleline + + + ( + emptyline / f_emptyline + + endofline / f_endofline + + p_exception + + content / f_content + )^0 + else + local content = lpegC((1-spacing)^1) + pattern = + simpleline / f_simpleline + + + ( + emptyline / f_emptyline + + endofline / f_endofline + + content / f_content + )^0 + end end -- if f_before then @@ -262,9 +287,9 @@ function context.newverbosehandler(specification) -- a special variant for e.g. local f_after = specification.after -- local pattern = - newline * (lpegCc("") / f_line) -- so we get call{} - + verbose / f_content - + space * (lpegCc("") / f_space) -- so we get call{} + justanewline / f_line -- so we get call{} + + verbose / f_content + + justaspace / f_space -- so we get call{} -- if specification.strip then pattern = beginstripper^0 * (endstripper + pattern)^0 diff --git a/tex/context/base/colo-ini.mkiv b/tex/context/base/colo-ini.mkiv index 2923f64da..df87b0d50 100644 --- a/tex/context/base/colo-ini.mkiv +++ b/tex/context/base/colo-ini.mkiv @@ -1008,9 +1008,9 @@ %D %D show us: %D -%D \startvoorbeeld +%D \startexample %D \getbuffer -%D \stopvoorbeeld +%D \stopexample \let\currentcolorname\s!black % todo \let\outercolorname \s!black % todo diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 5c6e35416..71af8f3f7 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex c85f3d479..c1279e9d8 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv index a62e48487..427486c39 100644 --- a/tex/context/base/core-con.mkiv +++ b/tex/context/base/core-con.mkiv @@ -266,11 +266,9 @@ %D %D gives %D -%D \startvoorbeeld %D \startlines %D \getbuffer %D \stoplines -%D \stopvoorbeeld %D %D The macro \type {\getdayoftheweek} can be used to calculate %D the number \type {\normalweekday}. @@ -353,11 +351,9 @@ %D \currentdate[WEEKDAY,day,MONTH,year] % still dutch example %D \stopbuffer %D -%D \startvoorbeeld %D \startlines %D \getbuffer %D \stoplines -%D \stopvoorbeeld %D %D depending of course on the keywords. Here we gave: %D diff --git a/tex/context/base/core-fnt.mkiv b/tex/context/base/core-fnt.mkiv index 09ebcc15f..c1acd07b6 100644 --- a/tex/context/base/core-fnt.mkiv +++ b/tex/context/base/core-fnt.mkiv @@ -54,9 +54,9 @@ %D %D or %D -%D \startvoorbeeld +%D \startexample %D \getbuffer -%D \stopvoorbeeld +%D \stopexample %D %D \showsetup{stretched} @@ -92,9 +92,9 @@ %D %D this one uses fixed skips and kerns. %D -%D \startvoorbeeld +%D \startexample %D \getbuffer -%D \stopvoorbeeld +%D \stopexample %D %D The default skip can be set with: diff --git a/tex/context/base/file-job.mkvi b/tex/context/base/file-job.mkvi index 05915ce7c..2b4ea5203 100644 --- a/tex/context/base/file-job.mkvi +++ b/tex/context/base/file-job.mkvi @@ -249,8 +249,11 @@ {\documentvariable\c!after \stoptext} -\def\documentvariable#1% - {\getvariable{document}{#1}} +\def\documentvariable#name% + {\getvariable{document}{#name}} + +\unexpanded\def\setupdocument + {\dodoubleempty\setvariables[document]} \setvariables [document] diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index 832806547..57fd53854 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -296,9 +296,9 @@ %D %D therefore becomes: %D -%D \startvoorbeeld +%D \startexample %D \getbuffer -%D \stopvoorbeeld +%D \stopexample %D %D Maybe this mechanism isn't always as logic, but as said %D before, we tried to make it as intuitive as possible. @@ -2916,11 +2916,9 @@ %D %D result in: %D -%D \startvoorbeeld %D \startlines %D \getbuffer %D \stoplines -%D \stopvoorbeeld %D %D Setting the main size involves the style list and therefore %D takes a bit more time. Keep in mind that the fontsize is @@ -3533,9 +3531,9 @@ %D %D or %D -%D \startvoorbeeld +%D \startexample %D \definealternativestyle[bold][\bf][]\getbuffer -%D \stopvoorbeeld +%D \stopexample %D %D Such definitions are of course unwanted for \type{\cap} %D because this would result in an endless recursive call. @@ -3833,11 +3831,9 @@ %D %D We get: %D -%D \startvoorbeeld %D \startpacked %D \getbuffer %D \stoppacked -%D \stopvoorbeeld %D \macros %D {emphbf,emphit,emphsl,emphtf} diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index 88ad4adf5..bc5c4f12d 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -484,6 +484,17 @@ local function register(askedname,specification) specification.subpath = subpath specification.converted = true format = newformat + if not figures.suffixes[format] then + -- maybe the new format is lowres.png (saves entry in suffixes) + -- so let's do thsi extra check + local suffix = file.suffix(newformat) + if figures.suffixes[suffix] then + if trace_figures then + report_inclusion("using suffix '%s' as format for '%s'",suffix,format) + end + format = suffix + end + end elseif io.exists(oldname) then specification.fullname = newname specification.converted = false @@ -499,7 +510,7 @@ local function register(askedname,specification) else specification.found = true if trace_figures then - if validtypes[format] then + if validtypes[format] then -- format? report_inclusion("format natively supported by backend: %s",format) else report_inclusion("format supported by output file format: %s",format) diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv index 31cf63948..77a57ac03 100644 --- a/tex/context/base/lxml-ini.mkiv +++ b/tex/context/base/lxml-ini.mkiv @@ -54,6 +54,8 @@ \def\xmlfunction #1#2{\ctxlxml{applyfunction("#1",\!!bs#2\!!es)}} \def\xmlfirst #1#2{\ctxlxml{first("#1","#2")}} \def\xmlflush #1{\ctxlxml{flush("#1")}} +\def\xmlflushlinewise #1{\ctxlxml{flushlinewise("#1")}} +\def\xmlflushspacewise #1{\ctxlxml{flushspacewise("#1")}} %def\xmlcontent #1{\ctxlxml{content("#1")}} %def\xmlflushstripped #1{\ctxlxml{strip("#1",true)}} \def\xmldirect #1{\ctxlxml{direct("#1")}} % in loops, not dt but root diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua index 44c9d488d..a5667ab50 100644 --- a/tex/context/base/lxml-lpt.lua +++ b/tex/context/base/lxml-lpt.lua @@ -193,6 +193,7 @@ local function collect(list,collected,c) end return c end + apply_axis['descendant'] = function(list) local collected, c = { }, 0 for l=1,#list do diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index 577fb6d1e..3e5522099 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -159,6 +159,23 @@ local _, xmltextcapture = context.newtexthandler { catcodes = notcatcodes, } +local _, xmlspacecapture = context.newtexthandler { + endofline = context.xmlcdataobeyedline, + emptyline = context.xmlcdataobeyedline, + simpleline = context.xmlcdataobeyedline, + space = context.xmlcdataobeyedspace, + exception = entity, + catcodes = notcatcodes, +} + +local _, xmllinecapture = context.newtexthandler { + endofline = context.xmlcdataobeyedline, + emptyline = context.xmlcdataobeyedline, + simpleline = context.xmlcdataobeyedline, + exception = entity, + catcodes = notcatcodes, +} + local _, ctxtextcapture = context.newtexthandler { exception = entity, catcodes = ctxcatcodes, @@ -500,6 +517,7 @@ local function tex_element(e,handlers) addindex(rootname,false,true) ix = e.ix end + -- faster than context.xmlw contextsprint(ctxcatcodes,"\\xmlw{",command,"}{",rootname,"::",ix,"}") else report_lxml( "fatal error: no index for '%s'",command) @@ -555,9 +573,7 @@ local function tex_cdata(e,handlers) end local function tex_text(e) --- print("before",e) e = xmlunprivatized(e) --- print("after",e) lpegmatch(xmltextcapture,e) end @@ -586,6 +602,62 @@ local xmltexhandler = xml.newhandlers { lxml.xmltexhandler = xmltexhandler +-- begin of test + +local function tex_space(e) + e = xmlunprivatized(e) + lpegmatch(xmlspacecapture,e) +end + +local xmltexspacehandler = xml.newhandlers { + name = "texspace", + handle = tex_handle, + functions = { + ["@dt@"] = tex_doctype, + ["@el@"] = tex_element, + ["@pi@"] = tex_pi, + ["@cm@"] = tex_comment, + ["@cd@"] = tex_cdata, + ["@tx@"] = tex_space, + } +} + +local function tex_line(e) + e = xmlunprivatized(e) + lpegmatch(xmllinecapture,e) +end + +local xmltexlinehandler = xml.newhandlers { + name = "texline", + handle = tex_handle, + functions = { + ["@dt@"] = tex_doctype, + ["@el@"] = tex_element, + ["@pi@"] = tex_pi, + ["@cm@"] = tex_comment, + ["@cd@"] = tex_cdata, + ["@tx@"] = tex_line, + } +} + +function lxml.flushspacewise(id) -- keeps spaces and lines + id = getid(id) + local dt = id and id.dt + if dt then + xmlserialize(dt,xmltexspacehandler) + end +end + +function lxml.flushlinewise(id) -- keeps lines + id = getid(id) + local dt = id and id.dt + if dt then + xmlserialize(dt,xmltexlinehandler) + end +end + +-- end of test + function lxml.serialize(root) xmlserialize(root,xmltexhandler) end diff --git a/tex/context/base/m-barcodes.mkiv b/tex/context/base/m-barcodes.mkiv index 16b553fa2..0282f706d 100644 --- a/tex/context/base/m-barcodes.mkiv +++ b/tex/context/base/m-barcodes.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D You can best use m-zint instead of this one. + % \startTEXpage % \startPSTRICKS % \pspicture(-4mm,-1mm)(38mm,26mm) diff --git a/tex/context/base/m-chart.lua b/tex/context/base/m-chart.lua index 0378b2020..943e6be63 100644 --- a/tex/context/base/m-chart.lua +++ b/tex/context/base/m-chart.lua @@ -48,6 +48,10 @@ local defaults = { vcompact = variables_no, autofocus = "", focus = "", + labeloffset = 5*65436, + commentoffset = 5*65436, + exitoffset = 0, + }, shape = { -- FLOS rulethickness = 65436, @@ -109,6 +113,10 @@ local validlabellocations = { rt = "rt", lb = "lb", rb = "rb", + tl = "tl", + tr = "tr", + bl = "bl", + br = "br", } local validcommentlocations = { @@ -120,10 +128,10 @@ local validcommentlocations = { rt = "rt", lb = "lb", rb = "rb", - tl = "lt", - tr = "rt", - bl = "lb", - br = "rb", + tl = "tl", + tr = "tr", + bl = "bl", + br = "br", } local validtextlocations = { @@ -215,6 +223,7 @@ end function commands.flow_start_cell(settings) temp = { + texts = { }, labels = { }, exits = { }, connections = { }, @@ -243,8 +252,10 @@ function commands.flow_set_destination(str) end function commands.flow_set_text(align,str) - temp.align = validtextlocations[align] or align - temp.text = str + temp.texts[#temp.texts+1] = { + location = align, + text = str, + } end function commands.flow_set_overlay(str) @@ -592,20 +603,22 @@ local function process_texts(chart,xoffset,yoffset) if cell then local x = cell.x or 1 local y = cell.y or 1 - local text = cell.text - if text and text ~= "" then - local a = cell.align or "" - local f = cell.figure or "" - local d = cell.destination or "" - context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,format(texttemplate,x,y,text,a,f,d)) + local texts = cell.texts + for i=1,#texts do + local text = texts[i] + local data = text.text + local align = validlabellocations[text.align or ""] or text.align or "" + local figure = i == 1 and cell.figure or "" + local destination = i == 1 and cell.destination or "" + context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,format(texttemplate,x,y,data,align,figure,destination)) end local labels = cell.labels for i=1,#labels do local label = labels[i] local text = label.text - local location = validlabellocations[label.location or ""] + local location = validlabellocations[label.location or ""] or label.location or "" if text and location then - context('flow_chart_draw_label_%s(%s,%s,textext("%s")) ;',location,x,y,text) + context('flow_chart_draw_label(%s,%s,"%s",textext("\\strut %s")) ;',x,y,location,text) end end local exits = cell.exits @@ -619,7 +632,7 @@ local function process_texts(chart,xoffset,yoffset) location == "r" and x == chart.to_x - 1 or location == "t" and y == chart.to_y - 1 or location == "b" and y == chart.from_y + 1 then - context('flow_chart_draw_exit_%s(%s,%s,textext("%s")) ;',location,x,y,text) + context('flow_chart_draw_exit(%s,%s,"%s",textext("\\strut %s")) ;',x,y,location,text) end end end @@ -631,14 +644,23 @@ local function process_texts(chart,xoffset,yoffset) local text = comment.text local location = comment.location or "" local length = 0 - local loc, len = lpegmatch(splitter,location) - if loc then - location = loc - length = tonumber(len) or 0 + -- "tl" "tl:*" "tl:0.5" + local loc, len = lpegmatch(splitter,location) -- do the following in lpeg + if len == "*" then + location = validcommentlocations[loc] or "" + if location == "" then + location = "*" + else + location = location .. ":*" + end + elseif loc then + location = validcommentlocations[loc] or "*" + length = tonumber(len) or 0 + else + location = validcommentlocations[location] or "" end - location = validcommentlocations[location] if text and location then - context('flow_chart_draw_comment(%s,%s,%s,%s,textext("%s"),"%s",%s) ;',x,y,i,j,text,location,length) + context('flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("\\strut %s")) ;',x,y,i,location,length,text) end end end @@ -737,11 +759,6 @@ local function makechart(chart) context.begingroup() context.forgetall() -- - -- local bodyfont = settings.chart.bodyfont - -- if bodyfont ~= "" then - -- context.switchtobodyfont { bodyfont } - -- end - -- context.startMPcode() context("if unknown context_flow : input mp-char.mpiv ; fi ;") context("flow_begin_chart(0,%s,%s);",chart.nx,chart.ny) @@ -759,17 +776,22 @@ local function makechart(chart) context("flow_chart_background_color := \\MPcolor{%s} ;",backgroundcolor) end -- - local shapewidth = settings.chart.width - local gridwidth = shapewidth + 2*settings.chart.dx - local shapeheight = settings.chart.height - local gridheight = shapeheight + 2*settings.chart.dy - local chartoffset = settings.chart.offset - - context("flow_grid_width := %s ;", points(gridwidth)) - context("flow_grid_height := %s ;", points(gridheight)) - context("flow_shape_width := %s ;", points(shapewidth)) - context("flow_shape_height := %s ;", points(shapeheight)) - context("flow_chart_offset := %s ;", points(chartoffset)) + local shapewidth = settings.chart.width + local gridwidth = shapewidth + 2*settings.chart.dx + local shapeheight = settings.chart.height + local gridheight = shapeheight + 2*settings.chart.dy + local chartoffset = settings.chart.offset + local labeloffset = settings.chart.labeloffset + local exitoffset = settings.chart.exitoffset + local commentoffset = settings.chart.commentoffset + context("flow_grid_width := %s ;", points(gridwidth)) + context("flow_grid_height := %s ;", points(gridheight)) + context("flow_shape_width := %s ;", points(shapewidth)) + context("flow_shape_height := %s ;", points(shapeheight)) + context("flow_chart_offset := %s ;", points(chartoffset)) + context("flow_label_offset := %s ;", points(labeloffset)) + context("flow_exit_offset := %s ;", points(exitoffset)) + context("flow_comment_offset := %s ;", points(commentoffset)) -- local radius = settings.line.radius local rulethickness = settings.line.rulethickness diff --git a/tex/context/base/m-chart.mkvi b/tex/context/base/m-chart.mkvi index 3bdf190e6..8e60e6934 100644 --- a/tex/context/base/m-chart.mkvi +++ b/tex/context/base/m-chart.mkvi @@ -1,6 +1,6 @@ %D \module %D [ file=m-chart, -%D version=2011.10.1, -- 1998.10.10, +%D version=2011.10.1, % 1998.10.10, %D title=\CONTEXT\ Modules, %D subtitle=Flow Charts, %D author=Hans Hagen, @@ -59,6 +59,9 @@ \c!ny=0, \c!x=1, \c!y=1, + \c!labeloffset=.5\bodyfontsize, + \c!commentoffset=.5\bodyfontsize, + \c!exitoffset=\zeropoint, % \c!maxwidth=, % \c!maxheight=, % \c!option=, @@ -203,6 +206,9 @@ ny = "\FLOWchartparameter\c!ny", x = "\FLOWchartparameter\c!x", y = "\FLOWchartparameter\c!y", + labeloffset = \number\dimexpr\FLOWchartparameter\c!labeloffset, + commentoffset = \number\dimexpr\FLOWchartparameter\c!commentoffset, + exitoffset = \number\dimexpr\FLOWchartparameter\c!exitoffset, }, shape = { rulethickness = \number\dimexpr\FLOWshapeparameter\c!rulethickness, diff --git a/tex/context/base/m-pstricks.mkiv b/tex/context/base/m-pstricks.mkiv index 0df013cac..421607aaf 100644 --- a/tex/context/base/m-pstricks.mkiv +++ b/tex/context/base/m-pstricks.mkiv @@ -13,18 +13,6 @@ \registerctxluafile{m-pstricks}{} -%D \startbuffer -%D \usePSTRICKSmodule[pst-barcode] -%D -%D \startPSTRICKS -%D \pspicture(-4mm,-1mm)(38mm,26mm) -%D \psbarcode{9781860742712}{includetext guardwhitespace}{ean13}% -%D \endpspicture -%D \stopPSTRICKS -%D \stopbuffer -%D -%D \typebuffer \startlinecorrection \getbuffer \stoplinecorrection - \unprotect % best we can make a special colors module @@ -63,4 +51,15 @@ \let\stopPSTRICKS\processPSTRICKS +%D \starttyping +%D \usemodule[pstricks] +%D \usePSTRICKSmodule[pst-barcode] +%D +%D \startPSTRICKS +%D \pspicture(-4mm,-1mm)(38mm,26mm) +%D \psbarcode{9781860742712}{includetext guardwhitespace}{ean13}% +%D \endpspicture +%D \stopPSTRICKS +%D \stoptyping + \protect \endinput diff --git a/tex/context/base/m-units.mkiv b/tex/context/base/m-units.mkiv index 433963d62..19cb05557 100644 --- a/tex/context/base/m-units.mkiv +++ b/tex/context/base/m-units.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D Best use the buitl in unit handle! + %D Scientific units can be typeset in math mode pretty well, %D but occasionally one has to take care of spacing. %D Furthermore, entering these units is not that natural as @@ -86,15 +88,9 @@ %D one that is able to cooperate with some other dimension %D related macros. As said, this module enables user to enter: %D -%D \startbuffer +%D \starttyping %D some 10 \Square \Meter \Per \Second or more -%D \stopbuffer -%D -%D \getbuffer -%D -%D as: -%D -%D \typebuffer +%D \stoptyping %D %D The units itself are implemented as synonyms. %D @@ -124,7 +120,7 @@ %D The next useless examples show some of the cases we want %D to handle in a proper way. %D -%D \startbuffer +%D \starttyping %D ... 10 \Square \Meter \Per \Volt \ %D ... 10 \Square \Meter \Volt \ %D ... 10 \Meter \Volt \ @@ -133,13 +129,7 @@ %D ... 10 \Meter \Times \Meter \ %D ... 10 \Square \Meter \Times \Meter \ %D ... 10 \Square \Milli \Meter \Times \Meter \ -%D \stopbuffer -%D -%D \typebuffer -%D -%D Becomes: -%D -%D \getbuffer +%D \stoptyping %D \macros %D {mathematicstypeface, dimensiontypeface, @@ -178,9 +168,8 @@ %D %D The actual definition of \type {\dimension} overruled the %D one in the core modules. The boolean can be used to -%D force spacing between units. Vergelijk {\Newton \Meter} -%D eens met {\spaceddimensionstrue \Newton \Meter}. The -%D rather ugly test prevents problems with nested dimensions. +%D force spacing between units. The rather ugly test prevents +%D problems with nested dimensions. \newif\ifspaceddimensions \spaceddimensionsfalse % user switch \newif\iftextdimensions \textdimensionsfalse % user switch diff --git a/tex/context/base/meta-fig.mkiv b/tex/context/base/meta-fig.mkiv index 3c8c07c0d..38462e192 100644 --- a/tex/context/base/meta-fig.mkiv +++ b/tex/context/base/meta-fig.mkiv @@ -41,38 +41,10 @@ %D definitions with the text flow, since all settings are %D kept local. The page is clipped to the image size. -\presetlocalframed[\??mg] - -\unexpanded\def\setupMPpage - {\dodoubleargument\getparameters[\??mg]} - -% \def\startMPpage -% {\dodoubleempty\dostartMPpage} -% -% \long\def\dostartMPpage[#1][#2]#3\stopMPpage % second arg gobbles space -% {\dostartfittingpage[\??mg][#1]% -% \processMPgraphic{#3}% -% \dostopfittingpage} - -\def\startMPpage - {\dosingleempty\dostartMPpage} - -\long\def\dostartMPpage[#1]#2\stopMPpage - {\dostartfittingpage[\??mg][#1]% - \processMPgraphic{#2}% - \dostopfittingpage} - -\let\stopMPpage \relax % so that we can use it in \expanded - -\setupMPpage - [\c!scale=1000, - \c!pagestate=, - \c!strut=\v!no, - \c!align=, - \c!offset=\v!overlay, - \c!width=\v!fit, - \c!height=\v!fit, - \c!frame=\v!off] +\definefittingpage + [MPpage] + [\c!align=, + \c!command=\processMPgraphic] %D \macros %D {MPfigure} diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index 1cd74f4fc..a2e343720 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -921,6 +921,7 @@ local function ps_process(object,prescript,before,after) before[#before+1] = function() context.MPLIBpositionwhd(ps_label,x,y,w,h) end + object.path = false end end @@ -929,7 +930,7 @@ end local function fg_process(object,prescript,before,after) local fg_name = prescript.fg_name if fg_name then - before[#before+1] = format("q %f %f %f %f %f %f cm",cm(object)) + before[#before+1] = format("q %f %f %f %f %f %f cm",cm(object)) -- beware: does not use the cm stack before[#before+1] = function() context.MPLIBfigure(fg_name,prescript.fg_mask or "") end diff --git a/tex/context/base/mlib-pps.mkiv b/tex/context/base/mlib-pps.mkiv index 884003e68..0dbdd3f6e 100644 --- a/tex/context/base/mlib-pps.mkiv +++ b/tex/context/base/mlib-pps.mkiv @@ -63,8 +63,34 @@ \def\MPLIBgraphictext#1% {\startTEXpage[\c!scale=10000]#1\stopTEXpage} -\def\MPLIBpositionwhd#1#2#3#4#5% - {\dosavepositionwhd{#1}{0}{#2sp}{#3sp}{#4sp}{#5sp}{0sp}} +%D \startbuffer +%D \definelayer[test] +%D +%D \setlayerframed +%D [test] +%D [x=\MPx{somepos-1},y=\MPy{somepos-1}] +%D [width=\MPw{somepos-1},height=\MPh{somepos-1}] +%D {Whatever we want here!} +%D +%D \setlayerframed +%D [test] +%D [x=\MPx{somepos-2},y=\MPy{somepos-2}] +%D [width=\MPw{somepos-2},height=\MPh{somepos-2}] +%D {Whatever we need there!} +%D +%D \startuseMPgraphic{oeps} +%D draw fullcircle scaled 6cm withcolor red ; +%D register ("somepos-1",5cm,1cm,center currentpicture) ; +%D register ("somepos-2",4cm,3cm,(-1cm,-2cm)) ; +%D \stopuseMPgraphic +%D +%D \framed[background=test,offset=overlay]{\useMPgraphic{oeps}} +%D \stopbuffer +%D +%D \typebuffer \startlinecorrection \getbuffer \stoplinecorrection + +\def\MPLIBpositionwhd#1#2#3#4#5% bp ! + {\dosavepositionwhd{#1}{0}{#2bp}{#3bp}{#4bp}{#5bp}{0bp}} \def\MPLIBextrapass#1% {\ctxlua{metapost.graphic_extra_pass("#1")}} diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index 3e0f74a0c..ed3602e1e 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -606,6 +606,7 @@ \setinterfaceconstant{commandafter}{zumbefehl} \setinterfaceconstant{commandbefore}{vorbefehl} \setinterfaceconstant{commands}{befehle} +\setinterfaceconstant{commentoffset}{commentoffset} \setinterfaceconstant{compact}{compact} \setinterfaceconstant{component}{component} \setinterfaceconstant{compoundhyphen}{compoundhyphen} @@ -653,6 +654,7 @@ \setinterfaceconstant{equalwidth}{equalwidth} \setinterfaceconstant{escape}{escape} \setinterfaceconstant{evenmargin}{geraderand} +\setinterfaceconstant{exitoffset}{labeloffset} \setinterfaceconstant{expansion}{expansion} \setinterfaceconstant{export}{export} \setinterfaceconstant{extras}{extras} @@ -731,6 +733,7 @@ \setinterfaceconstant{keys}{keys} \setinterfaceconstant{keyword}{keyword} \setinterfaceconstant{label}{label} +\setinterfaceconstant{labeloffset}{labeloffset} \setinterfaceconstant{lastnamesep}{lastnamesep} \setinterfaceconstant{lastpubsep}{lastpubsep} \setinterfaceconstant{layout}{layout} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 08bf7401b..1b672630f 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -6461,6 +6461,15 @@ return { }, }, ["constants"]={ + ["labeloffset"]={ + ["en"]="labeloffset", + }, + ["exitoffset"]={ + ["en"]="labeloffset", + }, + ["commentoffset"]={ + ["en"]="commentoffset", + }, ["hcompact"]={ ["en"]="hcompact", ["nl"]="hcomprimeer", diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index b52915129..d3a796ad4 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -606,6 +606,7 @@ \setinterfaceconstant{commandafter}{commandafter} \setinterfaceconstant{commandbefore}{commandbefore} \setinterfaceconstant{commands}{commands} +\setinterfaceconstant{commentoffset}{commentoffset} \setinterfaceconstant{compact}{compact} \setinterfaceconstant{component}{component} \setinterfaceconstant{compoundhyphen}{compoundhyphen} @@ -653,6 +654,7 @@ \setinterfaceconstant{equalwidth}{equalwidth} \setinterfaceconstant{escape}{escape} \setinterfaceconstant{evenmargin}{evenmargin} +\setinterfaceconstant{exitoffset}{labeloffset} \setinterfaceconstant{expansion}{expansion} \setinterfaceconstant{export}{export} \setinterfaceconstant{extras}{extras} @@ -731,6 +733,7 @@ \setinterfaceconstant{keys}{keys} \setinterfaceconstant{keyword}{keyword} \setinterfaceconstant{label}{label} +\setinterfaceconstant{labeloffset}{labeloffset} \setinterfaceconstant{lastnamesep}{lastnamesep} \setinterfaceconstant{lastpubsep}{lastpubsep} \setinterfaceconstant{layout}{layout} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index 5bd491d12..09c6308bb 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -606,6 +606,7 @@ \setinterfaceconstant{commandafter}{commandeapres} \setinterfaceconstant{commandbefore}{commandeavant} \setinterfaceconstant{commands}{commandes} +\setinterfaceconstant{commentoffset}{commentoffset} \setinterfaceconstant{compact}{compact} \setinterfaceconstant{component}{composant} \setinterfaceconstant{compoundhyphen}{compoundhyphen} @@ -653,6 +654,7 @@ \setinterfaceconstant{equalwidth}{equalwidth} \setinterfaceconstant{escape}{escape} \setinterfaceconstant{evenmargin}{margepaire} +\setinterfaceconstant{exitoffset}{labeloffset} \setinterfaceconstant{expansion}{expansion} \setinterfaceconstant{export}{export} \setinterfaceconstant{extras}{extras} @@ -731,6 +733,7 @@ \setinterfaceconstant{keys}{keys} \setinterfaceconstant{keyword}{motcle} \setinterfaceconstant{label}{etiquette} +\setinterfaceconstant{labeloffset}{labeloffset} \setinterfaceconstant{lastnamesep}{lastnamesep} \setinterfaceconstant{lastpubsep}{lastpubsep} \setinterfaceconstant{layout}{layout} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 0530fe5e0..5089c6109 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -606,6 +606,7 @@ \setinterfaceconstant{commandafter}{comdandodopo} \setinterfaceconstant{commandbefore}{comandoprima} \setinterfaceconstant{commands}{comandi} +\setinterfaceconstant{commentoffset}{commentoffset} \setinterfaceconstant{compact}{compact} \setinterfaceconstant{component}{component} \setinterfaceconstant{compoundhyphen}{compoundhyphen} @@ -653,6 +654,7 @@ \setinterfaceconstant{equalwidth}{equalwidth} \setinterfaceconstant{escape}{escape} \setinterfaceconstant{evenmargin}{marginepari} +\setinterfaceconstant{exitoffset}{labeloffset} \setinterfaceconstant{expansion}{espansione} \setinterfaceconstant{export}{export} \setinterfaceconstant{extras}{extras} @@ -731,6 +733,7 @@ \setinterfaceconstant{keys}{keys} \setinterfaceconstant{keyword}{parolachiave} \setinterfaceconstant{label}{etichetta} +\setinterfaceconstant{labeloffset}{labeloffset} \setinterfaceconstant{lastnamesep}{lastnamesep} \setinterfaceconstant{lastpubsep}{lastpubsep} \setinterfaceconstant{layout}{layout} diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index 13139b18c..92da529b5 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -606,6 +606,7 @@ \setinterfaceconstant{commandafter}{nacommando} \setinterfaceconstant{commandbefore}{voorcommando} \setinterfaceconstant{commands}{commandos} +\setinterfaceconstant{commentoffset}{commentoffset} \setinterfaceconstant{compact}{compact} \setinterfaceconstant{component}{component} \setinterfaceconstant{compoundhyphen}{koppelteken} @@ -653,6 +654,7 @@ \setinterfaceconstant{equalwidth}{equalwidth} \setinterfaceconstant{escape}{escape} \setinterfaceconstant{evenmargin}{evenmarge} +\setinterfaceconstant{exitoffset}{labeloffset} \setinterfaceconstant{expansion}{expansie} \setinterfaceconstant{export}{exporteer} \setinterfaceconstant{extras}{extras} @@ -731,6 +733,7 @@ \setinterfaceconstant{keys}{sleutels} \setinterfaceconstant{keyword}{trefwoord} \setinterfaceconstant{label}{label} +\setinterfaceconstant{labeloffset}{labeloffset} \setinterfaceconstant{lastnamesep}{lastnamesep} \setinterfaceconstant{lastpubsep}{lastpubsep} \setinterfaceconstant{layout}{layout} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 2f5bff053..c5b21bc87 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -606,6 +606,7 @@ \setinterfaceconstant{commandafter}{فرمانبعداز} \setinterfaceconstant{commandbefore}{فرمانقبلاز} \setinterfaceconstant{commands}{فرمانها} +\setinterfaceconstant{commentoffset}{commentoffset} \setinterfaceconstant{compact}{compact} \setinterfaceconstant{component}{مولفه} \setinterfaceconstant{compoundhyphen}{compoundhyphen} @@ -653,6 +654,7 @@ \setinterfaceconstant{equalwidth}{عرضیکسان} \setinterfaceconstant{escape}{فرار} \setinterfaceconstant{evenmargin}{حاشیهزوج} +\setinterfaceconstant{exitoffset}{labeloffset} \setinterfaceconstant{expansion}{گسترش} \setinterfaceconstant{export}{export} \setinterfaceconstant{extras}{extras} @@ -731,6 +733,7 @@ \setinterfaceconstant{keys}{keys} \setinterfaceconstant{keyword}{کلیدواژه} \setinterfaceconstant{label}{برچسب} +\setinterfaceconstant{labeloffset}{labeloffset} \setinterfaceconstant{lastnamesep}{lastnamesep} \setinterfaceconstant{lastpubsep}{lastpubsep} \setinterfaceconstant{layout}{layout} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index 26dc564a9..59aef63c1 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -606,6 +606,7 @@ \setinterfaceconstant{commandafter}{comandadupa} \setinterfaceconstant{commandbefore}{comandainainte} \setinterfaceconstant{commands}{comenzi} +\setinterfaceconstant{commentoffset}{commentoffset} \setinterfaceconstant{compact}{compact} \setinterfaceconstant{component}{component} \setinterfaceconstant{compoundhyphen}{compoundhyphen} @@ -653,6 +654,7 @@ \setinterfaceconstant{equalwidth}{equalwidth} \setinterfaceconstant{escape}{escape} \setinterfaceconstant{evenmargin}{marginepara} +\setinterfaceconstant{exitoffset}{labeloffset} \setinterfaceconstant{expansion}{expansiune} \setinterfaceconstant{export}{export} \setinterfaceconstant{extras}{extras} @@ -731,6 +733,7 @@ \setinterfaceconstant{keys}{keys} \setinterfaceconstant{keyword}{keyword} \setinterfaceconstant{label}{eticheta} +\setinterfaceconstant{labeloffset}{labeloffset} \setinterfaceconstant{lastnamesep}{lastnamesep} \setinterfaceconstant{lastpubsep}{lastpubsep} \setinterfaceconstant{layout}{layout} diff --git a/tex/context/base/node-rul.mkiv b/tex/context/base/node-rul.mkiv index 0978a650e..0567a9f29 100644 --- a/tex/context/base/node-rul.mkiv +++ b/tex/context/base/node-rul.mkiv @@ -36,11 +36,9 @@ %D %D \typebuffer %D -%D \startvoorbeeld %D \startlines %D \getbuffer %D \stoplines -%D \stopvoorbeeld %D %D The next macros are derived from the \PLAIN\ \TEX\ one, but %D also supports nesting. The \type{$} keeps us in horizontal diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua index 706b2fc10..61bd82ddc 100644 --- a/tex/context/base/node-tra.lua +++ b/tex/context/base/node-tra.lua @@ -541,15 +541,27 @@ end nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end -function nodes.listtoutf(h,joiner) - local joiner = (joiner ==true and utfchar(0x200C)) or joiner -- zwnj +local function listtoutf(h,joiner,textonly) + local joiner = (joiner == true and utfchar(0x200C)) or joiner -- zwnj local w = { } while h do - if h.id == glyph_code then -- always true + local id = h.id + if id == glyph_code then -- always true w[#w+1] = utfchar(h.char) if joiner then w[#w+1] = joiner end + elseif id == disc_code then + local pre, rep, pos = h.pre, h.replace, h.post + w[#w+1] = format("[%s|%s|%s]", + pre and listtoutf(pre,joiner,textonly) or "", + rep and listtoutf(rep,joiner,textonly) or "", + mid and listtoutf(mid,joiner,textonly) or "" + ) + elseif textonly then + if id == glue_code and h.width > 0 then + w[#w+1] = " " + end else w[#w+1] = "[-]" end @@ -558,6 +570,8 @@ function nodes.listtoutf(h,joiner) return concat(w) end +nodes.listtoutf = listtoutf + local what = { [0] = "unknown", "line", "box", "indent", "row", "cell" } local function showboxes(n,symbol,depth) diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index beb6eee91..af0e417f2 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -2202,11 +2202,9 @@ %D %D or: %D -%D \startvoorbeeld %D \startlines %D \getbuffer %D \stoplines -%D \stopvoorbeeld %D %D We could of course have implemented this macro using %D \type{\leaders}, but this would probably have taken more @@ -2348,9 +2346,9 @@ %D In next example we show most features. Watch the rule %D thickness adapting itself to the level. %D -%D \startvoorbeeld +%D \startexample %D \getbuffer -%D \stopvoorbeeld +%D \stopexample %D %D We just said: %D @@ -2422,9 +2420,9 @@ %D %D becomes %D -%D \startvoorbeeld +%D \startexample %D \getbuffer -%D \stopvoorbeeld +%D \stopexample %D %D So we've got %D @@ -2994,7 +2992,7 @@ %D \textrule %D \stopbuffer %D -%D \bgroup \typebuffer \getbuffer \egroup +%D \start \typebuffer \getbuffer \stop %D %D \startbuffer %D \setuptextrules @@ -3229,9 +3227,9 @@ %D \fillinline[margin=0cm] \input reich \par %D \stopbuffer %D -%D \startvoorbeeld +%D \startexample %D \getbuffer -%D \stopvoorbeeld +%D \stopexample %D %D which was typeset by saying: %D @@ -3269,26 +3267,6 @@ \endgraf % ! \@@ilafter}} -%D \stopdocumentation -%D \bgroup -%D -%D \setupframedtexts -%D [setuptext] -%D [background=color,backgroundcolor=white] -%D -%D \startbuffer -%D \setupbackground -%D [backgroundoffset=4pt, -%D background=screen, -%D frame=on, -%D framecolor=red, -%D leftoffset=2pt] -%D \stopbuffer -%D -%D \getbuffer -%D -%D \startbackground -%D %D \macros %D {setupbackground,startbackground,background} %D @@ -3297,18 +3275,28 @@ %D show what can be done, we provide this part of the %D documentation with some gray background and a red frame. %D Both the background and frame can have all characteristics -%D of \type{\framed}. This time we used the setting: +%D of \type{\framed}. %D -%D \typebuffer +%D \starttyping +%D \setupbackground +%D [backgroundoffset=4pt, +%D background=screen, +%D frame=on, +%D framecolor=red, +%D leftoffset=2pt] +%D \stoptyping %D %D The implementation is not that sophisticated, but suffices. %D The main problem with this kind of functionality is to get %D the spacing all right. - +%D %D Specifying the background is more or less the same as %D specifying a framed box. %D %D \showsetup{setupbackground} +%D +%D {\em This mechanism is sort of obsolete and textbackgrounds should +%D be used instead.} \def\dosetupbackground[#1]% {\getparameters[\??ag][#1]% @@ -3435,10 +3423,6 @@ {\localframed[\??ag][\c!offset=\v!overlay]{\flushnextbox}\egroup} \vbox} -%D \stopdocumentation -%D \stopbackground -%D \egroup - %D New, for the moment private; let's see when GB finds out %D about this one and its obscure usage. It's used in: %D diff --git a/tex/context/base/page-app.mkiv b/tex/context/base/page-app.mkiv index 810d26b95..5a880923a 100644 --- a/tex/context/base/page-app.mkiv +++ b/tex/context/base/page-app.mkiv @@ -17,30 +17,42 @@ \unprotect -\definepapersize - [\??fp\s!dummy] - [\c!width=\fittingwd, - \c!height=\fittinght] +\installframedcommandhandler \??fp {fittingpage} \??fp -\definelayout - [\??fp\s!dummy] - [\c!width=\fittingwd,\c!height=\fittinght,\c!location=\v!middle, - \c!topspace=\!!zeropoint,\c!backspace=\!!zeropoint, - \c!cutspace=\!!zeropoint,\c!bottomspace=\!!zeropoint, - \c!textdistance=\!!zeropoint,\c!lines=0,\c!grid=\v!no, - \c!top=\!!zeropoint,\c!bottom=\!!zeropoint, - \c!margin=\!!zeropoint,\c!edge=\!!zeropoint, - \c!leftmargin=\!!zeropoint,\c!leftedge=\!!zeropoint, - \c!rightmargin=\!!zeropoint,\c!rightedge=\!!zeropoint, - \c!header=\!!zeropoint,\c!footer=\!!zeropoint] +\newdimen\fitting_page_width +\newdimen\fitting_page_height +\newbox \fitting_page_box + +\definepapersize + [fittingpage] + [\c!width=\fitting_page_width, + \c!height=\fitting_page_height] \definemakeup - [\??fp\s!dummy] + [fittingpage] [\c!textstate=\v!empty, \c!doublesided=\v!no, - \c!pagestate=\getvalue{\currentfittingpage\c!pagestate}] + \c!pagestate=\fittingpageparameter\c!pagestate]% + +\definelayout + [fittingpage] + [\v!page] + +\setuplayout + [fittingpage] + [\c!width=\fitting_page_width, + \c!height=\fitting_page_height, + \c!location=\v!middle] + +\appendtoks + \setuevalue{\e!start\currentfittingpage}{\startfittingpage[\currentfittingpage]}% + \setuevalue{\e!stop \currentfittingpage}{\stopfittingpage}% +\to \everydefinefittingpage -\def\dostartfittingpage[#1][#2]% +\unexpanded\def\startfittingpage + {\dodoubleempty\start_fitting_page} + +\def\start_fitting_page[#1][#2]% {\page % this is kind of tricky! there can be preceding page refs \autostarttext \bgroup % resulting in a zero height page; test fig-make ! @@ -48,79 +60,82 @@ \dontcomplain % runs under current page regime, i.e. page variables passed to mp \getparameters[\currentfittingpage][\c!paper=,#2]% auto or size or nothing - \setbox\scratchbox\hbox - \bgroup - % needed later \getparameters[\currentfittingpage][\c!paper=,#2]% auto or size or nothing - \doifvalue{\currentfittingpage\c!margin}\v!page % undocumented - {\offsetbox + \doifelsenothing{\fittingpageparameter\c!command} + \start_fitting_page_normal + \start_fitting_page_command} + +\def\start_fitting_page_command + {\grabuntil{\e!stop\currentfittingpage}\stop_fitting_page_command} + +\def\stop_fitting_page_command#1% + {\start_fitting_page_normal + \fittingpageparameter\c!command{#1}% + \stop_fitting_page_normal} + +\def\start_fitting_page_normal + {\setbox\fitting_page_box\hbox + \bgroup + \inheritedfittingpageframed + \bgroup + \gobblespacetokens} + +\unexpanded\def\stop_fitting_page_normal + {\removeunwantedspaces + \egroup + \egroup + % finalize + \doif{\fittingpageparameter\c!margin}\v!page + {\setbox\fitting_page_box\hbox\bgroup + \offsetbox [\c!leftoffset=\backspace, \c!rightoffset=\cutspace, \c!topoffset=\topspace, - \c!bottomoffset=\bottomspace]\hbox}% - \bgroup - \scale[\c!scale=\getvalue{\currentfittingpage\c!scale}]% - \bgroup\localframed[\currentfittingpage]% - \bgroup} - -\def\dostopfittingpage - {\egroup % localframed - \egroup % scale - \egroup % offsetbox - \egroup % scratchbox - \edef\fittingwd{\the\wd\scratchbox}% - \edef\fittinght{\the\ht\scratchbox}% - \startlocallayout - \ifdim\fittinght<\lineheight + \c!bottomoffset=\bottomspace] + {\box\fitting_page_box}% + \egroup}% + \doifsomething{\fittingpageparameter\c!scale} + {\setbox\fitting_page_box\hbox\bgroup + \scale[\c!scale=\fittingpageparameter\c!scale]{\box\fitting_page_box}% + \egroup}% + \ifdim\ht\fitting_page_box<\lineheight % write status : too small \setbox\scratchbox\vbox to \lineheight{\vss\box\scratchbox\vss}% - \edef\fittinght{\the\lineheight}% \fi + \fitting_page_width \wd\fitting_page_box + \fitting_page_height\ht\fitting_page_box + \startlocallayout % still valid? \let\checkcurrentlayout\relax % else interference with odd/even layout \processaction - [\getvalue{\currentfittingpage\c!paper}] + [\fittingpageparameter\c!paper] [ \v!auto=>\def\fittingpapersize{\printpapersize}, \s!unknown=>\let\fittingpapersize\commalistelement, - \s!default=>\def\fittingpapersize{\??fp\s!dummy}]% - \expanded{\setuppapersize[\??fp\s!dummy][\fittingpapersize]}% - \definelayout - [\??fp\s!dummy]% - [\c!location=\v!middle, - \c!width=\fittingwd, - \c!height=\fittinght]% - \startmakeup[\??fp\s!dummy]% - \centerbox{\box\scratchbox}% + \s!default=>\def\fittingpapersize{fittingpage}]% + \expanded{\setuppapersize[fittingpage][\fittingpapersize]}% + \startmakeup[fittingpage]% + \box\fitting_page_box \stopmakeup - \stoplocallayout + \stoplocallayout % still valid? \egroup \autostoptext} -%D \TEX\ pages (for \METAPOST\ pages, see \type {meta-fig}): - -\presetlocalframed[\??tg] - -\unexpanded\def\setupTEXpage - {\dodoubleargument\getparameters[\??tg]} - -\unexpanded\def\startTEXpage - {\dosingleempty\dostartTEXpage} +\let\stopfittingpage\stop_fitting_page_normal -\def\dostartTEXpage[#1]% - {\dostartfittingpage[\??tg][#1]\gobblespacetokens} - -\unexpanded\def\stopTEXpage - {\removelastspace - \dostopfittingpage} - -\setupTEXpage - [\c!scale=1000, - \c!pagestate=, +\setupfittingpage + [%\c!scale=1000, + %\c!pagestate=, \c!strut=\v!no, - \c!align=\v!normal, % needed, else problems ! + \c!align=\v!normal, \c!offset=\v!overlay, \c!width=\v!fit, \c!height=\v!fit, \c!frame=\v!off] +%D \TEX\ pages (for \METAPOST\ pages, see \type {meta-fig}): + +\definefittingpage + [TEXpage] + [\c!align=\v!normal] % needed, else problems ! + %D For Mojca: %D %D \starttyping diff --git a/tex/context/base/page-flt.mkiv b/tex/context/base/page-flt.mkiv index 504e2b032..0a44ce992 100644 --- a/tex/context/base/page-flt.mkiv +++ b/tex/context/base/page-flt.mkiv @@ -1,6 +1,6 @@ %D \module %D [ file=page-flt, -%D version=2010.04,08, +%D version=2010.04.08, %D title=\CONTEXT\ Page Macros, %D subtitle=Float Management, %D author=Hans Hagen, diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index b3c2f535c..66ea7b79a 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -136,7 +136,7 @@ \to \everysetuplayout \def\doiflayoutdefinedelse#1% - {\ifcsname\??ly#1\c!state\endcsname % maybe a helper + {\ifcsname\namedlayouthash{#1}\c!state\endcsname % maybe a helper \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -1464,6 +1464,9 @@ \definelayout [\v!page] + +\setuplayout + [\v!page] [\c!backspace=\zeropoint, \c!cutspace=\zeropoint, \c!topspace=\zeropoint, diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv index 5ba859fa8..e70a8148d 100644 --- a/tex/context/base/page-lin.mkiv +++ b/tex/context/base/page-lin.mkiv @@ -12,7 +12,7 @@ %C details. % generic or not ... maybe not bother too much and simplify to mkiv only -% get rid of \mk* +% get rid of \mk* (left over from experimental times) \writestatus{loading}{ConTeXt Core Macros / Line Numbering} diff --git a/tex/context/base/page-mak.mkvi b/tex/context/base/page-mak.mkvi index 9cefa9ab2..4cc79ea14 100644 --- a/tex/context/base/page-mak.mkvi +++ b/tex/context/base/page-mak.mkvi @@ -42,7 +42,7 @@ \appendtoks \setuevalue{\e!start\currentmakeup\e!makeup}{\startmakeup[\currentmakeup]}% \setuevalue{\e!stop \currentmakeup\e!makeup}{\stopmakeup}% - \definelayout[\currentmakeup]% new + \doiflayoutdefinedelse\currentmakeup\donothing{\definelayout[\currentmakeup]}% new \to \everydefinemakeup %D The \type{\start}||\type{\stop} macros are used for both diff --git a/tex/context/base/page-mar.mkiv b/tex/context/base/page-mar.mkiv index 97a5e496f..7a091c485 100644 --- a/tex/context/base/page-mar.mkiv +++ b/tex/context/base/page-mar.mkiv @@ -230,7 +230,7 @@ \def\presetmargintext[#1]% {\presetlocalframed - [\??im#1]% + [\??im#1]% hm, isn't this gone ? \getparameters [\??im#1] [\c!frame=\v!off, diff --git a/tex/context/base/ppchtex.mkiv b/tex/context/base/ppchtex.mkiv index c14e8edb1..33a20fb68 100644 --- a/tex/context/base/ppchtex.mkiv +++ b/tex/context/base/ppchtex.mkiv @@ -1,5 +1,5 @@ %D \module -%D [ file=ppchtex (m-chemie), +%D [ file=ppchtex, %D version=1997.03.19, %D title=\CONTEXT\ Extra Modules, %D subtitle=\PPCHTEX\ (Plain Pictex Context cHemie \TEX), @@ -75,7 +75,6 @@ % gebruiken. De eerste module laad of efficiente wijze PiCTeX % en de tweede module koppelt het PSTRICKS kleurmechanisme % aan dat van \CONTEXT. -% % PSTricks: {-\chemicalangle} instead of {*0}, which produces % faulty ps code when \chemicalangle=0 diff --git a/tex/context/base/s-map-10.mkiv b/tex/context/base/s-map-10.mkiv index 56a8075d7..169a0d4b3 100644 --- a/tex/context/base/s-map-10.mkiv +++ b/tex/context/base/s-map-10.mkiv @@ -1,12 +1,11 @@ -%\module [ -% file=s-map-se, -% version=2011.06.28, -% title=\CONTEXT\ Style File, -% subtitle=\MAPS\ basis stijl, -% author={Hans Hagen, Taco Hoekwater and Siep Kroonenberg}, -% date=\currentdate, -% copyright={NTG / MAPS}% -%] +%D \module +%D [file=s-map-10, +%D version=2011.06.28, +%D title=\CONTEXT\ Style File, +%D subtitle=\MAPS\ basis stijl, +%D author={Hans Hagen, Taco Hoekwater and Siep Kroonenberg}, +%D date=\currentdate, +%D copyright=NTG/MAPS] % This module re-implements the MAPS style for use with the Context % macro package. The original MAPS layout was designed and @@ -311,7 +310,7 @@ indentnext=no% ] -\def\footnum#1{#1.} +\def\footnum#1{#1.} \setupfootnotes [location=none, @@ -368,7 +367,7 @@ Address=, Page=1, Title=, - Author=, + Author=, Period=, Number=, Year=, @@ -381,9 +380,9 @@ \doifinstringelse{utumn}{\MapsPeriod}{\gdef\MapsPeriod{NAJAAR}}{}% \doifnothing{\MapsYear}{\gdef\MapsYear{\the\year}}% \doifnothing{\MapsNumber}{% - \ifnum \normalmonth<6 + \ifnum \normalmonth<6 \xdef\MapsNumber{\the\numexpr (\the\year-1990)*2\relax}% - \else + \else \xdef\MapsNumber{\the\numexpr (\the\year-1990)*2+1\relax}% \fi }% \doifnothing\MapsRunningAuthor @@ -403,7 +402,7 @@ \switchtobodyfont[24pt] \setupalign[right] {\noindent\bf\MapsTitle\par} - \ifx\MapsSubTitle\empty + \ifx\MapsSubTitle\empty \blank[30pt] \else \bgroup diff --git a/tex/context/base/s-mod-00.mkii b/tex/context/base/s-mod-00.mkii index b3457658b..a81406a73 100644 --- a/tex/context/base/s-mod-00.mkii +++ b/tex/context/base/s-mod-00.mkii @@ -37,7 +37,7 @@ % nog eens \interface \\ \\ verder doorvoeren -\def\resetmodule +\def\resetmoduledocumentation {\getrawparameters [Module] [ file=\jobname, @@ -51,24 +51,18 @@ copyright=Unknown Copyright, suggestions=]} -\resetmodule +\resetmoduledocumentation -\def\dostartmodule[#1]% +\def\dostartmoduledocumentation[#1]% {\newcounter\ParagraphNumber - \resetmodule + \resetmoduledocumentation \getrawparameters[Module][type=tex,#1]} -\def\startmodule +\def\startmoduledocumentation {\starttext - \dosingleempty\dostartmodule} + \dosingleempty\dostartmoduledocumentation} -\def\complexmodule[#1]% - {\startglobal % i.v.m. \bgroup in \startdocumentation - \getrawparameters[Module][#1] - \stopglobal % i.v.m. \bgroup in \startdocumentation - \moduletitle} - -\def\stopmodule +\def\stopmoduledocumentation {\page \placeregister [\v!index] @@ -77,10 +71,16 @@ \c!criterium=\v!text] \stoptext} -\def\simplemodule#1% - {\type{#1}} - -\definecomplexorsimple\module +% \def\complexmodule[#1]% +% {\startglobal % i.v.m. \bgroup in \startdocumentation +% \getrawparameters[Module][#1] +% \stopglobal % i.v.m. \bgroup in \startdocumentation +% \moduletitle} +% +% \def\simplemodule#1% +% {\type{#1}} +% +% \definecomplexorsimple\module % \startmode[atpragma] % diff --git a/tex/context/base/s-mod-00.mkiv b/tex/context/base/s-mod-00.mkiv index fe1f25bb7..94f6edcb6 100644 --- a/tex/context/base/s-mod-00.mkiv +++ b/tex/context/base/s-mod-00.mkiv @@ -11,469 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D This module looks like crap, is not documented, will -%D change, and used to be called modu-*.tex. - -% now split in mkii/mkiv so we will cleanup - -\mainlanguage[en] % better not here - -\unprotect - -% beter: -% -% group -> title -% title -> category -% subtitle -> subtitle - -% herzien ivm fonts - -% nog eens \interface \\ \\ verder doorvoeren - -\def\resetmodule - {\getrawparameters - [Module] - [ file=\jobname, - type=, - version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, - system=\CONTEXT, - title=Unknown Title, - subtitle=, - author=Unknown Author, - date=\currentdate, - copyright=Unknown Copyright, - suggestions=]} - -\resetmodule - -\def\dostartmodule[#1]% - {\newcounter\ParagraphNumber - \resetmodule - \getrawparameters[Module][type=tex,#1]} - -\def\startmodule - {\starttext - \dosingleempty\dostartmodule} - -\def\complexmodule[#1]% - {\startglobal % i.v.m. \bgroup in \startdocumentation - \getrawparameters[Module][#1] - \stopglobal % i.v.m. \bgroup in \startdocumentation - \moduletitle} - -\def\stopmodule - {\page - \placeregister - [\v!index] - [\c!balance=\v!yes, - \c!indicator=\v!no, - \c!criterium=\v!text] - \stoptext} - -\def\simplemodule#1% - {\type{#1}} - -\definecomplexorsimple\module - -\startuseMPgraphic{titlepage} - - width := PaperWidth ; - height := PaperHeight ; - - color local_red, local_white, local_blue ; - - local_white := white ; - - local_blue := local_white randomized (.6,.8) ; - local_red := local_white randomized (.3,.4) ; - - u := width/400 ; - - def a_module (expr dx, dy) = - picture p ; p := image - ( ddy := 0 ; sx := 60u ; - for i=1 upto (4 randomized 2) : - sy := 7u randomized 3u ; - fill unitsquare xyscaled(sx,sy) shifted (0,ddy) - withcolor local_red ; - ddy := ddy + sy + 4u ; - endfor ) ; - p := p shifted (dx,dy) shifted - center p ; - fill boundingbox p enlarged 8u withcolor local_white ; - fill boundingbox p enlarged 4u withcolor local_blue ; - draw p ; - enddef ; - - set_grid(width, height, width/15, height/15) ; - forever: - if new_on_grid(uniformdeviate width,uniformdeviate height): - a_module(dx,dy) ; - fi ; - exitif grid_full ; - endfor ; - - clip currentpicture to unitsquare xyscaled(width,height) ; -\stopuseMPgraphic - -\defineoverlay - [titlepage] - [\useMPgraphic{titlepage}] - -\doifmode{atpragma}{\readfile{s-mod-04.tex}{}{}} - -\defineframed - [TitleFrame] - [\c!background=\v!color, - \c!backgroundcolor=white, - \c!align=\v!right, - \c!offset=12pt, - \c!strut=\v!no, - \c!frame=\v!off, - \c!bottom=] - -\definelayout - [titlepage] - [\c!backspace=0pt, - \c!topspace=0pt, - \c!header=0pt, - \c!footer=0pt, - \c!height=\v!middle, - \c!width=\v!middle] - -\def\moduletitle - {\setuplayout[titlepage] - \ifx\ModuleNumber\undefined \else - \ifnum\ModuleNumber<10 - \edef\ModuleNumber{00\ModuleNumber} - \else\ifnum\ModuleNumber<100 - \edef\ModuleNumber{0\ModuleNumber} - \fi\fi - \setupbackgrounds - [\v!page] - [\c!background=titlepage] - \fi - \startmakeup[\v!standard][\c!headerstate=\v!none,\c!footerstate=\v!none] - \switchtobodyfont[14.4pt,ss] - \bgroup - \def\CONTEXT {Con\kern-.15em\TeX t} - \def\TEXUTIL {\TeX Util} - \def\PPCHTEX {PPCH\TeX} - \def\METAPOST{MetaPost} - \hfill - {\definedfont[SansBold at 96pt]\setstrut - \TitleFrame{\Modulesystem}} - \vfill - \definetabulate[temp][|l|l|]% - \switchtobodyfont[17.3pt,ss] - \hfill - {\bf\setstrut - \TitleFrame - {\insidefloattrue\setuptabulate[\c!before=,\c!after=]% - \starttemp - \doifsomething{\Moduletitle} - {\NC title \EQ \Moduletitle \NC\NR}% - \doifsomething{\Modulesubtitle} - {\NC subtitle \EQ \Modulesubtitle \NC\NR}% - \doifsomething{\Moduleauthor} - {\NC author \EQ \Moduleauthor \NC\NR}% - \NC date \EQ \currentdate \NC\NR - %\doifsomething{\Modulesuggestions} % todo: generates space - % {\NC suggestions \NC \Modulesuggestions \NC\NR}% - \stoptemp}} - \egroup - \stopmakeup - \ifx\ModuleNumber\undefined \else - \setupbackgrounds - [\v!page] - [\c!background=] - \fi - \setuplayout} - -\let\stopdocumentation=\relax - -\def\startdocumentation - {\bgroup - \doglobal\newcounter\NOfMarginLines - \def\stopdocumentation{\par\egroup}} - -\newif\ifcompressdefinitions - -\def\startcompressdefinitions {\global\compressdefinitionstrue} -\def\stopcompressdefinitions {\global\compressdefinitionsfalse} - -\gdef\CompressDefinitions% - {\ifcompressdefinitions - \switchtobodyfont[\v!small]% - \fi} - -\startnotmode[nocode] - - \definetyping - [definition] - - \setuptyping - [definition] - [\c!before={\page[\v!preference]}\blank\PresetParagraphNumber\CompressDefinitions, - \c!after=\ResetParagraphNumber\blank, - \c!option=\Moduletype] - -\stopnotmode - -\startmode[nocode] - - \long\def\startdefinition#1\stopdefinition{} - -\stopmode - -\definetyping [PL] [\c!option=PL, \c!margin=\v!standard] -\definetyping [JV] [\c!option=JV, \c!margin=\v!standard] -\definetyping [MP] [\c!option=MP, \c!margin=\v!standard] -\definetyping [TEX] [\c!option=TEX,\c!margin=\v!standard] - -\setuptyping [\v!typing] [\c!margin=\v!standard] -\setuptyping [\v!file] [\c!margin=\v!standard] -\setuptyping [definition] [\c!margin=0pt] - -\newcounter\NOfMarginLines -\newcounter\ParagraphNumber - -\def\ResetParagraphNumber - {\egroup} - -\def\PresetParagraphNumber - {\bgroup - \xdef\NOfTextLines% - {\the\prevgraf}% - \doglobal\decrement\NOfMarginLines - \doglobal\increment\ParagraphNumber - \message{.}% - \gdef\ShowParagraphNumber% - {\llap{\slx\ParagraphNumber\hskip\leftmargindistance}}% - \gdef\ShowParagraphNumberA% - {\ifnum\NOfMarginLines>\NOfTextLines\relax - \doglobal\increment\NOfTextLines - \else - \ShowParagraphNumber - \global\let\ShowParagraphNumberA=\relax - \global\let\ShowParagraphNumberB=\ShowParagraphNumber - \doglobal\newcounter\NOfMarginLines - \fi}% - \gdef\ShowParagraphNumberB% - {}% - \EveryLine - {\ShowParagraphNumberA}% - \EveryPar - {\vadjust{\nobreak}% - \ShowParagraphNumberB}} - -\EveryPar % skip one - {\EveryPar - {\doglobal\newcounter\NOfMarginLines}} - -\unexpanded\def\dodomargeaanduidingen[#1]#2% - {\def\docommand##1% - {\indent\hbox - {\ifx#2\relax - \index{##1}% - \else - \index{#2{##1}}% - \fi - #2{\doboundtext{##1}{\leftmarginwidth}{..}}}% - \doglobal\increment\NOfMarginLines - \endgraf}% - \processcommalist[#1]\docommand} - -\unexpanded\def\margeaanduidingen#1[#2]% to be renamed - {\def\domargeaanduidingen##1##2% - {\margintitle[#2]% - {\switchtobodyfont[\v!small]% - \doglobal\newcounter\NOfMarginLines - \dodomargeaanduidingen[##1]#1% - \scratchcounter=\NOfMarginLines - \multiply\scratchcounter by 10 - \divide\scratchcounter by 12 - \advance\scratchcounter by 1 - \xdef\NOfMarginLines{\the\scratchcounter}% - \processcommalist[##2]\index}}% - \dodoublegroupempty\domargeaanduidingen} - -\unexpanded\def\complexmacros{\margeaanduidingen\tex } -\unexpanded\def\complexextras{\margeaanduidingen\relax} - -\unexpanded\def\complexelements - {\margeaanduidingen\someelement} - -\unexpanded\def\someelement#1{\type{<#1>}} - -\definecomplexorsimpleempty\macros -\definecomplexorsimpleempty\extras -\definecomplexorsimpleempty\elements - -% \def\showelements{\dodoubleempty\doshowelements} - -% \def\doshowelements[#1][#2] -% {\bgroup -% \processXMLbuffer -% \typebuffer -% \setupcolors[\c!state=\v!stop] -% \showXSDcomponent[#1][#2] -% \egroup} - -% \macros{a,b} -% \macros{a,b}{b} -% \macros[a]{a,b}{b} - -% weg ermee - -\defineparagraphs [interface] [\c!n=2] -\setupparagraphs [interface] [1] [\c!width=4cm] - -\def\startexample{\par\startnarrower} \let\startvoorbeeld\startexample -\def\stopexample {\stopnarrower} \let\stopvoorbeeld \stopexample - -\gdef\VisualizeLastSpace{\ifdim\lastskip>0pt\unskip\tttf\char32\fi} - -\gdef\ShowHeadText #1{\tttf#1\VL\mainlanguage[\currentlanguage]\headtext {#1}\VisualizeLastSpace} -\gdef\ShowLabelText#1{\tttf#1\VL\mainlanguage[\currentlanguage]\labeltext{#1}\VisualizeLastSpace} - -\startbuffer[lang-a] -\starttable[|l|l|] - \HL - \VL \bf head key \VL \bf current value \VL\SR - \HL - \VL \ShowHeadText \v!abbreviations \VL\FR - \VL \ShowHeadText \v!units \VL\MR - \VL \ShowHeadText \v!figures \VL\MR - \VL \ShowHeadText \v!graphics \VL\MR - \VL \ShowHeadText \v!index \VL\MR - \VL \ShowHeadText \v!content \VL\MR - \VL \ShowHeadText \v!intermezzi \VL\MR - \VL \ShowHeadText \v!logos \VL\MR - \VL \ShowHeadText \v!tables \VL\LR - \HL -\stoptable -\stopbuffer - -\startbuffer[lang-b] -\starttable[|l|l|] - \HL - \VL \bf label key \VL \bf current value \VL\SR - \HL - \VL \ShowLabelText \v!table \VL\FR - \VL \ShowLabelText \v!figure \VL\MR - \VL \ShowLabelText \v!intermezzo \VL\MR - \VL \ShowLabelText \v!graphic \VL\MR - \VL \ShowLabelText \v!chapter \VL\MR - \VL \ShowLabelText \v!section \VL\MR - \VL \ShowLabelText \v!subsection \VL\MR - \VL \ShowLabelText \v!subsubsection \VL\MR - \VL \ShowLabelText \v!appendix \VL\MR - \VL \ShowLabelText \v!part \VL\MR - \VL \ShowLabelText \v!line \VL\MR - \VL \ShowLabelText \v!lines \VL\LR - \HL -\stoptable -\stopbuffer - -\startbuffer[lang-c] -\starttable[|l|l|] - \HL - \VL \bf label key \VL \bf current value \VL\SR - \HL - \VL \ShowLabelText \v!january \VL\FR - \VL \ShowLabelText \v!february \VL\MR - \VL \ShowLabelText \v!march \VL\MR - \VL \ShowLabelText \v!april \VL\MR - \VL \ShowLabelText \v!may \VL\MR - \VL \ShowLabelText \v!june \VL\MR - \VL \ShowLabelText \v!july \VL\MR - \VL \ShowLabelText \v!august \VL\MR - \VL \ShowLabelText \v!september \VL\MR - \VL \ShowLabelText \v!october \VL\MR - \VL \ShowLabelText \v!november \VL\MR - \VL \ShowLabelText \v!december \VL\LR - \HL -\stoptable -\stopbuffer - -\startbuffer[lang-d] -\starttable[|l|l|] - \HL - \VL \bf label key \VL \bf current value \VL\SR - \HL - \VL \ShowLabelText \v!sunday \VL\FR - \VL \ShowLabelText \v!monday \VL\MR - \VL \ShowLabelText \v!tuesday \VL\MR - \VL \ShowLabelText \v!wednesday \VL\MR - \VL \ShowLabelText \v!thursday \VL\MR - \VL \ShowLabelText \v!friday \VL\MR - \VL \ShowLabelText \v!saturday \VL\LR - \HL -\stoptable -\stopbuffer - -\gdef\ShowTextsValues[#1][#2]% - {\vbox\bgroup - \language[#1]% - \setbox\scratchbox\hbox to \hsize{\hss\bfb#2 language defaults\hss} - \dp\scratchbox\zeropoint - \box\scratchbox - \vskip1em - \hrule - \vskip2em - \halign - {\hss##\hss&##\hskip1em&\hss##\hss\cr - $\vcenter{\getbuffer[lang-a]}$&&$\vcenter{\getbuffer[lang-b]}$\cr - \noalign{\vskip1em} - $\vcenter{\getbuffer[lang-c]}$&&$\vcenter{\getbuffer[lang-d]}$\cr}% - \egroup} - -\gdef\ShowLanguageValues[#1][#2]#3#4% - {\hbox to \hsize - {\hss - \vbox - \bgroup - \language[#1]% - \let\normalbar=| - \starttable[||||] - \HL - \VL \THREE{\bf subsentence symbol and quotes} \VL\SR - \HL - \VL \quotation{#3 #4} \VL \quote{#2} \VL \let|=\normalbar |<||<|#3|>|#4|>| \VL\FR - \VL \quotation{#3 #4} \VL \quote{#2} \VL |<||<|#3|>|#4|>| \VL\LR - \HL - \stoptable - \egroup - \hss}} - -\gdef\doShowAllLanguageValues[#1][#2]#3#4% - {\vbox - {\ShowTextsValues[#1][#2] - \vskip2em - \ShowLanguageValues[#1][#2]{#3}{#4}} - \protect - \page} - -\gdef\ShowAllLanguageValues - {\page - \unprotect - \dodoubleargument\doShowAllLanguageValues} - -\protect - -%D Command references: - -\usemodule[int-load] \loadsetups - \unprotect -\def\showsetup#1% - {{\def\y##1{\writestatus{setups}{warning: remove y! from #1}}% - \setup{#1}}} - -\setupframedtexts - [setuptext] - [\c!background=\v!screen, - \c!frame=\v!off] +% gone \protect \endinput diff --git a/tex/context/base/s-mod-01.mkiv b/tex/context/base/s-mod-01.mkiv index fc34d1a11..2feeaad77 100644 --- a/tex/context/base/s-mod-01.mkiv +++ b/tex/context/base/s-mod-01.mkiv @@ -16,23 +16,243 @@ % now split in mkii/mkiv so we will cleanup -\usemodule[mod-00,abr-01] +\unprotect -\dontcomplain +\setvariables + [document] + [ file=\jobname, + type=unknown, + version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, + system=\CONTEXT, + title=Unknown Title, + subtitle=, + author=Unknown Author, + date=\currentdate, + copyright=Unknown Copyright, + suggestions=] -\unprotect +\let\module\setupdocument -\setupbodyfont - [10pt] +\definepalet [module:unknown] [localone=black,localtwo=white] + +\definepalet [module:tex] [localone=blue,localtwo=green] +\definepalet [module:mkii] [localone=blue,localtwo=green] +\definepalet [module:mkiv] [localone=blue,localtwo=green] +\definepalet [module:mkvi] [localone=blue,localtwo=green] + +\definepalet [module:lua] [localone=red,localtwo=green] +\definepalet [module:cld] [localone=red,localtwo=green] + +\definepalet [module:mp] [localone=red,localtwo=blue] +\definepalet [module:mpii] [localone=red,localtwo=blue] +\definepalet [module:mpiv] [localone=red,localtwo=blue] +\definepalet [module:metapost][localone=red,localtwo=blue] + +\setuppalet + [module:unknown] + +\startuseMPgraphic{page} + + StartPage ; + + color local_white ; local_white := .8white ; + color local_one ; local_one := \MPcolor{localone} randomized (.6,.8) ; + color local_two ; local_two := \MPcolor{localtwo} randomized (.3,.4) ; + + color local_one ; local_one := .75[\MPcolor{localone},white] ; + color local_two ; local_two := .75[\MPcolor{localtwo},white] ; + + numeric width ; width := bbwidth Page ; + numeric height ; height := bbheight Page ; + + u := width/400 ; + + def a_module (expr dx, dy) = + picture p ; p := image ( + ddy := 0 ; sx := 60u ; + for i=1 upto (4 randomized 2) : + sy := 7u randomized 3u ; + fill unitsquare xyscaled(sx,sy) shifted (0,ddy) withcolor local_two ; + ddy := ddy + sy + 4u ; + endfor ; + ) ; + p := p shifted (dx,dy) shifted - center p ; + fill boundingbox p enlarged 8u withcolor local_white ; + fill boundingbox p enlarged 4u withcolor local_one ; + draw p ; + enddef ; + + set_grid(width, height, width/15, height/15) ; + + forever: + if new_on_grid(uniformdeviate width,uniformdeviate height): + a_module(dx,dy) ; + fi ; + exitif grid_full ; + endfor ; + + picture p ; + + draw image ( + draw anchored.urt(textext("\bf\strut\documentvariable{system}") ysized 5.0cm,urcorner Page shifted (-1cm,- 1cm)) ; + draw anchored.urt(textext("\bf\strut\documentvariable{title}") ysized 1.5cm,urcorner Page shifted (-1cm,- 8cm)) ; + draw anchored.urt(textext("\bf\strut\documentvariable{subtitle}") ysized 1.5cm,urcorner Page shifted (-1cm,-10cm)) ; + draw anchored.urt(textext("\bf\strut\documentvariable{author}") ysized 1.5cm,lrcorner Page shifted (-1cm, 5cm)) ; + draw anchored.urt(textext("\bf\strut\currentdate") ysized 1.5cm,lrcorner Page shifted (-1cm, 3cm)) ; + ) withcolor .25white ; + + StopPage ; + +\stopuseMPgraphic + +\startsetups[document:start] + + \setuppalet + [module:\documentvariable{type}] + + \startTEXpage + \useMPgraphic{page} + \stopTEXpage + + \page[right] + +\stopsetups + +\startsetups[document:stop] + + \page + + \placeregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no, + \c!criterium=\v!text] + +\stopsetups + +\unexpanded\def\startmoduledocumentation + {\starttext + \page + \begingroup + \startdocument} + +\unexpanded\def\stopmoduledocumentation + {\stopdocument + \page + \endgroup + \stoptext} + +\unexpanded\def\startdocumentation % grouped ! + {\par + \bgroup} + +\unexpanded\def\stopdocumentation + {\par + \egroup} + +\definetyping + [definition] + +\unexpanded\def\startcompressdefinitions + {\blank + \begingroup + \setuptyping[definition][bodyfont=small]} + +\unexpanded\def\stopcompressdefinitions + {\blank + \endgroup} + +\doifnotmode {nocode} { % \startmode ... \stopmode fails in the module documentation + + \unexpanded\def\startdefinition{\gobbleuntil\stopdefinition} + \unexpanded\def\stopdefinition {} + +} + +\definetyping [PL] [\c!option=PL] +\definetyping [JV] [\c!option=JV] +\definetyping [MP] [\c!option=MP] +\definetyping [TEX] [\c!option=TEX] +\definetyping [LUA] [\c!option=LUA] + +\setuptyping [\v!typing] [\c!margin=\v!standard] +\setuptyping [\v!file] [\c!margin=\v!standard] +\setuptyping [definition] [\c!margin=0pt,\c!numbering=\v!line,\c!continue=\v!yes] % this continue wins + +\setuplinenumbering + [definition] + [\c!style=\ttx, + \c!distance=\leftmargindistance, + \c!align=\v!flushright] + +\unexpanded\def\dodomodulemarginstuff[#1]#2% + {\def\docommand##1% + {\indent\hbox + {\ifx#2\relax + \index{##1}% + \else + \index{#2{##1}}% + \fi + #2{\doboundtext{##1}{\leftmarginwidth}{..}}}% + \endgraf}% + \processcommalist[#1]\docommand} + +\unexpanded\def\modulemarginstuff#1[#2]% to be renamed + {\def\domodulemarginstuff##1##2% + {\margintitle[#2]% + {\switchtobodyfont[\v!small]% + \dodomodulemarginstuff[##1]#1% + \processcommalist[##2]\index}}% + \dodoublegroupempty\domodulemarginstuff} + +\unexpanded\def\complexmacros {\modulemarginstuff\tex } +\unexpanded\def\complexextras {\modulemarginstuff\relax} +\unexpanded\def\complexelements{\modulemarginstuff\someelement} + +\unexpanded\def\someelement#1{\type{<#1>}} + +\definecomplexorsimpleempty\macros +\definecomplexorsimpleempty\extras +\definecomplexorsimpleempty\elements + +% \macros{a,b} +% \macros{a,b}{b} +% \macros[a]{a,b}{b} + +% weg ermee + +\defineparagraphs [interface] [\c!n=2] +\setupparagraphs [interface] [1] [\c!width=4cm] + +\def\startexample{\par\startnarrower} +\def\stopexample {\stopnarrower} + +%D Command references: + +\usemodule[int-load] \loadsetups + +\let\showsetup\setup + +\setupframedtexts + [setuptext] + [\c!background=\v!screen, + \c!frame=\v!off] -\definetypeface [narrowtt] [tt] [mono] [modern-cond] [default] +% style (we use dejavu as it supports more characters) -\setuptyping[\v!typing][\c!style=\narrowtt] -\setuptype [\v!type] [\c!style=\narrowtt] +\switchtobodyfont + [dejavu-condensed,10pt] % preload + +\setupbodyfont + [dejavu,10pt] % main font \mainlanguage [en] +\setuptyping + [\v!typing] + [\c!bodyfont=dejavu-condensed] + \setupwhitespace [\v!big] @@ -54,49 +274,30 @@ \c!height=middle, \c!style=\ss] -\setupsetup - [\c!reference=1] % mkiv? - -\startnotmode[single] - - \setuppagenumbering - [\c!alternative={\v!doublesided,\v!singlesided}] - -\stopnotmode - \setuppagenumbering [\c!location=] +\setuppagenumbering + [\c!alternative={\v!doublesided,\v!singlesided}] + \setupfootertexts [\v!edge] - [][\v!pagenumber] - -\startmode[single] + [][\pagenumber] - \setupfootertexts - [\v!margin] - [\filename{\Modulefile}][] - -\stopmode - -\startnotmode[single] - - \setupfootertexts - [\v!margin] - [\filename{\Modulefile}][] - [\filename{\Modulefile}][] - -\stopnotmode +\setupfootertexts + [\v!margin] + [\filename{\documentvariable{file}}][] + [\filename{\documentvariable{file}}][] \setupfootertexts [\v!text] [\CONTEXT] - [\Moduletitle] + [\documentvariable{title}] \setupheadertexts [\v!text] [] - [\Modulesubtitle] + [\documentvariable{subtitle}] \setupinmargin [\c!location=\v!left] @@ -106,15 +307,19 @@ \setuphead [\v!chapter] - [\c!style=\ssc, + [\c!style=\bfc, \c!page=\v!right, \c!header=\v!empty] \setuphead [\v!section] - [\c!style=\ssb, + [\c!style=\bfb, \c!page=\v!right] +\setuphead + [\v!subsection] + [\c!style=\bfa] + \setuplist [\v!chapter] [\c!style=\v!bold, @@ -130,12 +335,6 @@ [\c!balance=\v!yes, \c!indicator=\v!no] -\startmode[nocolor] - - \setupcolors - [\c!conversion=\v!always] - -\stopmode \setupinteraction [\c!state=\v!start, @@ -143,4 +342,43 @@ \c!contrastcolor=, \c!style=] -\protect \endinput +% modes + +\doifmode {nocolor} { + + \setupcolors + [\c!conversion=\v!always] + +} + +\doifmode {single} { + + \setuppagenumbering + [\c!alternative=\v!singlesided] + + \setupfootertexts + [\v!margin] + [\filename{\documentvariable{file}}][] + +} + +% bonus + +\usemodule + [abr-01] + +% another one + +\dontcomplain + +\protect + +\continueifinputfile{s-mod-01.mkiv} + +\startmodule + + \macros{alpha,beta} + + \input ward + +\stopmodule diff --git a/tex/context/base/s-mod-02.mkiv b/tex/context/base/s-mod-02.mkiv index 067599668..032ace8a6 100644 --- a/tex/context/base/s-mod-02.mkiv +++ b/tex/context/base/s-mod-02.mkiv @@ -11,410 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\endinput - -%D This module looks like crap, is not documented, will -%D change, and used to be called modu-*.tex. - -% now split in mkii/mkiv so we will cleanup (needed) - -% Macro's - -\usemodule[mod-00] - \unprotect -% todo: internationalize + setups - -\setuphead - [section] - [expansion=command] - -\def\complexmodule[#1]% redefined - {\getgparameters[Module][#1] - \normalexpanded{\section{\Modulesubtitle}} - \WriteLists} - -\def\stopmodule % redefined - {\page - \determineregistercharacteristics - [index] - [criterium=section] - \doifmode{*register} - {\pagereference - [index] - \placeregister - [index] - [balance=yes, - indicator=no, - criterium=section]}} - -\let\ComposeLists=\relax - -\newcounter\ModuleNumber - -\newwrite\BatchFile \openout\BatchFile=\jobname.bat - -\def\WriteBatchFile - {\doglobal\increment\ModuleNumber - \immediate\write\BatchFile{texmfstart texexec --pdf --modu --batch \FileName }} - -\newif\ifProcessingPublic - -\def\WriteLists - {\writetolist[FileNames] {}{\FileName} - \writetolist[GroupItems]{}{\GroupItem}} - -\def\moduletitle{} - -\def\TypeZeroModule#1% - {\section{[to be extracted: #1]} - {\em This module is not yet split off.} - \WriteLists} - -\def\TypeOneModule#1% - {\section{[to be documented: #1]} - {\em This module is not yet fully documented.} - \WriteLists} - -\def\TypeTwoModule#1% - {\ifProcessingPublic - \readfile{#1.ted}{}{}% - \WriteBatchFile - \else - \section{[not yet public: #1]} - {\em This module is documented but not yet public.} - \WriteLists - \fi} - -\def\TypeThreeModule#1% - {\readfile{#1.ted}{}{}% - \WriteBatchFile} - -\def\processmodule#1#2% - {\page - \bgroup - \def\FileName{#1} - \setupreferencing[prefix=#1] - \useexternaldocument[PaperVersion][#1][] - \aftersplitstring#1\at-\to\GroupItem - \ComposeLists - \ifcase#2 - \TypeZeroModule{#1} - \or - \TypeOneModule{#1} - \or - \TypeTwoModule{#1} - \or - \TypeThreeModule{#1} - \fi - \page - \setupreferencing[prefix=] - \egroup} - -\def\ModuleGroup#1#2% - {\page - \let\Modulefile=\empty - \setupreferencing[prefix=#1] - \def\FileGroup{#1} - \writetolist[FileGroups]{}{\FileGroup} - \chapter[content]{#2} - \MakeListOfItems - \MakeListOfNames - \MakeListOfGroups - \placecontent[criterium=chapter,level=section]} - -% Layout - -\setupbodyfont - [9pt] - -\setuppapersize - [S6][S6] - -\setuplayout - [backspace=72.5pt, - leftmargin=50pt, - leftmargindistance=12.5pt, - rightmargin=0pt, - rightedge=80pt, - rightedgedistance=10pt, - leftedge=0pt, - width=430pt, - topspace=10pt, - header=0pt, - footer=30pt, - bottomdistance=10pt, - bottom=15pt, - height=410pt, - style=\ss] - -\setuptyping - [palet=colorpretty] - -\setupsetup - [reference=3] - -\definecolor [AchtergrondKleur] [s=.6] -\definecolor [ButtonKleur] [r=.2,g=.2,b=.6] -\definecolor [TekstKleur] [r=.6,g=.2,b=.2] - -\definecolor [colorprettyone] [r=.6,g=.0,b=.0] % red -\definecolor [colorprettytwo] [r=.0,g=.6,b=.0] % green -\definecolor [colorprettythree] [r=.0,g=.0,b=.6] % blue -\definecolor [colorprettyfour] [r=.6,g=.6,b=.0] % yellow - -\setupinteraction - [state=start, - page=yes, - contrastcolor=, - menu=on, - color=] - -\setupbackgrounds - [page] - [background=color, - backgroundcolor=AchtergrondKleur, - offset=2.5pt] % this offset influences the menus! - -\setupbackgrounds - [text,footer] - [text,leftmargin] - [background=color, - backgroundcolor=white] - -\setupsubpagenumber - [way=bysection, - state=start] - -\setupinteractionbar - [frame=off, - offset=0pt, - height=fit] - -\setupwhitespace - [big] - -\setuptyping - [typing] - [option=color] - -\setuptyping - [definition] - [option=color] - -\setuptyping - [file] - [option=color] - -\setuppagenumbering - [alternative=singlesided, - way=bysection, - state=none] - -\setupinmargin - [location=left] - -\setupheads - [alternative=inmargin] - -\setuphead - [chapter] - [style=\ssc, - page=right] - -\setuphead - [section] - [style=\ssb, - page=right] - -\setuplist - [chapter] - [style=bold, - after=\blank] - -\setupcontent - [width=2em] - -\setupindex - [balance=yes, - indicator=no] - -\setupcolors - [state=start] - -\def\TitelBlad#1% - {\startstandardmakeup - \definefont[GrootFont] [SansBold at 72pt] - \definefont[MiddelFont][Sans at 32pt] - \definefont[KleinFont] [Sans at 24pt] - \startcolor[AchtergrondKleur] - \vskip12pt - \midaligned{\GrootFont\setstrut\strut Con\TeX t} - \vskip24pt - \midaligned{\MiddelFont\setstrut\strut #1} - \vskip24pt - \midaligned{\KleinFont\setstrut\strut Hans Hagen} - \vfilll - \midaligned{\KleinFont\setstrut\strut PRAGMA ADE} - \vskip24pt - \midaligned{\KleinFont\setstrut\strut www.pragma-ade.com --- \currentdate} - \vskip12pt - \stopcolor - \stopstandardmakeup} - -\def\ColofonBlad - {\startmode[atpragma] - \page - \bgroup - \def\PragmaHoogte {\makeupheight} - \def\PragmaBreedte{\textwidth} - \def\PragmaKopwit {\topspace} - \def\PragmaRugwit {\backspace} - \def\PragmaMarge {0pt} - \PragmaLijnentrue - \PlaatsPragmaLogo[ADE] - \vfill - todo: colofon - \startnarrower[3*middle] - This is the official documentation of \CONTEXT\ version - \referraldate, a \TEX\ macropackage developed by J.~Hagen - \& A.F.~Otten, who both hold the copyrights. - \stopnarrower - \vfill - \page - \egroup - \stopmode} - -\def\ColofonBlad - {} - -\newbox\ListOfItems -\newbox\ListOfGroups -\newbox\ListOfNames - -\definelist[FileNames] \def\FileName {} -\definelist[FileGroups] \def\FileGroup {} -\definelist[GroupItems] \def\GroupItem {} - -\setuplist - [FileNames,FileGroups,FileGroups] - [expansion=yes, - pagenumber=no, - style=\ss\bf] - -\setuplist - [FileNames] - [command=\FileNameEntry, - after=\endgraf, - alternative=none] % horizontal - -\setuplist - [FileGroups] - [command=\FileGroupEntry, - after=\hss, - alternative=horizontal] - -\def\FileNameEntry#1#2#3% - {\strut\hbox{#2}\endgraf} - -\def\FileGroupEntry#1#2#3% - {\strut\hbox{#2}\endgraf} - -\def\MakeListOfItems - {\setbox\ListOfItems=\vbox - {\ss\bf - \placelist[GroupItems][color=ButtonKleur,contrastcolor=white,criterium=chapter]}} - -\def\MakeListOfNames - {\setbox\ListOfNames=\vbox - {\hsize\rightedgewidth - \ss\bf\setupinterlinespace - \startsimplecolumns[distance=10pt] - \placelist[FileNames][color=ButtonKleur,contrastcolor=white,criterium=chapter] - \stopsimplecolumns}} - -\def\MakeListOfGroups - {\setbox\ListOfGroups=\hbox to \textwidth - {\ss\bf - \setupinteraction[color=ButtonKleur]% - \placelist[FileGroups][color=ButtonKleur,contrastcolor=white,criterium=all]\unskip\unskip}} - -\setbox\ListOfGroups=\hbox{} - -%\setupfootertexts -% [rand] -% [] -% [{\interactiebalk[variant=g]}] - -\setupinteractionmenu - [right,bottom] - [state=start, - frame=off, - color=AchtergrondKleur, - contrastcolor=white, - style=\ss\bf, - height=15pt, - offset=0pt, - inbetween=\vskip5pt, - background=color, - backgroundcolor=ButtonKleur] - -\startinteractionmenu[right] - \boxofsize \vbox \textheight \footerdistance \footerheight 5pt - \bgroup - \copy\ListOfNames - \vfill - \but [\FileGroup:content] local contents \\ - \but [\FileName:index] local register \\ - \but [PaperVersion::begin] paper version \\ - \but [content] main contents \\ - \but [index] main register \\ - \but [PreviousJump] previous jump \\ - \but [CloseDocument] close document \\ - \unskip - \egroup -\stopinteractionmenu - -\startinteractionmenu[bottom] - \unhcopy\ListOfGroups -\stopinteractionmenu - -\def\placemoduleregister - {\startbackmatter - \setupsubpagenumber[reset] - \title[-:index]{Register} - \placeregister[index] - \stopbackmatter} - -\def\placemodulecontent - {\startfrontmatter - \title[-:content]{Contents} - \setupinteractionbar[state=stop] - \placecontent[criterium=text,level=chapter] - \stopfrontmatter} - -\setupcontent - [pagenumber=no, - level=chapter, - interaction=all, - style=, - before=, - after=] - -\setupfootertexts - [margin] - [\tt\Modulefile] - [] - -\setupfootertexts - [text] - [chapter][chapter] - -\setupindex - [symbol=1] - -\setuptolerance - [verytolerant] +% gone \protect \endinput diff --git a/tex/context/base/s-mod.ctx b/tex/context/base/s-mod.ctx index a85c991a5..5059c77d4 100644 --- a/tex/context/base/s-mod.ctx +++ b/tex/context/base/s-mod.ctx @@ -14,6 +14,7 @@ <!-- ctx:flag>purge</ctx:flag --> <ctx:flag>global</ctx:flag> <ctx:flag>prep</ctx:flag> + <ctx:flag>purge</ctx:flag> </ctx:flags> <ctx:process> <ctx:resources> diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv index d0ede466d..88374e497 100644 --- a/tex/context/base/spac-hor.mkiv +++ b/tex/context/base/spac-hor.mkiv @@ -83,7 +83,7 @@ \def\simplesetupindenting % empty case, a it strange, needed this way? {\assigndimension\currentindentation\ctxparindent{1em}{1.5em}{2em}} -\def\indenting % kind of obsolete +\unexpanded\def\indenting % kind of obsolete {\dosingleargument\complexsetupindenting} % use \noindentation to suppress next indentation @@ -115,8 +115,14 @@ \parindent\zeropoint \indentingtogglestate\zerocount} -\def\noindenting{\indenting[\v!no, \v!next ]} -\def\doindenting{\indenting[\v!yes,\v!first]} +\defineindentingmethod [\v!toggle] {\parindent\ifdim\parindent=\zeropoint + \ctxparindent + \else + \zeropoint + \fi\relax} + +\unexpanded\def\noindenting{\indenting[\v!no, \v!next ]} +\unexpanded\def\doindenting{\indenting[\v!yes,\v!first]} %D This one sets up the local indentation behaviour (i.e. either or not %D a next paragraph will be indented). diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 52c33d9e6..0d023d90e 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 38cfa4611..31d2db8db 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 6eae3bdcf..213caf30d 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -290,21 +290,44 @@ end references.resolvers = references.resolvers or { } local resolvers = references.resolvers -function resolvers.section(var) - local vi = var.i[3] or lists.collected[var.i[2]] +local function getfromlist(var) + local vi = var.i if vi then - var.i = vi - var.r = (vi.references and vi.references.realpage) or (vi.pagedata and vi.pagedata.realpage) or 1 + vi = vi[3] or lists.collected[vi[2]] + if vi then + local r = vi.references and vi.references + if r then + r = r.realpage + end + if not r then + r = vi.pagedata and vi.pagedata + if r then + r = r.realpage + end + end + var.i = vi + var.r = r or 1 + else + var.i = nil + var.r = 1 + end else var.i = nil var.r = 1 end end -resolvers.float = resolvers.section -resolvers.description = resolvers.section -resolvers.formula = resolvers.section -resolvers.note = resolvers.section +-- resolvers.section = getfromlist +-- resolvers.float = getfromlist +-- resolvers.description = getfromlist +-- resolvers.formula = getfromlist +-- resolvers.note = getfromlist + +setmetatableindex(resolvers,function(t,k) + local v = getfromlist + resolvers[k] = v + return v +end) function resolvers.reference(var) local vi = var.i[2] -- check @@ -1105,8 +1128,14 @@ local function identify_inner(set,var,prefix,collected,derived,tobesaved) if i then var.kind = "inner" var.i = i - resolvers[i[1]](var) var.p = p + local ri = resolvers[i[1]] + if ri then + ri(var) + else + -- can't happen as we catch it with a metatable now + report_references("unknown inner resolver for '%s'",i[1]) + end else -- no prefixes here local s = specials[inner] diff --git a/tex/context/base/supp-box.lua b/tex/context/base/supp-box.lua index 48baecf6f..853de4cbe 100644 --- a/tex/context/base/supp-box.lua +++ b/tex/context/base/supp-box.lua @@ -47,7 +47,7 @@ end commands.hyphenatedlist = hyphenatedlist function commands.showhyphenatedinlist(list) - report_hyphenation("show: %s",nodes.listtoutf(list)) + report_hyphenation("show: %s",nodes.listtoutf(list,false,true)) end local function checkedlist(list) diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv index caded9e1f..53c4b3b1a 100644 --- a/tex/context/base/supp-box.mkiv +++ b/tex/context/base/supp-box.mkiv @@ -1350,17 +1350,17 @@ %D %D Shows up as: %D -%D \startvoorbeeld +%D \startexample %D \vskip3\baselineskip %D \getbuffer -%D \stopvoorbeeld +%D \stopexample %D %D Before displaying the result we added some skip, otherwise %D the first two lines would have ended up in the text. This %D macro can be useful when building complicated menus, headers %D and footers and|/|or margin material. -\unexpanded\def\sbox% in handleiding, voorbeeld \inleft{xx} \extern.. +\unexpanded\def\sbox {\normalvbox\bgroup % new ! ! ! \dowithnextbox {\setbox\scratchbox\normalhbox diff --git a/tex/context/base/supp-num.mkiv b/tex/context/base/supp-num.mkiv index a55ee1fb3..a9211d62b 100644 --- a/tex/context/base/supp-num.mkiv +++ b/tex/context/base/supp-num.mkiv @@ -45,12 +45,12 @@ %D \stopbuffer %D %D \typebuffer -%D -%D This is typset as: -%D -%D \startlines -%D \getbuffer -%D \stoplines +% +% This is typset as: +% +% \startlines +% \getbuffer +% \stoplines %D %D The sign can be typeset as is or within the space of a %D digit. @@ -64,11 +64,11 @@ %D %D \typebuffer %D -%D This is typset as: -%D -%D \startlines -%D \getbuffer -%D \stoplines +% This is typset as: +% +% \startlines +% \getbuffer +% \stoplines \chardef\digitoutputmode=1 % 0..6 \chardef\digitsignmode =0 % 0..3 @@ -354,10 +354,10 @@ %D \stopbuffer %D %D \typebuffer -%D -%D \startlines -%D \getbuffer -%D \stoplines +% +% \startlines +% \getbuffer +% \stoplines %D \macros %D {Digits} diff --git a/tex/context/base/typo-cap.mkiv b/tex/context/base/typo-cap.mkiv index 8a50bedef..fd520da59 100644 --- a/tex/context/base/typo-cap.mkiv +++ b/tex/context/base/typo-cap.mkiv @@ -36,11 +36,9 @@ %D %D This calls result in: %D -%D \startvoorbeeld %D \startlines %D \getbuffer %D \stoplines -%D \stopvoorbeeld %D %D \showsetup{Word} %D \showsetup{Words} @@ -83,11 +81,9 @@ %D Note the use of \type{\nocap}, \type{\\} and the nested %D \type{\cap}. %D -%D \startvoorbeeld %D \startlines %D \getbuffer %D \stoplines -%D \stopvoorbeeld %D %D These macros show te main reason why we introduced the %D smaller \type{\tx} and \type{\txx}. diff --git a/tex/context/base/x-udhr.mkiv b/tex/context/base/x-udhr.mkiv index 164b74d83..81075ac70 100644 --- a/tex/context/base/x-udhr.mkiv +++ b/tex/context/base/x-udhr.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D The XML files can be fetched from: \url {http://unicode.org/udhr/}. +%D The XML files can be fetched from: \from[http://unicode.org/udhr/]. \startmodule[udhr] diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 68074b44e..d80fbedcb 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -612,6 +612,7 @@ <cd:constant name='commandafter' value='prikazpo'/> <cd:constant name='commandbefore' value='predchoziprikaz'/> <cd:constant name='commands' value='prikazy'/> + <cd:constant name='commentoffset' value='commentoffset'/> <cd:constant name='compact' value='compact'/> <cd:constant name='component' value='component'/> <cd:constant name='compoundhyphen' value='compoundhyphen'/> @@ -659,6 +660,7 @@ <cd:constant name='equalwidth' value='equalwidth'/> <cd:constant name='escape' value='escape'/> <cd:constant name='evenmargin' value='sudamarginalie'/> + <cd:constant name='exitoffset' value='labeloffset'/> <cd:constant name='expansion' value='expanzen'/> <cd:constant name='export' value='export'/> <cd:constant name='extras' value='extras'/> @@ -737,6 +739,7 @@ <cd:constant name='keys' value='keys'/> <cd:constant name='keyword' value='keyword'/> <cd:constant name='label' value='popisek'/> + <cd:constant name='labeloffset' value='labeloffset'/> <cd:constant name='lastnamesep' value='lastnamesep'/> <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 15351d5bb..24582c78a 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -612,6 +612,7 @@ <cd:constant name='commandafter' value='zumbefehl'/> <cd:constant name='commandbefore' value='vorbefehl'/> <cd:constant name='commands' value='befehle'/> + <cd:constant name='commentoffset' value='commentoffset'/> <cd:constant name='compact' value='compact'/> <cd:constant name='component' value='component'/> <cd:constant name='compoundhyphen' value='compoundhyphen'/> @@ -659,6 +660,7 @@ <cd:constant name='equalwidth' value='equalwidth'/> <cd:constant name='escape' value='escape'/> <cd:constant name='evenmargin' value='geraderand'/> + <cd:constant name='exitoffset' value='labeloffset'/> <cd:constant name='expansion' value='expansion'/> <cd:constant name='export' value='export'/> <cd:constant name='extras' value='extras'/> @@ -737,6 +739,7 @@ <cd:constant name='keys' value='keys'/> <cd:constant name='keyword' value='keyword'/> <cd:constant name='label' value='label'/> + <cd:constant name='labeloffset' value='labeloffset'/> <cd:constant name='lastnamesep' value='lastnamesep'/> <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index c51105a51..6a01a537e 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -612,6 +612,7 @@ <cd:constant name='commandafter' value='commandafter'/> <cd:constant name='commandbefore' value='commandbefore'/> <cd:constant name='commands' value='commands'/> + <cd:constant name='commentoffset' value='commentoffset'/> <cd:constant name='compact' value='compact'/> <cd:constant name='component' value='component'/> <cd:constant name='compoundhyphen' value='compoundhyphen'/> @@ -659,6 +660,7 @@ <cd:constant name='equalwidth' value='equalwidth'/> <cd:constant name='escape' value='escape'/> <cd:constant name='evenmargin' value='evenmargin'/> + <cd:constant name='exitoffset' value='labeloffset'/> <cd:constant name='expansion' value='expansion'/> <cd:constant name='export' value='export'/> <cd:constant name='extras' value='extras'/> @@ -737,6 +739,7 @@ <cd:constant name='keys' value='keys'/> <cd:constant name='keyword' value='keyword'/> <cd:constant name='label' value='label'/> + <cd:constant name='labeloffset' value='labeloffset'/> <cd:constant name='lastnamesep' value='lastnamesep'/> <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index ab0aab58f..45c19c558 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -612,6 +612,7 @@ <cd:constant name='commandafter' value='commandeapres'/> <cd:constant name='commandbefore' value='commandeavant'/> <cd:constant name='commands' value='commandes'/> + <cd:constant name='commentoffset' value='commentoffset'/> <cd:constant name='compact' value='compact'/> <cd:constant name='component' value='composant'/> <cd:constant name='compoundhyphen' value='compoundhyphen'/> @@ -659,6 +660,7 @@ <cd:constant name='equalwidth' value='equalwidth'/> <cd:constant name='escape' value='escape'/> <cd:constant name='evenmargin' value='margepaire'/> + <cd:constant name='exitoffset' value='labeloffset'/> <cd:constant name='expansion' value='expansion'/> <cd:constant name='export' value='export'/> <cd:constant name='extras' value='extras'/> @@ -737,6 +739,7 @@ <cd:constant name='keys' value='keys'/> <cd:constant name='keyword' value='motcle'/> <cd:constant name='label' value='etiquette'/> + <cd:constant name='labeloffset' value='labeloffset'/> <cd:constant name='lastnamesep' value='lastnamesep'/> <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 68b94e9fb..99a4936df 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -612,6 +612,7 @@ <cd:constant name='commandafter' value='comdandodopo'/> <cd:constant name='commandbefore' value='comandoprima'/> <cd:constant name='commands' value='comandi'/> + <cd:constant name='commentoffset' value='commentoffset'/> <cd:constant name='compact' value='compact'/> <cd:constant name='component' value='component'/> <cd:constant name='compoundhyphen' value='compoundhyphen'/> @@ -659,6 +660,7 @@ <cd:constant name='equalwidth' value='equalwidth'/> <cd:constant name='escape' value='escape'/> <cd:constant name='evenmargin' value='marginepari'/> + <cd:constant name='exitoffset' value='labeloffset'/> <cd:constant name='expansion' value='espansione'/> <cd:constant name='export' value='export'/> <cd:constant name='extras' value='extras'/> @@ -737,6 +739,7 @@ <cd:constant name='keys' value='keys'/> <cd:constant name='keyword' value='parolachiave'/> <cd:constant name='label' value='etichetta'/> + <cd:constant name='labeloffset' value='labeloffset'/> <cd:constant name='lastnamesep' value='lastnamesep'/> <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 03ae8dd3e..f5217a6fd 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -612,6 +612,7 @@ <cd:constant name='commandafter' value='nacommando'/> <cd:constant name='commandbefore' value='voorcommando'/> <cd:constant name='commands' value='commandos'/> + <cd:constant name='commentoffset' value='commentoffset'/> <cd:constant name='compact' value='compact'/> <cd:constant name='component' value='component'/> <cd:constant name='compoundhyphen' value='koppelteken'/> @@ -659,6 +660,7 @@ <cd:constant name='equalwidth' value='equalwidth'/> <cd:constant name='escape' value='escape'/> <cd:constant name='evenmargin' value='evenmarge'/> + <cd:constant name='exitoffset' value='labeloffset'/> <cd:constant name='expansion' value='expansie'/> <cd:constant name='export' value='exporteer'/> <cd:constant name='extras' value='extras'/> @@ -737,6 +739,7 @@ <cd:constant name='keys' value='sleutels'/> <cd:constant name='keyword' value='trefwoord'/> <cd:constant name='label' value='label'/> + <cd:constant name='labeloffset' value='labeloffset'/> <cd:constant name='lastnamesep' value='lastnamesep'/> <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 9b99a1edb..7dc60fb1c 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -612,6 +612,7 @@ <cd:constant name='commandafter' value='فرمانبعداز'/> <cd:constant name='commandbefore' value='فرمانقبلاز'/> <cd:constant name='commands' value='فرمانها'/> + <cd:constant name='commentoffset' value='commentoffset'/> <cd:constant name='compact' value='compact'/> <cd:constant name='component' value='مولفه'/> <cd:constant name='compoundhyphen' value='compoundhyphen'/> @@ -659,6 +660,7 @@ <cd:constant name='equalwidth' value='عرضیکسان'/> <cd:constant name='escape' value='فرار'/> <cd:constant name='evenmargin' value='حاشیهزوج'/> + <cd:constant name='exitoffset' value='labeloffset'/> <cd:constant name='expansion' value='گسترش'/> <cd:constant name='export' value='export'/> <cd:constant name='extras' value='extras'/> @@ -737,6 +739,7 @@ <cd:constant name='keys' value='keys'/> <cd:constant name='keyword' value='کلیدواژه'/> <cd:constant name='label' value='برچسب'/> + <cd:constant name='labeloffset' value='labeloffset'/> <cd:constant name='lastnamesep' value='lastnamesep'/> <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index ae47b60aa..c2afb74d3 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -612,6 +612,7 @@ <cd:constant name='commandafter' value='comandadupa'/> <cd:constant name='commandbefore' value='comandainainte'/> <cd:constant name='commands' value='comenzi'/> + <cd:constant name='commentoffset' value='commentoffset'/> <cd:constant name='compact' value='compact'/> <cd:constant name='component' value='component'/> <cd:constant name='compoundhyphen' value='compoundhyphen'/> @@ -659,6 +660,7 @@ <cd:constant name='equalwidth' value='equalwidth'/> <cd:constant name='escape' value='escape'/> <cd:constant name='evenmargin' value='marginepara'/> + <cd:constant name='exitoffset' value='labeloffset'/> <cd:constant name='expansion' value='expansiune'/> <cd:constant name='export' value='export'/> <cd:constant name='extras' value='extras'/> @@ -737,6 +739,7 @@ <cd:constant name='keys' value='keys'/> <cd:constant name='keyword' value='keyword'/> <cd:constant name='label' value='eticheta'/> + <cd:constant name='labeloffset' value='labeloffset'/> <cd:constant name='lastnamesep' value='lastnamesep'/> <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> |