summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2014-01-18 14:40:15 +0200
committerMarius <mariausol@gmail.com>2014-01-18 14:40:15 +0200
commit11620c88a569cbab66c50271f7cc41a4e99973ff (patch)
tree2bf40c6fb38fa169fa28c5771a533005e6b3e80a
parent33a2bd7467e39fc298dfc7ecfecdf1b013e0f15f (diff)
downloadcontext-11620c88a569cbab66c50271f7cc41a4e99973ff.tar.gz
beta 2014.01.18 13:23
-rw-r--r--doc/context/manuals/allkind/mkiv-publications.tex57
-rw-r--r--metapost/context/base/mp-grap.mpiv268
-rw-r--r--tex/context/base/buff-ver.mkiv4
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4083 -> 4086 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/publ-aut.lua1
-rw-r--r--tex/context/base/publ-dat.lua18
-rw-r--r--tex/context/base/publ-imp-apa.mkiv2
-rw-r--r--tex/context/base/publ-ini.lua300
-rw-r--r--tex/context/base/publ-ini.mkiv7
-rw-r--r--tex/context/base/publ-tra.lua1
-rw-r--r--tex/context/base/status-files.pdfbin24779 -> 24785 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin229284 -> 229057 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
15 files changed, 391 insertions, 273 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.tex b/doc/context/manuals/allkind/mkiv-publications.tex
index fce992a54..6fe7f5b4e 100644
--- a/doc/context/manuals/allkind/mkiv-publications.tex
+++ b/doc/context/manuals/allkind/mkiv-publications.tex
@@ -832,6 +832,63 @@ This results in:
\ctxluabuffer
+You can manipulate a dataset after loading. Of course this assumes that you know
+what kind of content you have and what you need for rendering. As example we
+load a small dataset.
+
+\startbuffer
+\definebtxdataset[drumming]
+\usebtxdataset[drumming][mkiv-publications.lua]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Because we're going to do some \LUA, we could also have loaded the dataset
+with:
+
+\starttyping
+publications.load("drumming","mkiv-publications.lua","lua")
+\stoptyping
+
+The dataset has three entries:
+
+\typefile{mkiv-publications.lua}
+
+As you can see, we can have a subtitle. We will combine the title and subtitle
+into one:
+
+\startbuffer
+\startluacode
+for tag, entry in next, publications.datasets.drumming.luadata do
+ if entry.subtitle then
+ if entry.title then
+ entry.title = entry.title .. ", " .. entry.subtitle
+ else
+ entry.title = entry.subtitle
+ end
+ entry.subtitle = nil
+ logs.report("btx","combining title and subtitle of entry tagged %a",tag)
+ end
+end
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We can now typeset the entries with:
+
+\startbuffer
+\definebtxrendering[drumming][dataset=drumming,method=dataset]
+\placebtxrendering[drumming]
+\stopbuffer
+
+\typebuffer
+
+Because we just want to show the entries, and have no citations that force them
+to be shown, we have to the \type {method} to \type {dataset}.
+
+\blank \getbuffer \blank
+
\stopchapter
\startchapter[title=The \XML\ view]
diff --git a/metapost/context/base/mp-grap.mpiv b/metapost/context/base/mp-grap.mpiv
index 417bfbe69..6d69c0b1e 100644
--- a/metapost/context/base/mp-grap.mpiv
+++ b/metapost/context/base/mp-grap.mpiv
@@ -52,11 +52,11 @@ fi
% endgraph end of graph--the result is a picture
% option `plot <picture>' draws picture at each path knot, turns off pen
-% Gtemplate.<tickcmd> template paths for tick marks and grid lines
+% graph_template.<tickcmd> template paths for tick marks and grid lines
% graph_margin_fraction.low,
% graph_margin_fraction.high fractions determining margins when no setrange
-% Glmarks[], Gumarks, Gemarks loop text strings used by auto.<x or y>
-% Gmarks, Gminlog numeric parameters used by auto.<x or y>
+% graph_log_marks[], graph_lin_marks, graph_exp_marks loop text strings used by auto.<x or y>
+% graph_minimum_number_of_marks, graph_log_minimum numeric parameters used by auto.<x or y>
% Autoform is the format string used by autogrid
% Autoform_X, Autoform_Y if defined, are used instead
@@ -65,22 +65,26 @@ fi
% with `graph_'
% Depends on :
+
input string.mp
% Private version of a few marith macros, fixed for double math...
-newinternal Mzero; Mzero := -16384; % Anything at least this small is treated as zero
-newinternal mlogten ; mlogten := mlog(10) ;
-newinternal singleinfinity ; singleinfinity := 2**128 ;
-newinternal doubleinfinity ; doubleinfinity := 2**1024 ;
-% Note that we get arithmetic overflows if we set to -doubleinfinity below.
-% (but "only on odd days"...)
+
+newinternal Mzero ; Mzero := -16384; % Anything at least this small is treated as zero
+newinternal mlogten ; mlogten := mlog(10) ;
+newinternal largestmantissa ; largestmantissa := 2**52 ; % internal double warningcheck
+newinternal singleinfinity ; singleinfinity := 2**128 ;
+newinternal doubleinfinity ; doubleinfinity := 2**1024 ;
+Mzero := -largestmantissa ; % Note that we get arithmetic overflows if we set to -doubleinfinity
% Safely convert a number to mlog form, trapping zero.
+
vardef graph_mlog primary x =
if unknown x: whatever
elseif x=0: Mzero
else: mlog(abs x) fi
enddef ;
+
vardef graph_exp primary x =
if unknown x: whatever
elseif x<=Mzero: 0
@@ -89,21 +93,25 @@ enddef ;
% and add the following for utility/completeness
% (replacing the definitions in mp-tool.mpiv).
+
vardef logten primary x =
if unknown x: whatever
elseif x=0: Mzero
else: mlog(abs x)/mlog(10) fi
enddef ;
+
vardef ln primary x =
if unknown x: whatever
elseif x=0: Mzero
else: mlog(abs x)/256 fi
enddef ;
+
vardef exp primary x =
if unknown x: whatever
elseif x<= Mzero: 0
else: (mexp 256)**x fi
enddef ;
+
vardef powten primary x =
if unknown x: whatever
elseif x<= Mzero: 0
@@ -112,6 +120,7 @@ enddef ;
% Convert x from mlog form into a pair whose xpart gives a mantissa and whose
% ypart gives a power of ten.
+
vardef graph_Meform(expr x) =
if x<=Mzero : origin
else :
@@ -122,6 +131,7 @@ vardef graph_Meform(expr x) =
enddef ;
% Modified from above.
+
vardef graph_Feform(expr x) =
interim warningcheck :=0 ;
if x=0 : origin
@@ -146,6 +156,7 @@ def graph_suffix(suffix $) = % convert from x or y to X_ or Y_
enddef ;
% New :
+
save graph_background ; color graph_background ; % if defined, fill the frame.
save graph_close_file ; boolean graph_close_file ; graph_close_file = false ;
@@ -200,17 +211,20 @@ enddef ;
% user to alter the behavior of these macros.
% Not very modifiable : log, linear,
% graph_frame_pair_a, graph_frame_pair_b, graph_margin_pair
-% Modifiable : Gtemplate.suffix, Glmarks[], Gumarks, Gemarks, Gmarks,
-% Gminlog, Autoform
+% Modifiable : graph_template.suffix,
+% graph_log_marks[], graph_lin_marks, graph_exp_marks,
+% graph_minimum_number_of_marks,
+% graph_log_minimum, Autoform
newinternal log, linear ; % coordinate system codes
log :=1 ; linear :=2;
+
% note that mp-tool.mpiv defines log as log10.
%%%%%%%%%%%%%%%%%%%%%% Coordinates : setcoords, setrange %%%%%%%%%%%%%%%%%%%%%%
-% Graph-related usr input is `user graph coordinates' as specified by arguments
+% Graph-related user input is `user graph coordinates' as specified by arguments
% to setcoords.
% `Internal graph coordinates' are used for graph_current_graph, graph_current_bb, Z_.low, Z_.high.
% Their meaning depends on the appropriate component of Z_.graph_coordinate_type :
@@ -227,14 +241,15 @@ vardef graph_set_default_bounds = % Set default Z_.low, Z_.high
graph_margin_pair$ ;
endfor
enddef ;
+
pair graph_margin_pair.low, graph_margin_pair.high ;
graph_margin_pair.high = -graph_margin_pair.low = (.00002,.00002) ;
+% Set $, $$, $$$ so that shifting by $ then transforming by $$ and then $$$ maps
+% the essential bounding box of graph_current_graph into (0,0)..Z_.graph_dimensions.
+% The `essential bounding box' is either what Z_.low and Z_.high imply
+% or the result of ignoring pen widths in graph_current_graph.
-% Set $, $$, $$$ so that shifting by $ then transforming by $$ and then $$$
-% maps the essential bounding box of graph_current_graph into (0,0)..Z_.graph_dimensions. The
-% `essential bounding box' is either what Z_.low and Z_.high imply or the
-% result of ignoring pen widths in graph_current_graph.
vardef graph_remap(suffix $,$$,$$$) =
save p_ ;
graph_set_default_bounds ;
@@ -245,10 +260,10 @@ vardef graph_remap(suffix $,$$,$$$) =
(Z_.high+$) transformed $$ = p_ ;
p_ transformed $$$ = Z_.graph_dimensions ;
enddef ;
+
graph_margin_fraction.low=-.07 ; % bbox fraction for default range start
graph_margin_fraction.high=1.07 ; % bbox fraction for default range stop
-
def graph_with_pen_and_color(expr q) =
withpen penpart q withcolor
if colormodel q=1 :
@@ -268,7 +283,7 @@ enddef ;
% Pair o is the value of p that makes tp (0,0). This implements the trick
% whereby using 1 instead of 0 for the width or height or the setbounds path
% for a label picture suppresses shifting in x or y.
-%
+
%vardef graph_picture_conversion@#(expr q, o)(text tp) =
% save p ;
% if stroked q :
@@ -284,8 +299,9 @@ enddef ;
% addto @# also q shifted ((tp)-llcorner q) ;
% fi
%enddef ;
-%
+
% This new version makes gdraw clip the result to the window defined with setrange
+
vardef graph_picture_conversion@#(expr q, o)(text tp) =
save p ;
save do_clip, tp_clipped ; boolean do_clip ; do_clip := true ;
@@ -315,12 +331,11 @@ enddef ;
def graph_coordinate_multiplication(expr a,b) = (xpart a*xpart b, ypart a*ypart b) enddef ;
-
vardef graph_clear_bounds@# = numeric @#.low, @#.high ; enddef;
-
% Finalize anything drawn in the present coordinate system and set up a new
% system as requested
+
vardef setcoords(expr tx, ty) =
interim warningcheck :=0 ;
if length graph_current_graph>0 :
@@ -335,10 +350,10 @@ vardef setcoords(expr tx, ty) =
X_.graph_coordinate_type := tx ; Y_.graph_coordinate_type := ty;
enddef ;
-
% Set Z_.low and Z_.high to correspond to given range of user graph
% coordinates. The text argument should be a sequence of pairs and/or strings
% with 4 components in all.
+
vardef setrange(text t) =
interim warningcheck :=0 ;
save r_ ; r_=0;
@@ -353,8 +368,8 @@ vardef setrange(text t) =
endfor
enddef ;
-
% @# is X_ or Y_ ; l and h are numeric or string
+
vardef graph_set_bounds@#(expr l, h) =
graph_clear_bounds@# ;
if @#graph_coordinate_type>0 :
@@ -382,15 +397,12 @@ vardef graph_set_bounds@#(expr l, h) =
fi
enddef ;
-
-
-
-
%%%%%%%%%%%%%%%%%%%%%%%%% Converting path coordinates %%%%%%%%%%%%%%%%%%%%%%%%%
% Find the result of scanning path p and using macros tx and ty to adjust the
% x and y parts of each coordinate pair. Boolean parameter c tells whether to
% force the result to be polygonal.
+
vardef graph_scan_path(expr p, c)(suffix tx, ty) =
if (str tx="") and (str ty="") : p
else :
@@ -409,10 +421,11 @@ vardef graph_scan_path(expr p, c)(suffix tx, ty) =
if pair p : point 0 of fi r_
fi
enddef ;
-vardef graph_pair_adjust(expr p)(suffix tx, ty) = (tx xpart p, ty ypart p) enddef ;
+vardef graph_pair_adjust(expr p)(suffix tx, ty) = (tx xpart p, ty ypart p) enddef ;
% Convert path p from user graph coords to internal graph coords.
+
vardef graph_convert_user_path_to_internal primary p =
interim warningcheck :=0 ;
graph_scan_path(p,
@@ -424,11 +437,11 @@ vardef graph_convert_user_path_to_internal primary p =
if Y_.graph_coordinate_type<0 : yscaled -1 fi)
enddef ;
-
% Convert label location t_ from user graph coords to internal graph coords.
% The label location should be a pair, or two numbers/strings. If t_ is empty
% or a single item of non-pair type, just return t_. Unknown coordinates
% produce unknown components in the result.
+
vardef graph_label_convert_user_to_internal(text t_) =
save n_ ; n_=0;
interim warningcheck :=0 ;
@@ -448,13 +461,12 @@ vardef graph_label_convert_user_to_internal(text t_) =
fi
enddef ;
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Reading data files %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Read a line from file f, extract whitespace-separated tokens ignoring any
% initial "%", and return true if at least one token is found. The tokens
% are stored in @#1, @#2, .. with "" in the last @#[] entry.
+
vardef graph_read_line@#(expr f) =
save n_, s_ ; string s_;
s_ = readfrom f ;
@@ -472,9 +484,9 @@ vardef graph_read_line@#(expr f) =
fi
enddef ;
-
% Execute c for each line of data read from file f, and stop at the first
% line with no data. Commands c can use line number i and tokens $1, $2, ...
+
def gdata(expr f)(suffix $)(text c) =
boolean flag ;
for i=1 upto infinity :
@@ -486,8 +498,8 @@ def gdata(expr f)(suffix $)(text c) =
fi
enddef ;
-
% Read a path from file f. The path is terminated by blank line or EOF.
+
vardef graph_readpath(expr f) =
interim warningcheck :=0 ;
save s ;
@@ -497,9 +509,9 @@ vardef graph_readpath(expr f) =
)
enddef ;
-
% Append coordinates t to polygonal path @#. The coordinates can be numerics,
% strings, or a single pair.
+
vardef augment@#(text t) =
interim warningcheck := 0 ;
if not path begingroup @# endgroup :
@@ -513,12 +525,11 @@ vardef augment@#(text t) =
fi
enddef ;
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Drawing and filling %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unknown pair components are set to 0 because glabel and gdotlabel understand
% unknown coordinates as `0 in absolute units'.
+
vardef graph_unknown_pair_bbox(expr p) =
interim warningcheck:=0 ;
if known p : addto graph_current_bb doublepath p ;
@@ -535,6 +546,7 @@ enddef ;
% Initiate a gdraw or gfill command. This must be done before scanning the
% argument, because that could invoke the `if known graph_plot_picture' test in a following
% plot option .
+
def graph_addto =
def graph_errorbar_text = enddef ;
color graph_foreground ;
@@ -542,8 +554,8 @@ def graph_addto =
graph_last_drawn := graph_plot_picture := nullpicture ; addto graph_last_drawn
enddef;
+% Handle the part of a gdraw command that uses path or data file p.
-% Handle the part of a Gdraw command that uses path or data file p.
def graph_draw expr p =
if string p : hide(graph_last_path := graph_readpath(p) ;)
graph_convert_user_path_to_internal graph_last_path
@@ -556,8 +568,8 @@ def graph_draw expr p =
withpen currentpen graph_withlist _op_
enddef ;
+% Handle the part of a gdraw command that uses path or data file p.
-% Handle the part of a Gdraw command that uses path or data file p.
def graph_fill expr p =
if string p : hide(graph_last_path := graph_readpath(p) --cycle ;)
graph_convert_user_path_to_internal graph_last_path
@@ -571,8 +583,8 @@ enddef ;
def gdraw = graph_addto doublepath graph_draw enddef ;
def gfill = graph_addto contour graph_fill enddef ;
-
% This is used in graph_draw and graph_fill to allow postprocessing graph_last_drawn
+
def graph_withlist text t_ = t_ ; graph_post_draw; enddef;
def witherrorbars(text t) text options =
@@ -584,6 +596,8 @@ def witherrorbars(text t) text options =
options
enddef ;
+% new feature: graph_errorbars
+
picture graph_errorbar_picture ; graph_errorbar_picture := image(draw (left--right) scaled .5 ;) ;
%picture graph_xbar_picture ; graph_xbar_picture := image(draw (down--up) scaled .5 ;) ;
%picture graph_ybar_picture ; graph_ybar_picture := image(draw (left--right) scaled .5 ;) ;
@@ -646,6 +660,7 @@ enddef ;
% Set graph_plot_picture so the postprocessing step will plot picture p at each path knot.
% Also select nullpen to suppress stroking.
+
def plot expr p =
if known graph_plot_picture :
withpen nullpen
@@ -657,20 +672,19 @@ def plot expr p =
enddef ;
% This hides a semicolon that could prematurely end graph_withlist's text argument
+
def graph_addto_currentpicture primary p = addto currentpicture also p ; enddef;
def graph_setbounds = setbounds currentpicture to enddef ;
-
-def gdrawarrow = graph_number_of_arrowheads :=1 ; gdraw enddef;
-def gdrawdblarrow = graph_number_of_arrowheads :=2 ; gdraw enddef;
-
+def gdrawarrow = graph_number_of_arrowheads := 1 ; gdraw enddef;
+def gdrawdblarrow = graph_number_of_arrowheads := 2 ; gdraw enddef;
% Post-process the filled or stroked picture graph_last_drawn as follows : (1) update
% the bounding box information ; (2) transfer it to graph_current_graph unless the pen has
% been set to nullpen to disable stroking ; (3) plot graph_plot_picture at each knot.
+
vardef graph_post_draw =
- save p ;
- path p ; p=pathpart graph_last_drawn;
+ save p ; path p ; p = pathpart graph_last_drawn ;
graph_unknown_pair_bbox(p) ;
if filled graph_last_drawn or not graph_is_null(penpart graph_last_drawn) :
addto graph_current_graph also graph_last_drawn ;
@@ -687,17 +701,23 @@ vardef graph_post_draw =
if graph_number_of_arrowheads>1 :
graph_draw_arrowhead(reverse p, graph_with_pen_and_color(graph_last_drawn)) ;
fi
- graph_number_of_arrowheads :=0 ;
+ graph_number_of_arrowheads := 0 ;
fi
enddef ;
-vardef graph_is_null(expr p) = (urcorner p=origin) and (llcorner p=origin) enddef ;
+vardef graph_is_null(expr p) = (urcorner p=origin) and (llcorner p=origin) enddef ;
vardef graph_draw_arrowhead(expr p)(text w) = % Draw arrowhead for path p, with list w
+ %save r ; r := angle(precontrol infinity of p shifted -point infinity of p) ;
addto graph_current_graph also
- image(filldraw arrowhead(
- graph_arrowhead_extent(precontrol infinity of p, point infinity of p)) w ;
- graph_setbounds point infinity of p..cycle) ;
+ image(fill arrowhead (graph_arrowhead_extent(precontrol infinity of p,point infinity of p)) w ;
+ draw arrowhead (graph_arrowhead_extent(precontrol infinity of p,point infinity of p)) w
+ undashed ;
+%if (r mod 90 <> 0) : % orientation can be wrong due to remapping
+% draw textext("\tfxx " & decimal r) shifted point infinity of p withcolor blue ;
+%fi
+ graph_setbounds point infinity of p..cycle ;
+ ) ; % rotatedabout(point infinity of p,-r) ;
enddef ;
vardef graph_arrowhead_extent(expr p, q) =
@@ -705,8 +725,6 @@ vardef graph_arrowhead_extent(expr p, q) =
q
enddef ;
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Drawing labels %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Argument c is a drawing command that needs an additional argument p that gives
@@ -714,6 +732,7 @@ enddef ;
% path. Unknown components of p cause the setbounds path to have width or height 1 instead of 0.
% Then graph_unknown_pair_bbox sets these components to 0 and graph_picture_conversion
% suppresses subsequent repositioning.
+
def graph_draw_label(expr p)(suffix $)(text c) =
save sdim_ ; pair sdim_;
sdim_ := (if unknown xpart p : 1+ fi 0, if unknown ypart p : 1+ fi 0) ;
@@ -722,14 +741,13 @@ def graph_draw_label(expr p)(suffix $)(text c) =
image(c(p) ; graph_setbounds p--p+sdim_--cycle) _op_
enddef ;
-
% Stash the result drawing command c in the graph_label table using with list w and
% an index based on angle mfun_laboff$.
+
vardef graph_stash_label(suffix $)(text c) text w =
graph_label[1.5+angle mfun_laboff$ /90] = image(c(origin) w) ;
enddef ;
-
def graph_label_location primary p =
if pair p : graph_draw_label(p)
elseif numeric p : graph_draw_label(point p of pathpart graph_last_drawn)
@@ -737,33 +755,31 @@ def graph_label_location primary p =
fi
enddef ;
-
% Place label p at user graph coords t using with list w. (t is a time, a pair
% or 2 numerics or strings).
+
vardef glabel@#(expr p)(text t) text w =
graph_label_location graph_label_convert_user_to_internal(t) (@#,label@#(p)) w ; enddef;
-
% Place label p at user graph coords t using with list w and draw a dot there.
% (t is a time, a pair, or 2 numerics or strings).
+
vardef gdotlabel@#(expr p)(text t) text w =
graph_label_location graph_label_convert_user_to_internal(t) (@#,dotlabel@#(p)) w ; enddef;
-
def OUT = enddef ; % location text for outside labels
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%% Grid lines, ticks, etc. %%%%%%%%%%%%%%%%%%%%%%%%%%
% Grid lines and tick marks are transformed versions of the templates below.
% In the template paths, (0,0) is on the edge of the frame and inward is to
% the right.
-path Gtemplate.tick, Gtemplate.itick, Gtemplate.otick, Gtemplate.grid ;
-Gtemplate.tick = (-3.5bp,0)--(3.5bp,0) ;
-Gtemplate.itick = origin--(7bp,0) ;
-Gtemplate.otick = (-7bp,0)--origin ;
-Gtemplate.grid = origin--(1,0) ;
+
+path graph_template.tick, graph_template.itick, graph_template.otick, graph_template.grid ;
+graph_template.tick = (-3.5bp,0)--(3.5bp,0) ;
+graph_template.itick = origin--(7bp,0) ;
+graph_template.otick = (-7bp,0)--origin ;
+graph_template.grid = origin--(1,0) ;
vardef tick@#(expr f,u) text w = graph_tick_label(@#,@,false,f,u,w) ; enddef;
@@ -774,75 +790,82 @@ vardef otick@#(expr f,u) text w = graph_tick_label(@#,@,false,f,u,w) ; enddef;
vardef grid@#(expr f,u) text w = graph_tick_label(@#,@,true,f,u,w) ; enddef;
-% Produce a tick or grid mark for label suffix $, Gtemplate suffix $$,
-% coordinate value u, and with list w. Boolean c tells whether Gtemplate$$
+% Produce a tick or grid mark for label suffix $, graph_template suffix $$,
+% coordinate value u, and with list w. Boolean c tells whether graph_template$$
% needs scaling by X_.graph_dimensions or Y_.graph_dimensions,
% and f gives a format string or a label picture.
+
def graph_tick_label(suffix $,$$)(expr c, f, u)(text w) =
- graph_draw_label(graph_label_convert_user_to_internal(graph_generate_label_position($,u)),,draw graph_gridline_picture$($$,c,f,u,w) shifted)
+ graph_draw_label(graph_label_convert_user_to_internal(graph_generate_label_position($,u)),,
+ draw graph_gridline_picture$($$,c,f,u,w) shifted)
enddef ;
-
% Generate label positioning arguments appropriate for label suffix $ and
% coordinate u.
+
def graph_generate_label_position(suffix $)(expr u) =
- if xpart mfun_laboff.$=0 : u,whatever else : whatever,u fi
+ if pair u : u elseif xpart mfun_laboff.$=0 : u,whatever else : whatever,u fi
enddef ;
-
% Generate a picture of a grid line labeled with coordinate value u, picture
% or format string f, and with list w. Suffix @# is bot, top, lft, or rt,
-% suffix $ identifies entries in the Gtemplate table, and boolean c tells
-% whether to scale Gtemplate$.
+% suffix $ identifies entries in the graph_template table, and boolean c tells
+% whether to scale graph_template$.
+
vardef graph_gridline_picture@#(suffix $)(expr c, f, u)(text w) =
if unknown u : graph_error(u,"Label coordinate should be known") ; nullpicture
else :
save p ; path p;
interim warningcheck :=0 ;
graph_autogrid_needed :=false ;
- p = Gtemplate$ zscaled -mfun_laboff@#
- if c : Gxyscale fi
- shifted (((.5 + mfun_laboff@# dotprod (.5,.5)) * mfun_laboff@#) Gxyscale) ;
+ p = graph_template$ zscaled -mfun_laboff@#
+ if c : graph_xyscale fi
+ shifted (((.5 + mfun_laboff@# dotprod (.5,.5)) * mfun_laboff@#) graph_xyscale) ;
image(draw p w ;
label@#(if string f : format(f,u) else : f fi, point 0 of p))
fi
enddef ;
-def Gxyscale = xscaled X_.graph_dimensions yscaled Y_.graph_dimensions enddef ;
+def graph_xyscale = xscaled X_.graph_dimensions yscaled Y_.graph_dimensions enddef ;
% Draw the frame or the part corresponding to label suffix @# using with list w.
+
vardef frame@# text w =
graph_frame_needed :=false ;
picture p_ ;
p_ = image(draw
if str@#<>"" : subpath round(angle mfun_laboff@#*graph_frame_pair_a+graph_frame_pair_b) of fi
- unitsquare Gxyscale w) ;
+ unitsquare graph_xyscale w) ;
graph_draw_label((whatever,whatever),,draw p_ shifted) ;
enddef ;
-pair graph_frame_pair_a ; graph_frame_pair_a=(1,1)/90; % unitsquare subpath is linear in label angle
-pair graph_frame_pair_b ; graph_frame_pair_b=(.75,2.25);
-
-
+pair graph_frame_pair_a ; graph_frame_pair_a=(1,1)/90; % unitsquare subpath is linear in label angle
+pair graph_frame_pair_b ; graph_frame_pair_b=(.75,2.25);
%%%%%%%%%%%%%%%%%%%%%%%%%% Automatic grid selection %%%%%%%%%%%%%%%%%%%%%%%%%%
-string Glmarks[] ; % marking options per decade for logarithmic scales
-string Gumarks ; % mark spacing options per decade for linear scales
-string Gemarks ; % exponent spacing options for logarithmic scales
-newinternal Gmarks, Gminlog ;
-Gmarks := 4 ; % minimum number marks generated by auto.x or auto.y
-Gminlog := mlog 3 ; % revert to uniform marks when largest/smallest < this
+string graph_log_marks[] ; % marking options per decade for logarithmic scales
+string graph_lin_marks ; % mark spacing options per decade for linear scales
+string graph_exp_marks ; % exponent spacing options for logarithmic scales
+newinternal graph_minimum_number_of_marks, graph_log_minimum ;
+graph_minimum_number_of_marks := 4 ; % minimum number marks generated by auto.x or auto.y
+graph_log_minimum := mlog 3 ; % revert to uniform marks when largest/smallest < this
-def Gfor(text t) = for i=t endfor enddef ; % to shorten the mark templates below
-Glmarks[1]="1,2,5" ;
-Glmarks[2]="1,1.5,2,3,4,5,7" ;
-Glmarks[3]="1Gfor(6upto10 :,i/5)Gfor(5upto10 :,i/2)Gfor(6upto9 :,i)" ;
-Glmarks[4]="1Gfor(11upto20 :,i/10)Gfor(11upto25 :,i/5)Gfor(11upto19 :,i/2)" ;
-Glmarks[5]="1Gfor(21upto40 :,i/20)Gfor(21upto50 :,i/10)Gfor(26upto49 :,i/5)" ;
-Gumarks="10,5,2" ; % start with 10 and go down; a final `,1' is appended
-Gemarks="20,10,5,2,1" ;
+def Gfor(text t) = for i=t endfor enddef ; % to shorten the mark templates below
+graph_log_marks[1]="1,2,5" ;
+graph_log_marks[2]="1,1.5,2,3,4,5,7" ;
+graph_log_marks[3]="1Gfor(6upto10 :,i/5)Gfor(5upto10 :,i/2)Gfor(6upto9 :,i)" ;
+graph_log_marks[4]="1Gfor(11upto20 :,i/10)Gfor(11upto25 :,i/5)Gfor(11upto19 :,i/2)" ;
+graph_log_marks[5]="1Gfor(21upto40 :,i/20)Gfor(21upto50 :,i/10)Gfor(26upto49 :,i/5)" ;
+graph_lin_marks="10,5,2" ; % start with 10 and go down; a final `,1' is appended
+graph_exp_marks="20,10,5,2,1" ;
+
+Ten_to0 = 1 ;
+Ten_to1 = 10 ;
+Ten_to2 = 100 ;
+Ten_to3 = 1000 ;
+Ten_to4 = 10000 ;
% Determine the X_ or Y_ bounds on the range to be covered by automatic grid
% marks. Suffix @# is X_ or Y_. The result is log or linear to specify the
@@ -851,6 +874,7 @@ Gemarks="20,10,5,2,1" ;
% are upper and lower bounds in
% `modified exponential form'. In modified exponential form, (x,y) means
% (x/1000)*10^y, where 1000<=abs x<10000.
+
vardef graph_bounds@# =
interim warningcheck :=0 ;
save l, h ;
@@ -859,28 +883,29 @@ vardef graph_bounds@# =
if abs @#graph_coordinate_type=log :
graph_modified_lower := graph_Meform(l)+graph_modified_bias ;
graph_modified_higher := graph_Meform(h)+graph_modified_bias ;
- if h-l >= Gminlog : log else : linear fi
+ if h-l >= graph_log_minimum : log else : linear fi
else :
graph_modified_lower := graph_Feform(l)+graph_modified_bias ;
graph_modified_higher := graph_Feform(h)+graph_modified_bias ;
linear
fi
enddef ;
+
pair graph_modified_bias ; graph_modified_bias=(0,3);
pair graph_modified_lower, graph_modified_higher ;
+% Scan graph_log_marks[k] and evaluate tokens t for each m where l<=m<=h.
-% Scan Glmarks[k] and evaluate tokens t for each m where l<=m<=h.
def graph_scan_marks(expr k, l, h)(text t) =
- for m=scantokens Glmarks[k] :
+ for m=scantokens graph_log_marks[k] :
exitif m>h ;
if m>=l : t fi
endfor
enddef ;
-
-% Scan Gmark[k] and evaluate tokens t for each m and e where m*10^e belongs
+% Scan graph_log_marks[k] and evaluate tokens t for each m and e where m*10^e belongs
% between l and h (inclusive), where both l and h are in modified exponent form.
+
def graph_scan_mark(expr k, l, h)(text t) =
for e=ypart l upto ypart h :
graph_scan_marks(k, if e>ypart l : 1 else : xpart l/1000 fi,
@@ -888,27 +913,29 @@ def graph_scan_mark(expr k, l, h)(text t) =
endfor
enddef ;
-
% Select a k for which graph_scan_mark(k,...) gives enough marks.
+
vardef graph_select_mark =
save k ;
k = 0 ;
forever :
- exitif unknown Glmarks[k+1] ;
- exitif 0 graph_scan_mark(incr k, graph_modified_lower, graph_modified_higher, +1) >= Gmarks ;
+ exitif unknown graph_log_marks[k+1] ;
+ exitif 0 graph_scan_mark(incr k, graph_modified_lower, graph_modified_higher, +1)
+ >= graph_minimum_number_of_marks ;
endfor
k
enddef ;
-
-% Try to select an exponent spacing from Gemarks. If successful, set @# and
+% Try to select an exponent spacing from graph_exp_marks. If successful, set @# and
% return true
+
vardef graph_select_exponent_mark@# =
numeric @# ;
- for e=scantokens Gemarks :
+ for e=scantokens graph_exp_marks :
@# = e ;
exitif floor(ypart graph_modified_higher/e) -
- floor(graph_modified_exponent_ypart(graph_modified_lower)/e) >= Gmarks ;
+ floor(graph_modified_exponent_ypart(graph_modified_lower)/e)
+ >= graph_minimum_number_of_marks ;
numeric @# ;
endfor
known @#
@@ -916,17 +943,17 @@ enddef ;
vardef graph_modified_exponent_ypart(expr p) = ypart p if xpart p=1000 : -1 fi enddef ;
-
% Compute the mark spacing d between xpart graph_modified_lower and xpart graph_modified_higher.
+
vardef graph_tick_mark_spacing =
interim warningcheck :=0 ;
save m, n, d ;
- m = Gmarks ;
+ m = graph_minimum_number_of_marks ;
n = 1 for i=1 upto
(mlog(xpart graph_modified_higher-xpart graph_modified_lower) - mlog m)/mlogten :
*10 endfor ;
if n<=1000 :
- for x=scantokens Gumarks :
+ for x=scantokens graph_lin_marks :
d = n*x ;
exitif 0 graph_generate_numbers(d,+1)>=m ;
numeric d ;
@@ -935,25 +962,24 @@ vardef graph_tick_mark_spacing =
if known d : d else : n fi
enddef ;
-
def graph_generate_numbers(expr d)(text t) =
for m = d*ceiling(xpart graph_modified_lower/d) step d until xpart graph_modified_higher :
t
endfor
enddef ;
-
% Evaluate tokens t for exponents e in multiples of d in the range determined
% by graph_modified_lower and graph_modified_higher.
+
def graph_generate_exponents(expr d)(text t) =
for e = d*floor(graph_modified_exponent_ypart(graph_modified_lower)/d+1)
step d until d*floor(ypart graph_modified_higher/d) : t
endfor
enddef ;
-
% Adjust graph_modified_lower and graph_modified_higher so their exponent parts match
% and they are in true exponent form ((x,y) means x*10^y). Return the new exponent.
+
vardef graph_match_exponents =
interim warningcheck := 0 ;
save e ;
@@ -966,10 +992,10 @@ vardef graph_match_exponents =
e
enddef ;
-
% Assume e is an integer and either m=0 or 1<=abs(m)<10000. Find m*(10^e)
% and represent the result as a string if its absolute value would be at least
% 4096 or less than .1. It is OK to return 0 as a string or a numeric.
+
vardef graph_factor_and_exponent_to_string(expr m, e) =
if (e>3)or(e<-4) :
decimal m & "e" & decimal e
@@ -984,7 +1010,6 @@ vardef graph_factor_and_exponent_to_string(expr m, e) =
fi
enddef ;
-
def auto suffix $ =
hide(def graph_comma= hide(def graph_comma=,enddef) enddef)
if graph_bounds.graph_suffix($)=log :
@@ -1002,7 +1027,6 @@ def auto suffix $ =
fi
enddef ;
-
string Autoform ; Autoform = "%g";
%vardef autogrid(suffix tx, ty) text w =
@@ -1053,12 +1077,11 @@ vardef autogrid(suffix tx, ty) text w =
fi
enddef ;
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% endgraph %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def endgraph =
if graph_autogrid_needed : autogrid(otick.bot, otick.lft) ; fi
- if graph_frame_needed : frame ; fi
+ if graph_frame_needed : frame ; fi
setcoords(linear,linear) ;
interim truecorners :=1 ;
for b=bbox graph_finished_graph :
@@ -1075,14 +1098,9 @@ enddef ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% We format in luatex (using \mathematics{}) ...
% we could pass via variables and save escaping as that is inefficient
-Ten_to0 = 1 ;
-Ten_to1 = 10 ;
-Ten_to2 = 100 ;
-Ten_to3 = 1000 ;
-Ten_to4 = 10000 ;
-
if unknown context_mlib :
vardef escaped_format(expr s) =
@@ -1108,6 +1126,8 @@ if unknown context_mlib :
fi ;
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
% A couple of extensions :
% Define a function plotsymbol() returning a picture : 10 different shapes,
diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv
index bdde5df9d..6c4fb6fc1 100644
--- a/tex/context/base/buff-ver.mkiv
+++ b/tex/context/base/buff-ver.mkiv
@@ -758,8 +758,9 @@
\buff_verbatim_setup_line_numbering
\buff_verbatim_initialize_typing_one
\buff_verbatim_initialize_typing_two
- \beginofverbatimlines
\dostarttagged\t!verbatimblock{#1}%
+ \beginofverbatimlines
+ \dostarttagged\t!verbatimlines\empty
\ctxcommand{typebuffer {
name = "#2",
strip = "\typingparameter\c!strip",
@@ -772,6 +773,7 @@
}}%
\dostoptagged
\endofverbatimlines
+ \dostoptagged
\stoppacked
\typingparameter\c!after}
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index e142a9fc0..0e5cda579 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2014.01.17 22:09}
+\newcontextversion{2014.01.18 13:23}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 8e513604e..39af93301 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 0f06c39ce..b3743bbe3 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2014.01.17 22:09}
+\edef\contextversion{2014.01.18 13:23}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua
index 985f70eae..12256f74e 100644
--- a/tex/context/base/publ-aut.lua
+++ b/tex/context/base/publ-aut.lua
@@ -11,6 +11,7 @@ if not characters then
dofile(resolvers.findfile("char-ini.lua"))
end
+local context = context
local chardata = characters.data
local tostring = tostring
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index b1bf34265..049b97ad5 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -115,9 +115,13 @@ function publications.markasupdated(name)
end
setmetatableindex(datasets,function(t,k)
- local v = publications.new(k)
- datasets[k] = v
- return v
+ if type(k) == "table" then
+ return k -- so we can use this accessor as checker
+ else
+ local v = publications.new(k)
+ datasets[k] = v
+ return v
+ end
end)
-- we apply some normalization
@@ -259,6 +263,7 @@ local bibtotable = (space + forget + shortcut/do_shortcut + definition/do_defini
-- converttoxml -> dataset.xmldata from dataset.luadata
function publications.loadbibdata(dataset,content,source,kind)
+ dataset = datasets[dataset]
statistics.starttiming(publications)
publicationsstats.nofbytes = publicationsstats.nofbytes + #content
dataset.nofbytes = dataset.nofbytes + #content
@@ -286,6 +291,7 @@ local cleaner_2 = Cs ( (
local compact = false -- can be a directive but then we also need to deal with newlines ... not now
function publications.converttoxml(dataset,nice) -- we have fields !
+ dataset = datasets[dataset]
local luadata = dataset and dataset.luadata
if luadata then
statistics.starttiming(publications)
@@ -357,6 +363,7 @@ local loaders = publications.loaders or { }
publications.loaders = loaders
function loaders.bib(dataset,filename,kind)
+ dataset = datasets[dataset]
local data = io.loaddata(filename) or ""
if data == "" then
report("empty file %a, nothing loaded",filename)
@@ -367,6 +374,7 @@ function loaders.bib(dataset,filename,kind)
end
function loaders.lua(dataset,filename) -- if filename is a table we load that one
+ dataset = datasets[dataset]
if type(dataset) == "table" then
dataset = datasets[dataset]
end
@@ -383,6 +391,7 @@ function loaders.lua(dataset,filename) -- if filename is a table we load that on
end
function loaders.xml(dataset,filename)
+ dataset = datasets[dataset]
local luadata = dataset.luadata
local root = xml.load(filename)
for entry in xmlcollected(root,"/bibtex/entry") do
@@ -417,6 +426,7 @@ setmetatableindex(loaders,function(t,filetype)
end)
function publications.load(dataset,filename,kind)
+ dataset = datasets[dataset]
statistics.starttiming(publications)
local files = settings_to_array(filename)
for i=1,#files do
@@ -438,12 +448,14 @@ function publications.load(dataset,filename,kind)
end
end
statistics.stoptiming(publications)
+ return dataset
end
local checked = function(s,d) d[s] = (d[s] or 0) + 1 end
local checktex = ( (1-P("\\"))^1 + P("\\") * ((C(R("az","AZ")^1) * Carg(1))/checked))^0
function publications.analyze(dataset)
+ dataset = datasets[dataset]
local data = dataset.luadata
local categories = { }
local fields = { }
diff --git a/tex/context/base/publ-imp-apa.mkiv b/tex/context/base/publ-imp-apa.mkiv
index 327daa986..2db044cbf 100644
--- a/tex/context/base/publ-imp-apa.mkiv
+++ b/tex/context/base/publ-imp-apa.mkiv
@@ -312,8 +312,8 @@
\btxcomma\btxflush{chapter}
}
\btxsetup{btx:apa:common:pages:pages}
- \btxperiod
}
+ \btxperiod
}
}
}
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index afdc1b76a..e8061a33b 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -21,8 +21,6 @@ local lpegmatch = lpeg.match
local report = logs.reporter("publications")
local trace = false trackers.register("publications", function(v) trace = v end)
-local context = context
-
local datasets = publications.datasets
local variables = interfaces.variables
@@ -52,6 +50,23 @@ local logspushtarget = logs.pushtarget
local logspoptarget = logs.poptarget
local csname_id = token.csname_id
+local context = context
+
+local ctx_btxlistparameter = context.btxlistparameter
+local ctx_btxcitevariantparameter = context.btxcitevariantparameter
+local ctx_btxlistvariantparameter = context.btxlistvariantparameter
+local ctx_btxdomarkcitation = context.btxdomarkcitation
+local ctx_setvalue = context.setvalue
+local ctx_firstoftwoarguments = context.firstoftwoarguments
+local ctx_secondoftwoarguments = context.secondoftwoarguments
+local ctx_firstofoneargument = context.firstofoneargument
+local ctx_gobbleoneargument = context.gobbleoneargument
+local ctx_btxdirectlink = context.btxdirectlink
+local ctx_btxhandlelistentry = context.btxhandlelistentry
+local ctx_btxchecklistentry = context.btxchecklistentry
+local ctx_dodirectfullreference = context.dodirectfullreference
+local ctx_directsetup = context.directsetup
+
statistics.register("publications load time", function()
local publicationsstats = publications.statistics
local nofbytes = publicationsstats.nofbytes
@@ -403,11 +418,11 @@ function commands.btxdoifelse(name,tag,field)
local data = dataset.luadata[tag]
local value = data and data[field]
if value and value ~= "" then
- context.firstoftwoarguments()
+ ctx_firstoftwoarguments()
return
end
end
- context.secondoftwoarguments()
+ ctx_secondoftwoarguments()
end
function commands.btxdoif(name,tag,field)
@@ -416,11 +431,11 @@ function commands.btxdoif(name,tag,field)
local data = dataset.luadata[tag]
local value = data and data[field]
if value and value ~= "" then
- context.firstofoneargument()
+ ctx_firstofoneargument()
return
end
end
- context.gobbleoneargument()
+ ctx_gobbleoneargument()
end
function commands.btxdoifnot(name,tag,field)
@@ -429,11 +444,11 @@ function commands.btxdoifnot(name,tag,field)
local data = dataset.luadata[tag]
local value = data and data[field]
if value and value ~= "" then
- context.gobbleoneargument()
+ ctx_gobbleoneargument()
return
end
end
- context.firstofoneargument()
+ ctx_firstofoneargument()
end
-- -- alternative approach: keep data at the tex end
@@ -445,12 +460,12 @@ function publications.listconcat(t)
if n > 1 then
if n > 2 then
for i=2,n-1 do
- context.btxlistparameter("sep")
+ ctx_btxlistparameter("sep")
context(t[i])
end
- context.btxlistparameter("finalsep")
+ ctx_btxlistparameter("finalsep")
else
- context.btxlistparameter("lastsep")
+ ctx_btxlistparameter("lastsep")
end
context(t[n])
end
@@ -464,12 +479,12 @@ function publications.citeconcat(t)
if n > 1 then
if n > 2 then
for i=2,n-1 do
- context.btxcitevariantparameter("sep")
+ ctx_btxcitevariantparameter("sep")
context(t[i])
end
- context.btxcitevariantparameter("finalsep")
+ ctx_btxcitevariantparameter("finalsep")
else
- context.btxcitevariantparameter("lastsep")
+ ctx_btxcitevariantparameter("lastsep")
end
context(t[n])
end
@@ -484,105 +499,105 @@ function publications.singularorplural(singular,plural)
end
end
-function commands.makebibauthorlist(settings)
- if not settings then
- return
- end
- local dataset = datasets[settings.dataset]
- if not dataset or dataset == "" then
- return
- end
- local tag = settings.tag
- if not tag or tag == "" then
- return
- end
- local asked = settings_to_array(tag)
- if #asked == 0 then
- return
- end
- local compress = settings.compress
- local interaction = settings.interactionn == v_start
- local limit = tonumber(settings.limit)
- local found = { }
- local hash = { }
- local total = 0
- local luadata = dataset.luadata
- for i=1,#asked do
- local tag = asked[i]
- local data = luadata[tag]
- if data then
- local author = data.a or "Xxxxxxxxxx"
- local year = data.y or "0000"
- if not compress or not hash[author] then
- local t = {
- author = author,
- name = name, -- first
- year = { [year] = name },
- }
- total = total + 1
- found[total] = t
- hash[author] = t
- else
- hash[author].year[year] = name
- end
- end
- end
- for i=1,total do
- local data = found[i]
- local author = data.author
- local year = table.keys(data.year)
- table.sort(year)
- if interaction then
- for i=1,#year do
- year[i] = string.formatters["\\bibmaybeinteractive{%s}{%s}"](data.year[year[i]],year[i])
- end
- end
- context.setvalue("currentbibyear",concat(year,","))
- if author == "" then
- context.setvalue("currentbibauthor","")
- else -- needs checking
- local authors = settings_to_array(author) -- {{}{}},{{}{}}
- local nofauthors = #authors
- if nofauthors == 1 then
- if interaction then
- author = string.formatters["\\bibmaybeinteractive{%s}{%s}"](data.name,author)
- end
- context.setvalue("currentbibauthor",author)
- else
- limit = limit or nofauthors
- if interaction then
- for i=1,#authors do
- authors[i] = string.formatters["\\bibmaybeinteractive{%s}{%s}"](data.name,authors[i])
- end
- end
- if limit == 1 then
- context.setvalue("currentbibauthor",authors[1] .. "\\bibalternative{otherstext}")
- elseif limit == 2 and nofauthors == 2 then
- context.setvalue("currentbibauthor",concat(authors,"\\bibalternative{andtext}"))
- else
- for i=1,limit-1 do
- authors[i] = authors[i] .. "\\bibalternative{namesep}"
- end
- if limit < nofauthors then
- authors[limit+1] = "\\bibalternative{otherstext}"
- context.setvalue("currentbibauthor",concat(authors,"",1,limit+1))
- else
- authors[limit-1] = authors[limit-1] .. "\\bibalternative{andtext}"
- context.setvalue("currentbibauthor",concat(authors))
- end
- end
- end
- end
- -- the following use: currentbibauthor and currentbibyear
- if i == 1 then
- context.ixfirstcommand()
- elseif i == total then
- context.ixlastcommand()
- else
- context.ixsecondcommand()
- end
- end
-end
+-- function commands.makebibauthorlist(settings) -- ?
+-- if not settings then
+-- return
+-- end
+-- local dataset = datasets[settings.dataset]
+-- if not dataset or dataset == "" then
+-- return
+-- end
+-- local tag = settings.tag
+-- if not tag or tag == "" then
+-- return
+-- end
+-- local asked = settings_to_array(tag)
+-- if #asked == 0 then
+-- return
+-- end
+-- local compress = settings.compress
+-- local interaction = settings.interactionn == v_start
+-- local limit = tonumber(settings.limit)
+-- local found = { }
+-- local hash = { }
+-- local total = 0
+-- local luadata = dataset.luadata
+-- for i=1,#asked do
+-- local tag = asked[i]
+-- local data = luadata[tag]
+-- if data then
+-- local author = data.a or "Xxxxxxxxxx"
+-- local year = data.y or "0000"
+-- if not compress or not hash[author] then
+-- local t = {
+-- author = author,
+-- name = name, -- first
+-- year = { [year] = name },
+-- }
+-- total = total + 1
+-- found[total] = t
+-- hash[author] = t
+-- else
+-- hash[author].year[year] = name
+-- end
+-- end
+-- end
+-- for i=1,total do
+-- local data = found[i]
+-- local author = data.author
+-- local year = table.keys(data.year)
+-- table.sort(year)
+-- if interaction then
+-- for i=1,#year do
+-- year[i] = formatters["\\bibmaybeinteractive{%s}{%s}"](data.year[year[i]],year[i])
+-- end
+-- end
+-- ctx_setvalue("currentbibyear",concat(year,","))
+-- if author == "" then
+-- ctx_setvalue("currentbibauthor","")
+-- else -- needs checking
+-- local authors = settings_to_array(author) -- {{}{}},{{}{}}
+-- local nofauthors = #authors
+-- if nofauthors == 1 then
+-- if interaction then
+-- author = formatters["\\bibmaybeinteractive{%s}{%s}"](data.name,author)
+-- end
+-- ctx_setvalue("currentbibauthor",author)
+-- else
+-- limit = limit or nofauthors
+-- if interaction then
+-- for i=1,#authors do
+-- authors[i] = formatters["\\bibmaybeinteractive{%s}{%s}"](data.name,authors[i])
+-- end
+-- end
+-- if limit == 1 then
+-- ctx_setvalue("currentbibauthor",authors[1] .. "\\bibalternative{otherstext}")
+-- elseif limit == 2 and nofauthors == 2 then
+-- ctx_setvalue("currentbibauthor",concat(authors,"\\bibalternative{andtext}"))
+-- else
+-- for i=1,limit-1 do
+-- authors[i] = authors[i] .. "\\bibalternative{namesep}"
+-- end
+-- if limit < nofauthors then
+-- authors[limit+1] = "\\bibalternative{otherstext}"
+-- ctx_setvalue("currentbibauthor",concat(authors,"",1,limit+1))
+-- else
+-- authors[limit-1] = authors[limit-1] .. "\\bibalternative{andtext}"
+-- ctx_setvalue("currentbibauthor",concat(authors))
+-- end
+-- end
+-- end
+-- end
+-- -- the following use: currentbibauthor and currentbibyear
+-- if i == 1 then
+-- context.ixfirstcommand()
+-- elseif i == total then
+-- context.ixlastcommand()
+-- else
+-- context.ixsecondcommand()
+-- end
+-- end
+-- end
local patterns = { "publ-imp-%s.mkiv", "publ-imp-%s.tex" }
@@ -719,6 +734,11 @@ function lists.collectentries(specification)
end
end
end
+ elseif method == v_dataset then
+ dataset = datasets[dataset]
+ for tag, data in table.sortedhash(dataset.luadata) do
+ list[#list+1] = { tag }
+ end
end
end
@@ -775,16 +795,16 @@ function lists.flushentries(dataset,sortvariant)
sort(list,compare)
end
for i=1,#list do
- context.setvalue("currentbtxindex",i)
- context.btxhandlelistentry(list[i][1]) -- we can pass i here too ... more efficient to avoid the setvalue
+ ctx_setvalue("currentbtxindex",i)
+ ctx_btxhandlelistentry(list[i][1]) -- we can pass i here too ... more efficient to avoid the setvalue
end
end
function lists.fetchentries(dataset)
local list = renderings[dataset].list
for i=1,#list do
- context.setvalue("currentbtxindex",i)
- context.btxchecklistentry(list[i][1])
+ ctx_setvalue("currentbtxindex",i)
+ ctx_btxchecklistentry(list[i][1])
end
end
@@ -921,17 +941,17 @@ function lists.resolve(dataset,reference) -- maybe already feed it split
for i=1,nofcollected do
local c = collected[i]
if i == nofcollected then
- context.btxlistvariantparameter("lastpubsep")
+ ctx_btxlistvariantparameter("lastpubsep")
elseif i > 1 then
- context.btxlistvariantparameter("pubsep")
+ ctx_btxlistvariantparameter("pubsep")
end
if #c == 3 then -- a range (3 is first or last)
- context.btxdirectlink(f_reference(dataset,c[1],c[2]),c[3])
+ ctx_btxdirectlink(f_reference(dataset,c[1],c[2]),c[3])
else
local f, l = c[2], c[2]
- context.btxdirectlink(f_reference(dataset,f[1],f[2]),f[3])
+ ctx_btxdirectlink(f_reference(dataset,f[1],f[2]),f[3])
context.endash() -- to do
- context.btxdirectlink(f_reference(dataset,l[4],l[5]),l[6])
+ ctx_btxdirectlink(f_reference(dataset,l[4],l[5]),l[6])
end
end
else
@@ -948,7 +968,7 @@ function commands.btxreference(dataset,block,tag,data)
local ref = f_reference(dataset,block,tag)
if not done[ref] then
done[ref] = true
- context.dodirectfullreference(ref,data)
+ ctx_dodirectfullreference(ref,data)
end
end
@@ -958,7 +978,7 @@ function commands.btxdestination(dataset,block,tag,data)
local ref = f_destination(dataset,block,tag)
if not done[ref] then
done[ref] = true
- context.dodirectfullreference(ref,data)
+ ctx_dodirectfullreference(ref,data)
end
end
@@ -1020,25 +1040,25 @@ function commands.btxhandlecite(dataset,tag,mark,variant,sorttype,setup) -- vari
else
rest = tag
end
- context.setvalue("currentbtxdataset",dataset)
+ ctx_setvalue("currentbtxdataset",dataset)
local tags = settings_to_array(rest)
if #tags > 0 then
if sorttype and sorttype ~= "" then
tags = sortedtags(dataset,tags,sorttype)
end
- context.btxcitevariantparameter(v_left)
+ ctx_btxcitevariantparameter(v_left)
for i=1,#tags do
local tag = tags[i]
- context.setvalue("currentbtxtag",tag)
+ ctx_setvalue("currentbtxtag",tag)
if i > 1 then
- context.btxcitevariantparameter(v_middle)
+ ctx_btxcitevariantparameter(v_middle)
end
if mark ~= false then
- context.dobtxmarkcitation(dataset,tag)
+ ctx_btxdomarkcitation(dataset,tag)
end
- context.formatted.directsetup(setup) -- cite can become alternative
+ ctx_directsetup(setup) -- cite can become alternative
end
- context.btxcitevariantparameter(v_right)
+ ctx_btxcitevariantparameter(v_right)
else
-- error
end
@@ -1052,10 +1072,10 @@ function commands.btxhandlenocite(dataset,tag,mark)
else
rest = tag
end
- context.setvalue("currentbtxdataset",dataset)
+ ctx_setvalue("currentbtxdataset",dataset)
local tags = settings_to_array(rest)
for i=1,#tags do
- context.dobtxmarkcitation(dataset,tags[i])
+ ctx_btxdomarkcitation(dataset,tags[i])
end
end
end
@@ -1162,7 +1182,7 @@ end
function citevariants.authornum(dataset,tags)
local result, order = collectauthoryears(dataset,tags,method,what) -- we can have a collectauthors
publications.citeconcat(order)
- context.btxcitevariantparameter(v_inbetween)
+ ctx_btxcitevariantparameter(v_inbetween)
lists.resolve(dataset,tags) -- left/right ?
end
@@ -1179,7 +1199,7 @@ function citevariants.page(dataset,tags)
-- nothing
elseif type(pages) == "table" then
context(pages[1])
- context.btxcitevariantparameter(v_inbetween)
+ ctx_btxcitevariantparameter(v_inbetween)
context(pages[2])
else
context(pages)
@@ -1206,10 +1226,10 @@ publications.listvariants = listvariants
-- if sorttype and sorttype ~= "" then
-- tags = sortedtags(dataset,tags,sorttype)
-- end
--- context.setvalue("currentbtxtag",tag)
--- context.btxlistvariantparameter(v_left)
--- context.formatted.directsetup(setup)
--- context.btxlistvariantparameter(v_right)
+-- ctx_setvalue("currentbtxtag",tag)
+-- ctx_btxlistvariantparameter(v_left)
+-- ctx_directsetup(setup)
+-- ctx_btxlistvariantparameter(v_right)
-- end
function commands.btxlistvariant(dataset,block,tags,variant,listindex)
@@ -1224,7 +1244,7 @@ function listvariants.default(dataset,block,tags,variant)
end
function listvariants.num(dataset,block,tags,variant,listindex)
- context.btxdirectlink(f_destination(dataset,block,tags),listindex) -- not okay yet
+ ctx_btxdirectlink(f_destination(dataset,block,tags),listindex) -- not okay yet
end
function listvariants.short(dataset,block,tags,variant,listindex)
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index 92dffdce3..3de7c5033 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -14,6 +14,8 @@
% todo: we cannot use 'default' as this wipes metadata names (maybe no longer do that)
% todo: \v!cite => \s!cite
% todo: interface with (ml)bibtex (export -> call -> import)
+% todo: check if 'all' etc are ok ... either use list or use other criterium
+% todo: maybe use description instead of list
% \definecolor[btx:field] [darkred]
% \definecolor[btx:crossref][darkblue]
@@ -294,6 +296,9 @@
\fi
\to \everysetupbtxlistplacement
+% use description instead of list ... more flexible .. but then not via
+% a real description in the tuc but directly
+
\def\publ_place_list_indeed
{\startbtxrendering[\currentbtxrendering]%
\directsetup{\btxrenderingparameter\c!setups}%
@@ -552,7 +557,7 @@
\def\publ_cite_indeed#1#2%
{\expanded{\writedatatolist[btx][btxset=#1,btxref=#2]}}
-\def\dobtxmarkcitation#1#2% called from lua end
+\def\btxdomarkcitation#1#2% called from lua end
{\iftrialtypesetting \else
\writedatatolist[btx][btxset=#1,btxref=#2]% \c!location=\v!here
\fi}
diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua
index 708795727..90bae67e9 100644
--- a/tex/context/base/publ-tra.lua
+++ b/tex/context/base/publ-tra.lua
@@ -11,6 +11,7 @@ local sortedhash = table.sortedhash
local tracers = { }
publications.tracers = tracers
+local context = context
local NC, NR, bold = context.NC, context.NR, context.bold
publications.tracers.fields = table.sorted {
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index bc2385de2..2daf3dee7 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index fc3a4d4df..23966b542 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 42eee2723..e85e075a6 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 01/17/14 22:09:11
+-- merge date : 01/18/14 13:23:27
do -- begin closure to overcome local limits and interference