summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context/data/scite/context/lexers/data/scite-context-data-metapost.lua2
-rw-r--r--context/data/scite/context/lexers/scite-context-lexer-tex.lua3
-rw-r--r--context/data/scite/context/scite-context-data-metapost.properties2
-rw-r--r--doc/context/documents/general/manuals/epub-mkiv-demo.epubbin0 -> 10048 bytes
-rw-r--r--doc/context/documents/general/manuals/epub-mkiv-demo.pdfbin0 -> 19063 bytes
-rw-r--r--doc/context/documents/general/manuals/epub-mkiv.pdfbin0 -> 97770 bytes
-rw-r--r--doc/context/documents/general/manuals/tiptrick.pdfbin47399 -> 47397 bytes
-rw-r--r--doc/context/documents/general/manuals/workflows-mkiv.pdfbin71319 -> 74818 bytes
-rw-r--r--doc/context/scripts/mkii/texmfstart.html1
-rw-r--r--doc/context/scripts/mkii/texmfstart.man3
-rw-r--r--doc/context/scripts/mkii/texmfstart.xml1
-rw-r--r--doc/context/scripts/mkiv/mtx-bibtex.html55
-rw-r--r--doc/context/scripts/mkiv/mtx-bibtex.man33
-rw-r--r--doc/context/scripts/mkiv/mtx-bibtex.xml28
-rw-r--r--doc/context/scripts/mkiv/mtxrun.html1
-rw-r--r--doc/context/scripts/mkiv/mtxrun.man3
-rw-r--r--doc/context/scripts/mkiv/mtxrun.xml1
-rw-r--r--doc/context/sources/general/manuals/epub/epub-mkiv-demo.tex43
-rw-r--r--doc/context/sources/general/manuals/epub/epub-mkiv.tex463
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-graphics.tex22
-rw-r--r--metapost/context/base/mp-chem.mpiv2
-rw-r--r--scripts/context/lua/mtxrun.lua91
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua91
-rw-r--r--scripts/context/stubs/unix/mtxrun91
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua91
-rw-r--r--tex/context/base/anch-bck.mkvi6
-rw-r--r--tex/context/base/anch-pgr.lua3
-rw-r--r--tex/context/base/anch-pos.lua10
-rw-r--r--tex/context/base/back-exp.lua9
-rw-r--r--tex/context/base/back-pdf.lua10
-rw-r--r--tex/context/base/buff-ver.mkiv26
-rw-r--r--tex/context/base/catc-ini.mkiv25
-rw-r--r--tex/context/base/char-ini.lua7
-rw-r--r--tex/context/base/char-ini.mkiv35
-rw-r--r--tex/context/base/char-tex.lua159
-rw-r--r--tex/context/base/char-utf.lua24
-rw-r--r--tex/context/base/cldf-bas.lua24
-rw-r--r--tex/context/base/cldf-ini.lua4
-rw-r--r--tex/context/base/cldf-scn.lua100
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4384 -> 4343 bytes
-rw-r--r--tex/context/base/context.mkiv13
-rw-r--r--tex/context/base/file-job.mkvi4
-rw-r--r--tex/context/base/file-res.lua2
-rw-r--r--tex/context/base/font-chk.lua16
-rw-r--r--tex/context/base/font-ctx.lua11
-rw-r--r--tex/context/base/font-map.lua4
-rw-r--r--tex/context/base/grph-inc.lua2
-rw-r--r--tex/context/base/l-lpeg.lua198
-rw-r--r--tex/context/base/lang-hyp.lua120
-rw-r--r--tex/context/base/lang-ini.lua20
-rw-r--r--tex/context/base/lang-ini.mkiv4
-rw-r--r--tex/context/base/lpdf-ano.lua2
-rw-r--r--tex/context/base/lpdf-xmp.lua2
-rw-r--r--tex/context/base/luat-cnf.lua3
-rw-r--r--tex/context/base/luat-ini.mkiv50
-rw-r--r--tex/context/base/lxml-ini.lua131
-rw-r--r--tex/context/base/lxml-ini.mkiv4
-rw-r--r--tex/context/base/m-hemistich.mkiv8
-rw-r--r--tex/context/base/m-translate.mkiv31
-rw-r--r--tex/context/base/mlib-run.lua39
-rw-r--r--tex/context/base/mult-aux.mkiv20
-rw-r--r--tex/context/base/mult-mps.lua2
-rw-r--r--tex/context/base/page-brk.mkiv2
-rw-r--r--tex/context/base/publ-dat.lua146
-rw-r--r--tex/context/base/publ-fnd.lua107
-rw-r--r--tex/context/base/publ-imp-apa.lua3
-rw-r--r--tex/context/base/publ-imp-apa.mkvi216
-rw-r--r--tex/context/base/publ-imp-aps.lua149
-rw-r--r--tex/context/base/publ-imp-aps.mkvi1382
-rw-r--r--tex/context/base/publ-imp-author.mkvi82
-rw-r--r--tex/context/base/publ-imp-cite.mkvi42
-rw-r--r--tex/context/base/publ-imp-default.mkvi85
-rw-r--r--tex/context/base/publ-imp-list.mkvi13
-rw-r--r--tex/context/base/publ-ini.lua299
-rw-r--r--tex/context/base/publ-ini.mkiv231
-rw-r--r--tex/context/base/publ-reg.lua37
-rw-r--r--tex/context/base/s-inf-03.mkiv19
-rw-r--r--tex/context/base/s-math-repertoire.mkiv5
-rw-r--r--tex/context/base/scrn-pag.mkvi45
-rw-r--r--tex/context/base/spac-ver.mkiv14
-rw-r--r--tex/context/base/status-files.pdfbin24671 -> 24641 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin343152 -> 398039 bytes
-rw-r--r--tex/context/base/status-mkiv.lua10
-rw-r--r--tex/context/base/strc-doc.lua15
-rw-r--r--tex/context/base/strc-not.mkvi8
-rw-r--r--tex/context/base/strc-num.lua9
-rw-r--r--tex/context/base/strc-reg.mkiv2
-rw-r--r--tex/context/base/supp-box.mkiv4
-rw-r--r--tex/context/base/syst-aux.lua53
-rw-r--r--tex/context/base/syst-aux.mkiv44
-rw-r--r--tex/context/base/syst-ini.mkiv17
-rw-r--r--tex/context/base/syst-lua.lua9
-rw-r--r--tex/context/base/toks-ini.lua97
-rw-r--r--tex/context/base/toks-ini.mkiv2
-rw-r--r--tex/context/base/toks-scn.lua378
-rw-r--r--tex/context/base/type-imp-dejavu.mkiv63
-rw-r--r--tex/context/base/typo-del.mkiv2
-rw-r--r--tex/context/base/typo-itc.lua76
-rw-r--r--tex/context/base/util-seq.lua32
-rw-r--r--tex/context/base/x-set-11.mkiv14
-rw-r--r--tex/context/base/x-xtag.mkiv2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua90
103 files changed, 4077 insertions, 1884 deletions
diff --git a/context/data/scite/context/lexers/data/scite-context-data-metapost.lua b/context/data/scite/context/lexers/data/scite-context-data-metapost.lua
index 06e247c39..f3ace2b6a 100644
--- a/context/data/scite/context/lexers/data/scite-context-data-metapost.lua
+++ b/context/data/scite/context/lexers/data/scite-context-data-metapost.lua
@@ -3,7 +3,7 @@ return {
["disabled"]={ "verbatimtex", "troffmode" },
["internals"]={ "mitered", "rounded", "beveled", "butt", "squared", "eps", "epsilon", "infinity", "bboxmargin", "ahlength", "ahangle", "labeloffset", "dotlabeldiam", "defaultpen", "defaultscale", "join_radius", "charscale", "pen_lft", "pen_rt", "pen_top", "pen_bot" },
["metafont"]={ "autorounding", "beginchar", "blacker", "boundarychar", "capsule_def", "capsule_end", "change_width", "chardp", "chardx", "chardy", "charexists", "charext", "charht", "charic", "charlist", "charwd", "cull", "cullit", "currenttransform", "currentwindow", "define_blacker_pixels", "define_corrected_pixels", "define_good_x_pixels", "define_good_y_pixels", "define_horizontal_corrected_pixels", "define_pixels", "define_whole_blacker_pixels", "define_whole_pixels", "define_whole_vertical_blacker_pixels", "define_whole_vertical_pixels", "designsize", "display", "displaying", "endchar", "extensible", "extra_beginchar", "extra_endchar", "extra_setup", "fillin", "font_coding_scheme", "font_extra_space", "font_identifier", "font_normal_shrink", "font_normal_space", "font_normal_stretch", "font_quad", "font_size", "font_slant", "font_x_height", "fontdimen", "fontmaking", "gfcorners", "granularity", "grayfont", "headerbyte", "hppp", "hround", "imagerules", "italcorr", "kern", "labelfont", "ligtable", "lowres_fix", "makebox", "makegrid", "maketicks", "mode_def", "mode_setup", "nodisplays", "notransforms", "numspecial", "o_correction", "openit", "openwindow", "pixels_per_inch", "proofing", "proofoffset", "proofrule", "proofrulethickness", "rulepen", "screenchars", "screenrule", "screenstrokes", "screen_cols", "screen_rows", "showit", "slantfont", "smode", "smoothing", "titlefont", "totalweight", "tracingedges", "tracingpens", "turningcheck", "unitpixel", "vppp", "vround", "xoffset", "yoffset" },
- ["primitives"]={ "charcode", "day", "linecap", "linejoin", "miterlimit", "month", "pausing", "prologues", "showstopping", "time", "tracingcapsules", "tracingchoices", "mpprocset", "tracingcommands", "tracingequations", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingrestores", "tracingspecs", "tracingstats", "tracingtitles", "truecorners", "warningcheck", "year", "false", "nullpicture", "pencircle", "true", "and", "angle", "arclength", "arctime", "ASCII", "boolean", "bot", "char", "color", "cosd", "cycle", "decimal", "directiontime", "floor", "fontsize", "hex", "infont", "intersectiontimes", "known", "length", "llcorner", "lrcorner", "makepath", "makepen", "mexp", "mlog", "normaldeviate", "not", "numeric", "oct", "odd", "or", "path", "pair", "pen", "penoffset", "picture", "point", "postcontrol", "precontrol", "reverse", "rotated", "scaled", "shifted", "sind", "slanted", "sqrt", "str", "string", "subpath", "substring", "transform", "transformed", "ulcorner", "uniformdeviate", "unknown", "urcorner", "xpart", "xscaled", "xxpart", "xypart", "ypart", "yscaled", "yxpart", "yypart", "zscaled", "addto", "clip", "input", "interim", "let", "newinternal", "save", "setbounds", "shipout", "show", "showdependencies", "showtoken", "showvariable", "special", "begingroup", "endgroup", "of", "curl", "tension", "and", "controls", "interpath", "on", "off", "def", "vardef", "enddef", "expr", "suffix", "text", "primary", "secondary", "tertiary", "primarydef", "secondarydef", "tertiarydef", "randomseed", "also", "contour", "doublepath", "withcolor", "withcmykcolor", "withpen", "dashed", "if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "within", "forsuffixes", "step", "until", "charlist", "extensible", "fontdimen", "headerbyte", "kern", "ligtable", "boundarychar", "chardp", "charext", "charht", "charic", "charwd", "designsize", "fontmaking", "charexists", "cullit", "currenttransform", "gfcorners", "grayfont", "hround", "imagerules", "lowres_fix", "nodisplays", "notransforms", "openit", "displaying", "currentwindow", "screen_rows", "screen_cols", "pixels_per_inch", "cull", "display", "openwindow", "numspecial", "totalweight", "autorounding", "fillin", "proofing", "tracingpens", "xoffset", "chardx", "granularity", "smoothing", "turningcheck", "yoffset", "chardy", "hppp", "tracingedges", "vppp", "extra_beginfig", "extra_endfig", "mpxbreak", "endinput", "message", "delimiters", "turningnumber", "errmessage", "readstring", "scantokens", "end", "outer", "inner", "write", "to", "readfrom", "withprescript", "withpostscript", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt", "redpart", "greenpart", "bluepart", "cyanpart", "magentapart", "yellowpart", "blackpart", "prescriptpart", "postscriptpart", "rgbcolor", "cmykcolor", "colormodel", "graypart", "greypart", "greycolor", "graycolor", "dashpart", "penpart", "stroked", "filled", "textual", "clipped", "bounded", "pathpart", "expandafter", "minute", "hour", "outputformat", "outputtemplate", "filenametemplate", "fontmapfile", "fontmapline", "fontpart", "fontsize", "glyph", "restoreclipcolor", "troffmode", "runscript" },
+ ["primitives"]={ "charcode", "day", "linecap", "linejoin", "miterlimit", "month", "pausing", "prologues", "showstopping", "time", "tracingcapsules", "tracingchoices", "mpprocset", "tracingcommands", "tracingequations", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingrestores", "tracingspecs", "tracingstats", "tracingtitles", "truecorners", "warningcheck", "year", "false", "nullpicture", "pencircle", "true", "and", "angle", "arclength", "arctime", "ASCII", "boolean", "bot", "char", "color", "cosd", "cycle", "decimal", "directiontime", "floor", "fontsize", "hex", "infont", "intersectiontimes", "known", "length", "llcorner", "lrcorner", "makepath", "makepen", "mexp", "mlog", "normaldeviate", "not", "numeric", "oct", "odd", "or", "path", "pair", "pen", "penoffset", "picture", "point", "postcontrol", "precontrol", "reverse", "rotated", "scaled", "shifted", "sind", "slanted", "sqrt", "str", "string", "subpath", "substring", "transform", "transformed", "ulcorner", "uniformdeviate", "unknown", "urcorner", "xpart", "xscaled", "xxpart", "xypart", "ypart", "yscaled", "yxpart", "yypart", "zscaled", "addto", "clip", "input", "interim", "let", "newinternal", "save", "setbounds", "shipout", "show", "showdependencies", "showtoken", "showvariable", "special", "begingroup", "endgroup", "of", "curl", "tension", "and", "controls", "interpath", "on", "off", "def", "vardef", "enddef", "expr", "suffix", "text", "primary", "secondary", "tertiary", "primarydef", "secondarydef", "tertiarydef", "randomseed", "also", "contour", "doublepath", "withcolor", "withcmykcolor", "withpen", "dashed", "if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "within", "forsuffixes", "step", "until", "charlist", "extensible", "fontdimen", "headerbyte", "kern", "ligtable", "boundarychar", "chardp", "charext", "charht", "charic", "charwd", "designsize", "fontmaking", "charexists", "cullit", "currenttransform", "gfcorners", "grayfont", "hround", "imagerules", "lowres_fix", "nodisplays", "notransforms", "openit", "displaying", "currentwindow", "screen_rows", "screen_cols", "pixels_per_inch", "cull", "display", "openwindow", "numspecial", "totalweight", "autorounding", "fillin", "proofing", "tracingpens", "xoffset", "chardx", "granularity", "smoothing", "turningcheck", "yoffset", "chardy", "hppp", "tracingedges", "vppp", "extra_beginfig", "extra_endfig", "mpxbreak", "endinput", "message", "delimiters", "turningnumber", "errmessage", "readstring", "scantokens", "end", "outer", "inner", "write", "to", "readfrom", "withprescript", "withpostscript", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt", "redpart", "greenpart", "bluepart", "cyanpart", "magentapart", "yellowpart", "blackpart", "prescriptpart", "postscriptpart", "rgbcolor", "cmykcolor", "colormodel", "graypart", "greypart", "greycolor", "graycolor", "dashpart", "penpart", "stroked", "filled", "textual", "clipped", "bounded", "pathpart", "expandafter", "minute", "hour", "outputformat", "outputtemplate", "filenametemplate", "fontmapfile", "fontmapline", "fontpart", "fontsize", "glyph", "restoreclipcolor", "troffmode", "runscript", "maketext" },
["shortcuts"]={ "..", "...", "--", "---", "&", "\\" },
["tex"]={ "btex", "etex", "verbatimtex" },
} \ No newline at end of file
diff --git a/context/data/scite/context/lexers/scite-context-lexer-tex.lua b/context/data/scite/context/lexers/scite-context-lexer-tex.lua
index 0099b968a..a34d3842a 100644
--- a/context/data/scite/context/lexers/scite-context-lexer-tex.lua
+++ b/context/data/scite/context/lexers/scite-context-lexer-tex.lua
@@ -410,6 +410,8 @@ local stoplua = P("\\stop") * Cmt(luaenvironment,stopdisplaylua)
local startluacode = token("embedded", startlua)
local stopluacode = #stoplua * token("embedded", stoplua)
+local luacall = P("clf_") * R("az","__","AZ")^1
+
local metafuncall = ( P("reusable") + P("usable") + P("unique") + P("use") + P("reuse") ) * ("MPgraphic")
+ P("uniqueMPpagegraphic")
+ P("MPpositiongraphic")
@@ -430,6 +432,7 @@ local startmetafuncode = token("embedded", startmetafun) * metafunargument
local stopmetafuncode = token("embedded", stopmetafun)
local callers = token("embedded", P("\\") * metafuncall) * metafunarguments
+ + token("embedded", P("\\") * luacall)
lexer.embed_lexer(contextlexer, cldlexer, startluacode, stopluacode)
lexer.embed_lexer(contextlexer, mpslexer, startmetafuncode, stopmetafuncode)
diff --git a/context/data/scite/context/scite-context-data-metapost.properties b/context/data/scite/context/scite-context-data-metapost.properties
index db91621b1..59014623a 100644
--- a/context/data/scite/context/scite-context-data-metapost.properties
+++ b/context/data/scite/context/scite-context-data-metapost.properties
@@ -116,7 +116,7 @@ penpart stroked filled textual clipped \
bounded pathpart expandafter minute hour \
outputformat outputtemplate filenametemplate fontmapfile fontmapline \
fontpart fontsize glyph restoreclipcolor troffmode \
-runscript
+runscript maketext
keywordclass.metapost.shortcuts=\
.. ... -- --- \
diff --git a/doc/context/documents/general/manuals/epub-mkiv-demo.epub b/doc/context/documents/general/manuals/epub-mkiv-demo.epub
new file mode 100644
index 000000000..c813e4e79
--- /dev/null
+++ b/doc/context/documents/general/manuals/epub-mkiv-demo.epub
Binary files differ
diff --git a/doc/context/documents/general/manuals/epub-mkiv-demo.pdf b/doc/context/documents/general/manuals/epub-mkiv-demo.pdf
new file mode 100644
index 000000000..2382d188c
--- /dev/null
+++ b/doc/context/documents/general/manuals/epub-mkiv-demo.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/epub-mkiv.pdf b/doc/context/documents/general/manuals/epub-mkiv.pdf
new file mode 100644
index 000000000..44cafcd27
--- /dev/null
+++ b/doc/context/documents/general/manuals/epub-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/tiptrick.pdf b/doc/context/documents/general/manuals/tiptrick.pdf
index edfa6f0ad..5332e70ec 100644
--- a/doc/context/documents/general/manuals/tiptrick.pdf
+++ b/doc/context/documents/general/manuals/tiptrick.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/workflows-mkiv.pdf b/doc/context/documents/general/manuals/workflows-mkiv.pdf
index 7cdd669cc..828fb86cb 100644
--- a/doc/context/documents/general/manuals/workflows-mkiv.pdf
+++ b/doc/context/documents/general/manuals/workflows-mkiv.pdf
Binary files differ
diff --git a/doc/context/scripts/mkii/texmfstart.html b/doc/context/scripts/mkii/texmfstart.html
index 70de410df..ed149a0d0 100644
--- a/doc/context/scripts/mkii/texmfstart.html
+++ b/doc/context/scripts/mkii/texmfstart.html
@@ -40,6 +40,7 @@
<tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr>
<tr><th/><td/><td/></tr>
<tr><th>--script</th><td></td><td>run an mtx script (lua prefered method) (--noquotes), no script gives list</td></tr>
+ <tr><th>--evaluate</th><td></td><td>run code passed on the commandline (between quotes)</td></tr>
<tr><th>--execute</th><td></td><td>run a script or program (texmfstart method) (--noquotes)</td></tr>
<tr><th>--resolve</th><td></td><td>resolve prefixed arguments</td></tr>
<tr><th>--ctxlua</th><td></td><td>run internally (using preloaded libs)</td></tr>
diff --git a/doc/context/scripts/mkii/texmfstart.man b/doc/context/scripts/mkii/texmfstart.man
index 643d8b1c9..8a3a75b64 100644
--- a/doc/context/scripts/mkii/texmfstart.man
+++ b/doc/context/scripts/mkii/texmfstart.man
@@ -14,6 +14,9 @@
.B --script
run an mtx script (lua prefered method) (--noquotes), no script gives list
.TP
+.B --evaluate
+run code passed on the commandline (between quotes)
+.TP
.B --execute
run a script or program (texmfstart method) (--noquotes)
.TP
diff --git a/doc/context/scripts/mkii/texmfstart.xml b/doc/context/scripts/mkii/texmfstart.xml
index c19484d9d..c7e719541 100644
--- a/doc/context/scripts/mkii/texmfstart.xml
+++ b/doc/context/scripts/mkii/texmfstart.xml
@@ -8,6 +8,7 @@
<category name="basic">
<subcategory>
<flag name="script"><short>run an mtx script (lua prefered method) (<ref name="noquotes"/>), no script gives list</short></flag>
+ <flag name="evaluate"><short>run code passed on the commandline (between quotes)</short></flag>
<flag name="execute"><short>run a script or program (texmfstart method) (<ref name="noquotes"/>)</short></flag>
<flag name="resolve"><short>resolve prefixed arguments</short></flag>
<flag name="ctxlua"><short>run internally (using preloaded libs)</short></flag>
diff --git a/doc/context/scripts/mkiv/mtx-bibtex.html b/doc/context/scripts/mkiv/mtx-bibtex.html
deleted file mode 100644
index 61a679716..000000000
--- a/doc/context/scripts/mkiv/mtx-bibtex.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<!-- compare with lmx framework variant -->
-
-<!--
- filename : context-base.xml
- comment : companion to mtx-server-ctx-startup.tex
- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
- copyright: PRAGMA ADE / ConTeXt Development Team
- license : see context related readme files
--->
-
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <title>bibtex helpers</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <style type="text/css">
- body { color: #FFFFFF; background-color: #808080; font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans; font-size: 12px; line-height: 18px; } a:link, a:active, a:visited { color: #FFFFFF; } a.dir-view:link, a.dir-view:active, a.dir-view:visited { color: #FFFFFF; text-decoration: underline; } .valid { color: #00FF00; } .invalid { color: #FF0000; } button, .commonlink, .smallbutton { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; border-color: #7F7F7F; border-style: solid; border-width: .125ex; background-color: #FFFFFF; padding: .5ex; } .smallbutton { width: 1em; } a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; } h1, .title { font-style: normal; font-weight: normal; font-size: 18px; line-height: 18px; margin-bottom: 20px; } h2, .subtitle { font-style: normal; font-weight: normal; font-size: 12px; margin-top: 18px; margin-bottom: 18px; } table { line-height: 18px; font-size: 12px; margin: 0; } th { font-weight: bold; text-align: left; padding-bottom: 6px; } .tc { font-weight: bold; text-align: left; } p, li { max-width: 60em; } .empty-line { margin-top: 4px; } .more-room { margin-right: 1.5em; } .much-more-room { margin-right: 3em; } #main { position: absolute; left: 10%; top: 10%; right: 10%; bottom: 10%; z-index: 2; width: 80%; height: 80%; padding: 0%; margin: 0%; overflow: auto; border-style: none; border-width: 0; background-color: #3F3F3F; } #main-settings { margin: 12px; x_max-width: 60em; line-height: 18px; font-size: 12px; } #left { position: absolute; top : 10%; left: 0%; bottom: 0%; right: 90%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; } #right { position: absolute; top : 0%; left: 90%; bottom: 10%; right: 0%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; _margin-left: -15px; } #bottom { position: absolute; left: 10%; right: 0%; top: 90%; bottom: 0%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top { position: absolute; left: 0%; right: 10%; top: 0%; bottom: 90%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #top-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: right; vertical-align: middle; } #bottom-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #bottom-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: left; vertical-align: middle; } #left-one { position: absolute; width: 100%; buggedheight: 100%; } #left-two { position: relative; margin-top: 12px; line-height: 18px; text-align: center; vertical-align: top; } #right-one { display: table; height: 100%; width: 100%; } #right-two { display: table-row; height: 100%; width: 100%; } #right-three { display: table-cell; width: 100%; vertical-align: bottom; _position: absolute; _top: 100%; } #right-four { text-align: center; margin-bottom: 2ex; _position: relative; _top: -100%; } #more-top { position: absolute; top: 0%; left: 90%; bottom: 90%; right: 0%; z-index: 3; width: 10%; height: 10%; padding: 0%; margin: 0%; border-style: none; border-width: 0; } #more-top-settings { text-align: center; } #more-right-settings { margin-right: 12px; margin-left: 12px; line-height: 18px; font-size: 10px; text-align: center; } #right-safari { _display: table; width: 100%; height: 100%; }
- </style>
- <style type="text/css">
- </style>
- </head>
- <body>
- <div id="top"> <div id="top-one">
- <div id="top-two">bibtex helpers </div>
- </div>
- </div>
- <div id="bottom"> <div id="bottom-one">
- <div id="bottom-two">wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl</div>
- </div>
- </div>
- <div id="left"></div>
- <div id="right"></div>
- <div id="main">
- <div id='main-settings'>
- <h1>Command line options</h1>
-<table>
- <tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr>
- <tr><th/><td/><td/></tr>
- <tr><th>--toxml</th><td></td><td>convert bibtex database(s) to xml</td></tr>
- <tr><th>--tolua</th><td></td><td>convert bibtex database(s) to lua</td></tr>
- <tr><th>--search</th><td></td><td>seatch bibtex database(s)</td></tr>
- </table>
-<br/>
-<h1>Example</h1>
-<tt>mtxrun --script bibtex --tolua bibl-001.bib</tt>
-<br/><tt>mtxrun --script bibtex --tolua --simple bibl-001.bib</tt>
-<br/><tt>mtxrun --script bibtex --toxml bibl-001.bib bibl-002.bib bibl-003.bib biblio.xml</tt>
-<br/><tt>mtxrun --script bibtex --search --list --pattern=match(author:foo) bar.bib</tt>
-<br/><br/> </div>
- </div>
- </body>
- </html>
diff --git a/doc/context/scripts/mkiv/mtx-bibtex.man b/doc/context/scripts/mkiv/mtx-bibtex.man
deleted file mode 100644
index ddd3cfbc5..000000000
--- a/doc/context/scripts/mkiv/mtx-bibtex.man
+++ /dev/null
@@ -1,33 +0,0 @@
-.TH "mtx-bibtex" "1" "01-01-2015" "version 1.00" "bibtex helpers"
-.SH NAME
-.B mtx-bibtex
-.SH SYNOPSIS
-.B mtxrun --script bibtex [
-.I OPTIONS ...
-.B ] [
-.I FILENAMES
-.B ]
-.SH DESCRIPTION
-.B bibtex helpers
-.SH OPTIONS
-.TP
-.B --toxml
-convert bibtex database(s) to xml
-.TP
-.B --tolua
-convert bibtex database(s) to lua
-.TP
-.B --search
-seatch bibtex database(s)
-.SH AUTHOR
-More information about ConTeXt and the tools that come with it can be found at:
-
-
-.B "maillist:"
-ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
-
-.B "webpage:"
-http://www.pragma-ade.nl / http://tex.aanhet.net
-
-.B "wiki:"
-http://contextgarden.net
diff --git a/doc/context/scripts/mkiv/mtx-bibtex.xml b/doc/context/scripts/mkiv/mtx-bibtex.xml
deleted file mode 100644
index 5c28b946a..000000000
--- a/doc/context/scripts/mkiv/mtx-bibtex.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<application>
- <metadata>
- <entry name="name">mtx-bibtex</entry>
- <entry name="detail">bibtex helpers</entry>
- <entry name="version">1.00</entry>
- </metadata>
- <flags>
- <category name="basic">
- <subcategory>
- <flag name="toxml"><short>convert bibtex database(s) to xml</short></flag>
- <flag name="tolua"><short>convert bibtex database(s) to lua</short></flag>
- <flag name="search"><short>seatch bibtex database(s)</short></flag>
- </subcategory>
- </category>
- </flags>
- <examples>
- <category>
- <title>Example</title>
- <subcategory>
- <example><command>mtxrun --script bibtex --tolua bibl-001.bib</command></example>
- <example><command>mtxrun --script bibtex --tolua --simple bibl-001.bib</command></example>
- <example><command>mtxrun --script bibtex --toxml bibl-001.bib bibl-002.bib bibl-003.bib biblio.xml</command></example>
- <example><command>mtxrun --script bibtex --search --list --pattern=match(author:foo) bar.bib</command></example>
- </subcategory>
- </category>
- </examples>
-</application>
diff --git a/doc/context/scripts/mkiv/mtxrun.html b/doc/context/scripts/mkiv/mtxrun.html
index f1ec9a29d..6e4146899 100644
--- a/doc/context/scripts/mkiv/mtxrun.html
+++ b/doc/context/scripts/mkiv/mtxrun.html
@@ -40,6 +40,7 @@
<tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr>
<tr><th/><td/><td/></tr>
<tr><th>--script</th><td></td><td>run an mtx script (lua prefered method) (--noquotes), no script gives list</td></tr>
+ <tr><th>--evaluate</th><td></td><td>run code passed on the commandline (between quotes)</td></tr>
<tr><th>--execute</th><td></td><td>run a script or program (texmfstart method) (--noquotes)</td></tr>
<tr><th>--resolve</th><td></td><td>resolve prefixed arguments</td></tr>
<tr><th>--ctxlua</th><td></td><td>run internally (using preloaded libs)</td></tr>
diff --git a/doc/context/scripts/mkiv/mtxrun.man b/doc/context/scripts/mkiv/mtxrun.man
index 643d8b1c9..8a3a75b64 100644
--- a/doc/context/scripts/mkiv/mtxrun.man
+++ b/doc/context/scripts/mkiv/mtxrun.man
@@ -14,6 +14,9 @@
.B --script
run an mtx script (lua prefered method) (--noquotes), no script gives list
.TP
+.B --evaluate
+run code passed on the commandline (between quotes)
+.TP
.B --execute
run a script or program (texmfstart method) (--noquotes)
.TP
diff --git a/doc/context/scripts/mkiv/mtxrun.xml b/doc/context/scripts/mkiv/mtxrun.xml
index 01f2d1263..138afc96e 100644
--- a/doc/context/scripts/mkiv/mtxrun.xml
+++ b/doc/context/scripts/mkiv/mtxrun.xml
@@ -9,6 +9,7 @@
<category name="basic">
<subcategory>
<flag name="script"><short>run an mtx script (lua prefered method) (<ref name="noquotes"/>), no script gives list</short></flag>
+ <flag name="evaluate"><short>run code passed on the commandline (between quotes)</short></flag>
<flag name="execute"><short>run a script or program (texmfstart method) (<ref name="noquotes"/>)</short></flag>
<flag name="resolve"><short>resolve prefixed arguments</short></flag>
<flag name="ctxlua"><short>run internally (using preloaded libs)</short></flag>
diff --git a/doc/context/sources/general/manuals/epub/epub-mkiv-demo.tex b/doc/context/sources/general/manuals/epub/epub-mkiv-demo.tex
new file mode 100644
index 000000000..b4b979874
--- /dev/null
+++ b/doc/context/sources/general/manuals/epub/epub-mkiv-demo.tex
@@ -0,0 +1,43 @@
+
+% \usemodule[luacalls]
+
+\usemodule[mathml]
+
+\setupexternalfigures
+ [location=default]
+
+\setupbackend
+ [export=yes]
+
+\setupexport
+ [svgstyle=mathtest-style,
+ hyphen=yes,
+ width=60em]
+
+\setupbodyfont[pagella]
+
+\definefloat[graphic][graphics][figure]
+
+% \environment [mathtest-style]
+
+\starttext
+
+ \startsection[title=First]
+
+ \startitemize
+ \startitem one \stopitem
+ \startitem two \stopitem
+ \stopitemize
+
+ \startplacefigure[title=First]
+ \externalfigure[cow.pdf]
+ \stopplacefigure
+
+ \startplacegraphic[title=Second]
+ \externalfigure[cow.pdf]
+ \stopplacegraphic
+
+ some math: \m{e=mc^2}
+
+ \stopsection
+\stoptext
diff --git a/doc/context/sources/general/manuals/epub/epub-mkiv.tex b/doc/context/sources/general/manuals/epub/epub-mkiv.tex
new file mode 100644
index 000000000..cea7d592b
--- /dev/null
+++ b/doc/context/sources/general/manuals/epub/epub-mkiv.tex
@@ -0,0 +1,463 @@
+% language=uk
+
+% todo:
+%
+% metadata
+% properties
+% \dontleavehmode before hbox
+% cover page
+%
+% http://www.cnet.com/news/google-subtracts-mathml-from-chrome-and-anger-multiplies/
+
+% \usemodule[luacalls]
+
+\usemodule[art-01,abr-02]
+
+\definehighlight[notabene][style=bold]
+
+\definecolor[darkorange] [.70(green,red)]
+\definecolor[lightorange][.45(orange,white)]
+\definecolor[lesswhite] [.90(white)]
+
+\setuptyping[color=darkorange]
+\setuptype [color=darkorange]
+
+\starttext
+
+\startMPpage
+
+numeric w ; w := 21cm ;
+numeric h ; h := 29.7cm ;
+numeric ww ; ww := 9w/10 ;
+numeric oo ; oo := (w-ww) / 2 ;
+numeric hh ; hh := h/5.5 ;
+path p ; p := unitsquare xysized(w,h) ;
+
+color orange ; orange := \MPcolor{darkorange} ; % .7[green,red] ;
+
+fill p enlarged 2mm withcolor orange ;
+
+draw image (
+ draw anchored.top(
+ textext("\ttbf\setupinterlinespace[line=1.7ex]\framed[frame=off,align=middle,offset=0mm]{\smash{<div/>}\\\smash{<div >}\\\smash{</div>}}")
+ xsized w,
+ center topboundary p shifted (0,-12mm)) withcolor \MPcolor{lightorange} ; % 0.45[white,orange] ;
+ draw anchored.bot(
+ textext("\ssbf\setupinterlinespace[line=2.2ex]\framed[frame=off,align=middle]{exporting\\xml and epub\\from context}")
+ xsized w,
+ center bottomboundary p shifted (0,4mm)) withcolor \MPcolor {lesswhite} ; % 0.90white ;
+) ;
+
+setbounds currentpicture to p ;
+
+\stopMPpage
+
+\startsection[title=Introduction]
+
+There is a pretty long tradition of typesetting math with \TEX\ and it looks like
+this program will dominate for many more years. Even if we move to the web, the
+simple fact that support for \MATHML\ in some browsers is subtoptimal will drive
+those who want a quality document to use \PDF\ instead.
+
+I'm writing this in 2014, at a time that \XML\ is widespread. The idea of \XML\ is
+that you code your data in a very structured way, so that it can be manipulated and
+(if needed) validated. Text has always been a target for \XML\ which is a follow|-|up
+to \SGML\ that was in use by publishers. Because \HTML\ is less structured (and also
+quite tolerant with respect to end tags) we prefer to use \XHTML\ but unfortunately
+support for that is less widespread.
+
+Interesting is that documents are probably among the more complex targets of the
+\XML\ format. The reason is that unless the author restricts him|/|herself or
+gets restricted by the publisher, tag|-|abuse can happen. At \PRAGMA\ we mostly
+deal with education related \XML\ and it's not always easy to come up with
+something that suits the specific needs of the educational concept behind a
+school method. Even if we start out nice and clean, eventually we end up with a
+poluted source, often with additonal structure needed to satisfy the tools used
+for conversion.
+
+We have been supporting \XML\ from the day it showed up and most of our projects
+involve \XML\ in one way or the other. That doesn't mean that we don't use \TEX\
+for coding documents. This manual is for instance a regular \TEX\ document. In
+many ways a structured \TEX\ document is much more convenient to edit, especially
+if one wants to add a personal touch and do some local makeup. On the other hand,
+diverting from standard structure commands makes the document less suitable for
+other output than \PDF. There is simply no final solution for coding your document,
+it's mostly a matter of taste.
+
+So we have a dilemma: if we want to have multiple output, frozen \PDF\ as well as
+less controlled \HTML\ output, we can best code in \XML, but when we want to code
+comfortably we'd like to use \TEX. There are other ways, like markdown, that can
+be converted to intermediate formats like \TEX, but that is only suitable for
+simple documents: the more advanced documents get, the more one has to escape
+from the boundaries of (any) document encoding, and then often \TEX\ is not a bad
+choice. There is a good reason why \TEX\ survived for so long.
+
+It is for this reason that in \CONTEXT\ \MKIV\ we can export the content in a
+reasonable structured way to \XML. Of course we assume a structured document. It
+started out as an experiment because it was relatively easy to implement, and it
+is now an integral component.
+
+\stopsection
+
+\startsection[title=The output]
+
+The regular output is an \XML\ file but as we have some more related data it gets
+organized in a tree. We also export a few variants. An example is given below:
+
+\starttyping
+./test-export
+./test-export/images
+./test-export/images/...
+./test-export/styles
+./test-export/styles/test-defaults.css
+./test-export/styles/test-images.css
+./test-export/styles/test-styles.css
+./test-export/styles/test-templates.css
+./test-export/test-raw.xml
+./test-export/test-raw.lua
+./test-export/test-tag.xhtml
+./test-export/test-div.xhtml
+\stoptyping
+
+Say that we have this input:
+
+\starttyping
+\setupbackend
+ [export=yes]
+
+\starttext
+ \startsection[title=First]
+ \startitemize
+ \startitem one \stopitem
+ \startitem two \stopitem
+ \stopitemize
+ \stopsection
+\stoptext
+\stoptyping
+
+The main export ends up in the \type {test-raw.xml} export file and looks as
+follows (we leave out the preamble and style references):
+
+\starttyping
+<document> <!-- with some attributes -->
+ <section detail="section" chain="section" level="3">
+ <sectionnumber>1</sectionnumber>
+ <sectiontitle>First</sectiontitle>
+ <sectioncontent>
+ <itemgroup detail="itemize" chain="itemize" symbol="1" level="1">
+ <item>
+ <itemtag><m:math ..><m:mo>•</m:mo></m:math></itemtag>
+ <itemcontent>one</itemcontent>
+ </item>
+ <item>
+ <itemtag><m:math ..><m:mo>•</m:mo></m:math></itemtag>
+ <itemcontent>two</itemcontent>
+ </item>
+ </itemgroup>
+ </sectioncontent>
+ </section>
+</document>
+\stoptyping
+
+This file refers to the stylesheets and therefore renders quite okay in a browser
+like FireFox that can handle \XHTML\ with arbitrary tags.
+
+The \type {detail} attribute tells us what instance of the element is used.
+Normally the \type {chain} attribute is the same but it can have more values.
+For instance, if we have:
+
+\starttyping
+\definefloat[graphic][graphics][figure]
+
+.....
+
+\startplacefigure[title=First]
+ \externalfigure[cow.pdf]
+\stopplacefigure
+
+.....
+
+\startplacegraphic[title=Second]
+ \externalfigure[cow.pdf]
+\stopplacegraphic
+\stoptyping
+
+we get this:
+
+\starttyping
+<float detail="figure" chain="figure">
+ <floatcontent>...</floatcontent>
+ <floatcaption>...</floatcaption>
+</float>
+<float detail="graphic" chain="figure graphic">
+ <floatcontent>...</floatcontent>
+ <floatcaption>...</floatcaption>
+</float>
+\stoptyping
+
+This makes it possible to style specific categories of floats by using a
+(combination of) \type {detail} and|/|or \type {chain} as filter.
+
+The body of the \type {test-tag.xhtml} file looks similar but it is slightly more
+tuned for viewing. For instance hyperlinks are converted to a way that \CSS\ and
+browsers like more. Keep in mind that the raw file can be the base for conversion
+to other formats, so that one stays closest to the original structure.
+
+The \type {test-div.xhtml} file is even more tuned for viewing in browsers as it
+completely does away with specific tags. We explicitly don't map onto native
+\HTML\ elements because that would make all look messy and horrible, if only
+because there seldom is a relation between those elements and the original. One
+can always transform one of the export formats to pure \HTML\ tags if needed.
+
+\starttyping
+<body>
+ <div class="document">
+ <div class="section" id="aut-1">
+ <div class="sectionnumber">1</div>
+ <div class="sectiontitle">First</div>
+ <div class="sectioncontent">
+ <div class="itemgroup itemize symbol-1">
+ <div class="item">
+ <div class="itemtag"><m:math ...><m:mo>•</m:mo></m:math></div>
+ <div class="itemcontent">one</div>
+ </div>
+ <div class="item">
+ <div class="itemtag"><m:math ...><m:mo>•</m:mo></m:math></div>
+ <div class="itemcontent">two</div>
+ </div>
+ </div>
+ <div class="float figure">
+ <div class="floatcontent">...</div></div>
+ <div class="floatcaption">...></div>
+ </div>
+ <div class="float figure graphic">
+ <div class="floatcontent">...</div></div>
+ <div class="floatcaption">...></div>
+ </div>
+ </div>
+ </div>
+</body>
+\stoptyping
+
+The also default \CSS\ file can deal with tags as well as classes. The additional
+styles file contains definitions of so called highlights. In the \CONTEXT\ source
+one can better use explicit named highlights instead of local font and color
+switches because these properties are then exported to the \CSS. The images style
+defines all used images. The templates file lists all the used elements and can
+be used as a starting point for additional \CSS\ styling.
+
+Keep in mind that the export is \notabene{not} meant as a one|-|to|-|one visual
+representation. It represents structure so that it can be converted to whatever
+you like.
+
+In order to get an export you must start your document with:
+
+\starttyping
+\setupbackend
+ [export=yes]
+\stoptyping
+
+So, we trigger a specific (extra) backend. In addition you can set up the export:
+
+\starttyping
+\setupexport
+ [svgstyle=test-basic-style.tex,
+ cssfile=test-extras.css,
+ hyphen=yes,
+ width=60em]
+\stoptyping
+
+The \type {hyphen} option will also export hyphenation information so that the
+text can be nicely justified. The \type {svgstyle} option can be used to specify
+a file where math is setup, normally this would only contain a bodyfont setup
+and this option is only needed if you want to create an \EPUB\ file afterwards that
+has math represented as \SVG.
+
+The value of \type {cssfile} ends up as style reference in the exported files.
+You can also pass a comma separates list of names (between curly braces). These
+entries come after those of the automatically generated \CSS\ files so you need
+to be aware of default properties.
+
+\stopsection
+
+\startsection[title=Images]
+
+Inclusion of images is done in an indirect way. Each image gets an entry in a
+special image related stylesheet and then gets referred to by \type {id}. Some
+extra information is written to a status file so that the script that creates
+\EPUB\ files can deal with the right conversion, for instance from \PDF\ to \SVG.
+Because we can refer to specific pages in a \PDF\ file, this subsystem deals with
+that too. Images are expected in an \type {images} subpath and because in \CSS\
+the references are relative to the path where the stylesheet resides, we use
+\type {../images} instead. If you do some postprocessing on the files or relocate
+them you need to keep in mind that you might have to change these paths in the
+image related \CSS\ file.
+
+\stopsection
+
+\startsection[title=Epub files]
+
+At the end of a run with exporting enabled you will get a message to the console that
+tells you how to generate an \EPUB\ file. For instance:
+
+\starttyping
+mtxrun --script epub --make --purge test
+\stoptyping
+
+This will create a tree with the following organization:
+
+\starttyping
+./test-epub
+./test-epub/META-INF
+./test-epub/META-INF/container.xml
+./test-epub/OEBPS
+./test-epub/OEBPS/content.opf
+./test-epub/OEBPS/toc.ncx
+./test-epub/OEBPS/nav.xhtml
+./test-epub/OEBPS/cover.xhtml
+./test-epub/OEBPS/test-div.xhtml
+./test-epub/OEBPS/images
+./test-epub/OEBPS/images/...
+./test-epub/styles
+./test-epub/styles/test-defaults.css
+./test-epub/styles/test-images.css
+./test-epub/styles/test-styles.css
+./test-epub/mimetype
+\stoptyping
+
+Images will be moved to this tree as well and if needed they will be converted
+into for instance \SVG. Converted \PDF\ files can have a \typ {page-<number>} in
+their name when a specific page has been used.
+
+You can pass the option \type {--svgmath} in which case math will be converted to
+\SVG. The main reason for this feature is that we found out that \MATHML\ support
+in browsers will not be as widespread as expected. The best bet is FireFox which
+natively supports it. The Chrome browser had it for a while but it got dropped
+and math is now delegated to \JAVASCRIPT\ and friends. In Internet Explorer
+\MATHML\ should work (but I need to test that again). This conversion mechanism is
+kind of interesting: one enters \TEX\ math, then gets \MATHML\ in the export, and
+that gets rendered by \TEX\ again, but now as standalone snippet that then gets
+converted to \SVG\ and embedded in the result.
+
+\stopsection
+
+\startsection[title=Styles]
+
+One can argue that we should use native \HTML\ elements but we don't have a nice
+guaranteed consistent mapping onto that so it makes no sense to do so. Instead we
+rely on either explicit tags with details and chains or divisions with classes
+that combine the tag, detail and chain. The tagged variant has some more
+attributes and those that use a fixed set of values become classes in the
+division variant. Also, once we start going the (for instance) \type {H1}, \type
+{H2}, etc.\ route we're lost when we have more levels than that or use a
+different structure. If an \type {H3} can reflect several levels it makes no
+sense to use it. The same is true for other tags: if a list is not really a list
+than tagging it with \type {LI} is counterproductive. We're often dealing with
+very complex documents so basic \HTML\ tagging is rather meaningless then.
+
+If you look at the division variant (the one used for \EPUB\ too) you will notice
+that there are no empty elements but \type {div} ones with a comment as content.
+This is needed because otherwise they get ignored which for instance makes table
+cells invisible.
+
+The relation between \type {detail} and \type {chain} (reflected in \type {class})
+can best be seen from the next example.
+
+\starttyping
+\definefloat[myfloata]
+\definefloat[myfloatb][myfloatbs][figure]
+\definefloat[myfloatc][myfloatcs][myfloatb]
+\stoptyping
+
+This creates two new float instances. The first inherits from the main float
+settings, but can have its own properties. The second example inherits from
+the \type {figure} so in fact it is part of a chain. The third one has a longer
+chain.
+
+\starttyping
+<float detail="myfloata">...</float>
+<float detail="myfloatb" chain="figure">...</float>
+<float detail="myfloatc" chain="figure myfloatb">...</float>
+\stoptyping
+
+In a \CSS\ style you can now configure tags, details, and chains as well as
+classes (we only show a few possibilities):
+
+\starttyping
+div.float.myfloata { } float[detail='myfloata'] { }
+div.float.myfloatb { } float[detail='myfloatb'] { }
+div.float.figure { } float[detail='figure'] { }
+div.float.figure.myfloatb { } float[chain~='figure'][detail='myfloata'] { }
+div.myfloata { } *[detail='myfloata'] { }
+div.myfloatb { } *[detail='myfloatb'] { }
+div.figure { } *[chain~='figure'] { }
+div.figure.myfloatb { } *[chain~='figure'][detail='myfloatb'] { }
+\stoptyping
+
+The default styles cover some basics but if you're serious about the export
+or want to use the \EPUB\ then it makes sense to overload some of it and|/|or
+provide additional styling. You can find enough about \CSS\ and it's options
+on the internet.
+
+\stopsection
+
+\startsection[title=Coding]
+
+The default output reflects the structure present in the document. If this is not
+enough you can add your own structure.
+
+\starttyping
+\startelement[question]
+Is this right?
+\stopelement
+\stoptyping
+
+You can also pass attributes:
+
+\starttyping
+\startelement[question][level=difficult]
+Is this right?
+\stopelement
+\stoptyping
+
+But these will only be exported when you also say:
+
+\starttyping
+\setupexport
+ [properties=yes]
+\stoptyping
+
+You can create a namespace. The following will generate attributes
+like \type {my-level}.
+
+\starttyping
+\setupexport
+ [properties=my-]
+\stoptyping
+
+In most cases it makes more sense to use highlights:
+
+\starttyping
+\definehighlight
+ [important]
+ [style=bold]
+\stoptyping
+
+This has the advantage that the style and color are exported to a special
+\CSS\ file.
+
+Headers and footers and other content that is part of the page builder is not
+exported. If your document has coverpages you might want to hide them too. The
+same is true when you create special chapter title rendering that have as side
+effect that content ends up in the page stream. If something shows up that you
+want to, you can wrap it in an \type {ignore} element:
+
+\starttyping
+\startelement[ignore]
+Don't export this.
+\stopelement
+\stoptyping
+
+\stopsection
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/workflows/workflows-graphics.tex b/doc/context/sources/general/manuals/workflows/workflows-graphics.tex
index 25eed7bee..dc3c6e106 100644
--- a/doc/context/sources/general/manuals/workflows/workflows-graphics.tex
+++ b/doc/context/sources/general/manuals/workflows/workflows-graphics.tex
@@ -129,6 +129,28 @@ the tables passed as third argument.
\stopsection
+\startsection[title=Trackers]
+
+If you want a lot of info you can say:
+
+\starttyping
+\enabletrackers[figures.*]
+\stoptyping
+
+But you can be more specific. With \type {graphics.locating} you will get some
+insight in where files are looked for. The \type {graphics.inclusion} tracker
+gives some more info about actual inclusion. The \type {graphics.bases} is kind
+of special and only makes sense when you use the graphic database options. The
+\type {graphics.conversion} and related tracker \type {graphics.programs} show if
+and how conversion of images takes place.
+
+The \type {graphics.lognames} will make sure that some extra information about
+used graphics is saved in the log file, while \type {graphics.usage} will produce
+a file \typ {<jobname>-figures-usage.lua} that contains information about found
+(or not found) images and the way they are used.
+
+\stopsection
+
\stopchapter
\stopcomponent
diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv
index 7ca40bbea..b861d3f12 100644
--- a/metapost/context/base/mp-chem.mpiv
+++ b/metapost/context/base/mp-chem.mpiv
@@ -132,6 +132,8 @@ vardef chem_init_some (suffix $) (expr e) =
fi
if not chem_star[$] :
scaled (.5/(sind .5chem_num1))
+ % carbon-carbon benzene bond length
+ scaled (1.4/1.54)
fi ;
fi ;
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index c9096d81e..f7af42969 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -444,7 +444,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 34559, stripped down to: 18815
+-- original size: 38619, stripped down to: 19653
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -1009,24 +1009,48 @@ function lpeg.append(list,pp,delayed,checked)
end
return p
end
+local p_false=P(false)
+local p_true=P(true)
local function make(t,hash)
- local p=P(false)
+ local p=p_false
local keys=sortedkeys(t)
+ local function making(t,w)
+ local p=p_false
+ local keys=sortedkeys(t)
+ for i=1,#keys do
+ local k=keys[i]
+ local v=t[k]
+ if w then
+ if v==true then
+ p=p+P(k)*p_true
+ else
+ p=p+P(k)*(making(v,w)+p_true)
+ end
+ else
+ if v==true then
+ p=p+P(k)
+ else
+ p=p+P(k)*making(v,w)
+ end
+ end
+ end
+ return p
+ end
for i=1,#keys do
local k=keys[i]
local v=t[k]
local h=hash[v]
if h then
- if next(v) then
- p=p+P(k)*(make(v,hash)+P(true))
+ if v==true then
+ p=p+P(k)*p_true
else
- p=p+P(k)*P(true)
+ p=p+P(k)*(making(v,true)+p_true)
end
else
- if next(v) then
- p=p+P(k)*make(v,hash)
- else
+ if v==true then
p=p+P(k)
+ else
+ p=p+P(k)*making(v,false)
end
end
end
@@ -1034,34 +1058,55 @@ local function make(t,hash)
end
function lpeg.utfchartabletopattern(list)
local tree={}
- local hash={}
+ local hash
local n=#list
if n==0 then
+ hash=list
for s in next,list do
local t=tree
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=tc
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
end
else
+ hash={}
for i=1,n do
local t=tree
local s=list[i]
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=true
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
+ hash[s]=true
end
end
return make(tree,hash)
@@ -17774,8 +17819,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 745333
--- stripped bytes : 272372
+-- original bytes : 749393
+-- stripped bytes : 275594
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index c9096d81e..f7af42969 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -444,7 +444,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 34559, stripped down to: 18815
+-- original size: 38619, stripped down to: 19653
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -1009,24 +1009,48 @@ function lpeg.append(list,pp,delayed,checked)
end
return p
end
+local p_false=P(false)
+local p_true=P(true)
local function make(t,hash)
- local p=P(false)
+ local p=p_false
local keys=sortedkeys(t)
+ local function making(t,w)
+ local p=p_false
+ local keys=sortedkeys(t)
+ for i=1,#keys do
+ local k=keys[i]
+ local v=t[k]
+ if w then
+ if v==true then
+ p=p+P(k)*p_true
+ else
+ p=p+P(k)*(making(v,w)+p_true)
+ end
+ else
+ if v==true then
+ p=p+P(k)
+ else
+ p=p+P(k)*making(v,w)
+ end
+ end
+ end
+ return p
+ end
for i=1,#keys do
local k=keys[i]
local v=t[k]
local h=hash[v]
if h then
- if next(v) then
- p=p+P(k)*(make(v,hash)+P(true))
+ if v==true then
+ p=p+P(k)*p_true
else
- p=p+P(k)*P(true)
+ p=p+P(k)*(making(v,true)+p_true)
end
else
- if next(v) then
- p=p+P(k)*make(v,hash)
- else
+ if v==true then
p=p+P(k)
+ else
+ p=p+P(k)*making(v,false)
end
end
end
@@ -1034,34 +1058,55 @@ local function make(t,hash)
end
function lpeg.utfchartabletopattern(list)
local tree={}
- local hash={}
+ local hash
local n=#list
if n==0 then
+ hash=list
for s in next,list do
local t=tree
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=tc
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
end
else
+ hash={}
for i=1,n do
local t=tree
local s=list[i]
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=true
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
+ hash[s]=true
end
end
return make(tree,hash)
@@ -17774,8 +17819,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 745333
--- stripped bytes : 272372
+-- original bytes : 749393
+-- stripped bytes : 275594
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index c9096d81e..f7af42969 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -444,7 +444,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 34559, stripped down to: 18815
+-- original size: 38619, stripped down to: 19653
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -1009,24 +1009,48 @@ function lpeg.append(list,pp,delayed,checked)
end
return p
end
+local p_false=P(false)
+local p_true=P(true)
local function make(t,hash)
- local p=P(false)
+ local p=p_false
local keys=sortedkeys(t)
+ local function making(t,w)
+ local p=p_false
+ local keys=sortedkeys(t)
+ for i=1,#keys do
+ local k=keys[i]
+ local v=t[k]
+ if w then
+ if v==true then
+ p=p+P(k)*p_true
+ else
+ p=p+P(k)*(making(v,w)+p_true)
+ end
+ else
+ if v==true then
+ p=p+P(k)
+ else
+ p=p+P(k)*making(v,w)
+ end
+ end
+ end
+ return p
+ end
for i=1,#keys do
local k=keys[i]
local v=t[k]
local h=hash[v]
if h then
- if next(v) then
- p=p+P(k)*(make(v,hash)+P(true))
+ if v==true then
+ p=p+P(k)*p_true
else
- p=p+P(k)*P(true)
+ p=p+P(k)*(making(v,true)+p_true)
end
else
- if next(v) then
- p=p+P(k)*make(v,hash)
- else
+ if v==true then
p=p+P(k)
+ else
+ p=p+P(k)*making(v,false)
end
end
end
@@ -1034,34 +1058,55 @@ local function make(t,hash)
end
function lpeg.utfchartabletopattern(list)
local tree={}
- local hash={}
+ local hash
local n=#list
if n==0 then
+ hash=list
for s in next,list do
local t=tree
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=tc
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
end
else
+ hash={}
for i=1,n do
local t=tree
local s=list[i]
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=true
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
+ hash[s]=true
end
end
return make(tree,hash)
@@ -17774,8 +17819,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 745333
--- stripped bytes : 272372
+-- original bytes : 749393
+-- stripped bytes : 275594
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index c9096d81e..f7af42969 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -444,7 +444,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 34559, stripped down to: 18815
+-- original size: 38619, stripped down to: 19653
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -1009,24 +1009,48 @@ function lpeg.append(list,pp,delayed,checked)
end
return p
end
+local p_false=P(false)
+local p_true=P(true)
local function make(t,hash)
- local p=P(false)
+ local p=p_false
local keys=sortedkeys(t)
+ local function making(t,w)
+ local p=p_false
+ local keys=sortedkeys(t)
+ for i=1,#keys do
+ local k=keys[i]
+ local v=t[k]
+ if w then
+ if v==true then
+ p=p+P(k)*p_true
+ else
+ p=p+P(k)*(making(v,w)+p_true)
+ end
+ else
+ if v==true then
+ p=p+P(k)
+ else
+ p=p+P(k)*making(v,w)
+ end
+ end
+ end
+ return p
+ end
for i=1,#keys do
local k=keys[i]
local v=t[k]
local h=hash[v]
if h then
- if next(v) then
- p=p+P(k)*(make(v,hash)+P(true))
+ if v==true then
+ p=p+P(k)*p_true
else
- p=p+P(k)*P(true)
+ p=p+P(k)*(making(v,true)+p_true)
end
else
- if next(v) then
- p=p+P(k)*make(v,hash)
- else
+ if v==true then
p=p+P(k)
+ else
+ p=p+P(k)*making(v,false)
end
end
end
@@ -1034,34 +1058,55 @@ local function make(t,hash)
end
function lpeg.utfchartabletopattern(list)
local tree={}
- local hash={}
+ local hash
local n=#list
if n==0 then
+ hash=list
for s in next,list do
local t=tree
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=tc
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
end
else
+ hash={}
for i=1,n do
local t=tree
local s=list[i]
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=true
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
+ hash[s]=true
end
end
return make(tree,hash)
@@ -17774,8 +17819,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 745333
--- stripped bytes : 272372
+-- original bytes : 749393
+-- stripped bytes : 275594
-- end library merge
diff --git a/tex/context/base/anch-bck.mkvi b/tex/context/base/anch-bck.mkvi
index 273cf0159..cccf14ee4 100644
--- a/tex/context/base/anch-bck.mkvi
+++ b/tex/context/base/anch-bck.mkvi
@@ -20,6 +20,10 @@
\unprotect
+% we can flush 5 in one call (saved 4 lua calls) .. brrr wself .. will change
+
+\def\MPposset#1{\ctxcommand{MPposset("#1")}} % will go
+
% This might be overloaded later on:
% \defineoverlay[\v!text-2][\positionoverlay{\v!text-2}]
@@ -46,7 +50,7 @@
% tricky: we need to catch newly set! otherwise an old run can have positions
\unexpanded\def\anch_backgrounds_text_initialize
- {\doifelsepositionsused\enableparpositions\donothing
+ {\ctxcommand{doifelsepositionsused()}\enableparpositions\donothing
\global\let\anch_backgrounds_text_initialize\relax}
\appendtoks
diff --git a/tex/context/base/anch-pgr.lua b/tex/context/base/anch-pgr.lua
index 198e8a499..84d0f6939 100644
--- a/tex/context/base/anch-pgr.lua
+++ b/tex/context/base/anch-pgr.lua
@@ -19,9 +19,6 @@ local lpegmatch = lpeg.match
local jobpositions = job.positions
local formatters = string.formatters
-local scanstring = tokens.scanstring
-local scannumber = tokens.scannumber
-local scandimen = tokens.scandimen
local report_graphics = logs.reporter("graphics")
diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua
index fc7e24b96..1f366121d 100644
--- a/tex/context/base/anch-pos.lua
+++ b/tex/context/base/anch-pos.lua
@@ -21,8 +21,6 @@ more efficient.</p>
-- maybe replace texsp by our own converter (stay at the lua end)
-- eventually mp will have large numbers so we can use sp there too
-local commands, context = commands, context
-
local tostring, next, rawget, setmetatable = tostring, next, rawget, setmetatable
local sort = table.sort
local format, gmatch, match = string.format, string.gmatch, string.match
@@ -30,12 +28,16 @@ local rawget = rawget
local lpegmatch = lpeg.match
local insert, remove = table.insert, table.remove
local allocate, mark = utilities.storage.allocate, utilities.storage.mark
-local texsp = tex.sp
------ texsp = string.todimen -- because we cache this is much faster but no rounding
+local commands = commands
+local context = context
+
+local tex = tex
local texgetcount = tex.getcount
local texsetcount = tex.setcount
local texget = tex.get
+local texsp = tex.sp
+----- texsp = string.todimen -- because we cache this is much faster but no rounding
local pdf = pdf -- h and v are variables
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua
index d4c252384..70ed78282 100644
--- a/tex/context/base/back-exp.lua
+++ b/tex/context/base/back-exp.lua
@@ -143,6 +143,9 @@ local locatedtag = structurestags.locatedtag
local starttiming = statistics.starttiming
local stoptiming = statistics.stoptiming
+local characterdata = characters.data
+local overloads = fonts.mappings.overloads
+
-- todo: more locals (and optimize)
local exportversion = "0.33"
@@ -2442,11 +2445,11 @@ local function collectresults(head,list,pat,pap) -- is last used (we also have c
-- report_export("skipping character: %C (no attribute)",n.char)
else
-- we could add tonunicodes for ligatures (todo)
- local components = getfield(n,"components")
- if components then -- we loose data
+ local components = getfield(n,"components")
+ local c = getchar(n)
+ if components and (not characterdata[c] or overloads[c]) then -- we loose data
collectresults(components,nil,at) -- this assumes that components have the same attribute as the glyph ... we should be more tolerant (see math)
else
- local c = getchar(n)
if last ~= at then
local tl = taglist[at]
pushcontent()
diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua
index f7f995f39..2d6370811 100644
--- a/tex/context/base/back-pdf.lua
+++ b/tex/context/base/back-pdf.lua
@@ -6,8 +6,13 @@ if not modules then modules = { } end modules ['back-pdf'] = {
license = "see context related readme files"
}
+
+local tonumber = tonumber
+local sind, cosd = math.sind, math.cosd
+local insert, remove = table.insert, table.remove
local codeinjections = backends.pdf.codeinjections
+local context = context
local outputfilename
function codeinjections.getoutputfilename()
@@ -19,11 +24,6 @@ end
backends.install("pdf")
-local context = context
-
-local sind, cosd = math.sind, math.cosd
-local insert, remove = table.insert, table.remove
-
local f_matrix = string.formatters["%F %F %F %F"] -- 0.8 is default
function commands.pdfrotation(a)
diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv
index 1e5a9e690..9e0244eca 100644
--- a/tex/context/base/buff-ver.mkiv
+++ b/tex/context/base/buff-ver.mkiv
@@ -75,7 +75,12 @@
\def\buff_verbatim_initialize_type_one
{\let\obeylines\ignorelines
- \usetypestyleandcolor\c!style\c!color
+ \edef\p_buff_option{\typeparameter\c!option}%
+ \ifx\p_buff_option\v!none
+ \usetypestyleandcolor\c!style\c!color
+ \else\ifx\p_buff_option\empty
+ \usetypestyleandcolor\c!style\c!color
+ \fi\fi
\setcatcodetable\vrbcatcodes}
\def\buff_verbatim_initialize_type_two
@@ -114,7 +119,12 @@
\ifx\buff_verbatim_set_line_margin\relax
\doadaptleftskip{\typingparameter\c!margin}%
\fi
- \usetypingstyleandcolor\c!style\c!color
+ \edef\p_buff_option{\typingparameter\c!option}%
+ \ifx\p_buff_option\v!none
+ \usetypingstyleandcolor\c!style\c!color
+ \else\ifx\p_buff_option\empty
+ \usetypingstyleandcolor\c!style\c!color
+ \fi\fi
% will become: \usealignparameter\typingparameter
\doifsomething{\typingparameter\c!align}{\setupalign[\typingparameter\c!align]}} % use fast one
@@ -330,7 +340,7 @@
\ctxcommand{typestring{
data = \!!bs\detokenize{#1}\!!es,
tab = "\typeparameter\c!tab",
- method = "\typeparameter\c!option",
+ method = "\p_buff_option",
nature = "inline",
compact = "\typeparameter\c!compact", % none | all | last (all needed in tabulate etc for manuals)
escape = \!!bs\typeparameter\c!escape\!!es, % new but rather useless imo (escaping in general is not used much)
@@ -346,7 +356,7 @@
data = \!!bs\detokenize{#1}\!!es,
tab = "\typeparameter\c!tab",
method = "nested", % we force a special visualizer
- option = "\typeparameter\c!option", % extra visualizer (maybe: nested,\typeparameter\c!option)
+ option = "\p_buff_option", % extra visualizer (maybe: nested,\typeparameter\c!option)
nature = "inline",
}}%
\dostoptagged
@@ -515,7 +525,7 @@
strip = "\typingparameter\c!strip",
range = "\typingparameter\c!range",
tab = "\typingparameter\c!tab",
- method = "\typingparameter\c!option",
+ method = "\p_buff_option",
escape = \!!bs\typingparameter\c!escape\!!es,
nature = "display",
}}%
@@ -635,7 +645,7 @@
range = "\typingparameter\c!range",
regime = "\currentregime",
tab = "\typingparameter\c!tab",
- method = "\typingparameter\c!option",
+ method = "\p_buff_option",
nature = "display",
}}%
\dostoptagged
@@ -808,7 +818,7 @@
range = "\typingparameter\c!range",
regime = "\currentregime",
tab = "\typingparameter\c!tab",
- method = "\typingparameter\c!option",
+ method = "\p_buff_option",
escape = \!!bs\typingparameter\c!escape\!!es,
nature = "display",
}}%
@@ -850,7 +860,7 @@
name = "#2",
strip = "\typingparameter\c!strip",
tab = "\typingparameter\c!tab",
- method = "\typingparameter\c!option",
+ method = "\p_buff_option",
nature = "direct",
}}}
diff --git a/tex/context/base/catc-ini.mkiv b/tex/context/base/catc-ini.mkiv
index 26cef30de..bb1e47faa 100644
--- a/tex/context/base/catc-ini.mkiv
+++ b/tex/context/base/catc-ini.mkiv
@@ -88,16 +88,25 @@
\xdef\outputnewlinechar{^^J}%
\endgroup}
-%D We predefine some prefixes ahead of syst-aux and mult-sys. We reserve 8 slots
-%D for catcodes.
+%D We predefine some prefixes ahead of syst-aux and mult-sys.
-\def\??catcodelet {1>>} % let : \let
-\def\??catcodedef {2>>} % def : \def
-\def\??catcodeued {3>>} % ued : \unexpanded\def
-\def\??catcodeget {4>>} % \meaning
+% We reserve 8 slots for catcodes.
+%
+% \def\??catcodelet {1>>} % let : \let
+% \def\??catcodedef {2>>} % def : \def
+% \def\??catcodeued {3>>} % ued : \unexpanded\def
+% \def\??catcodeget {4>>} % \meaning
+%
+% \def\??catcodetablet{5>>}
+% \def\??catcodetablen{6>>}
+
+\installsystemnamespace {catcodelet} % let : \let
+\installsystemnamespace {catcodedef} % def : \def
+\installsystemnamespace {catcodeued} % ued : \unexpanded\def
+\installsystemnamespace {catcodeget} % \meaning
-\def\??catcodetablet{5>>}
-\def\??catcodetablen{6>>}
+\installsystemnamespace {catcodetablet}
+\installsystemnamespace {catcodetablen}
\newcount\c_syst_catcodes_n \c_syst_catcodes_n\zerocount % 0 = signal, so advance before allocate
\newcount\c_syst_catcodes_a
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua
index 0f632935d..b50847d8e 100644
--- a/tex/context/base/char-ini.lua
+++ b/tex/context/base/char-ini.lua
@@ -891,7 +891,6 @@ lpegpatterns.toshape = toshape -- old ones ... will be overloaded
-- function characters.upper (str) return lpegmatch(toupper,str) end
-- function characters.shaped(str) return lpegmatch(toshape,str) end
-
-- local superscripts = allocate() characters.superscripts = superscripts
-- local subscripts = allocate() characters.subscripts = subscripts
@@ -987,9 +986,9 @@ if not characters.lhash then
end
-local lhash = characters.lhash
-local uhash = characters.uhash
-local shash = characters.shash
+local lhash = characters.lhash mark(lhash)
+local uhash = characters.uhash mark(uhash)
+local shash = characters.shash mark(shash)
local utf8lowercharacter = utfchartabletopattern(lhash) / lhash
local utf8uppercharacter = utfchartabletopattern(uhash) / uhash
diff --git a/tex/context/base/char-ini.mkiv b/tex/context/base/char-ini.mkiv
index e130e200f..09e25f7fb 100644
--- a/tex/context/base/char-ini.mkiv
+++ b/tex/context/base/char-ini.mkiv
@@ -64,28 +64,23 @@
% \def\setcclcuc#1#2#3{\global\catcode#1=\lettercatcode\global\lccode#1=#2\global\uccode#1=#3\relax}
% \def\setcclcucself#1{\global\catcode#1=\lettercatcode\global\lccode#1=#1\global\uccode#1=#1\relax }
-\ctxcommand{setcharactercodes()}
-
% Is setting up vrb tpa and tpb needed?
-\ctxcommand{definecatcodetable(
- { % letter catcodes
- \number\texcatcodes,
- \number\ctxcatcodes,
- \number\notcatcodes,
- %number\mthcatcodes,
- \number\vrbcatcodes,
- \number\prtcatcodes,
- \number\tpacatcodes,
- \number\tpbcatcodes,
- \number\txtcatcodes,
- },
- { % activate catcodes
- \number\ctxcatcodes,
- \number\notcatcodes,
- \number\prtcatcodes, % new
- }
-)}
+% move to lua side
+
+\ctxcommand{setlettercatcodes(\number\texcatcodes)}
+\ctxcommand{setlettercatcodes(\number\ctxcatcodes)}
+\ctxcommand{setlettercatcodes(\number\notcatcodes)}
+%ctxcommand{setlettercatcodes(\number\mthcatcodes)}
+\ctxcommand{setlettercatcodes(\number\vrbcatcodes)}
+\ctxcommand{setlettercatcodes(\number\prtcatcodes)}
+\ctxcommand{setlettercatcodes(\number\tpacatcodes)}
+\ctxcommand{setlettercatcodes(\number\tpbcatcodes)}
+\ctxcommand{setlettercatcodes(\number\txtcatcodes)}
+
+\ctxcommand{setactivecatcodes(\number\ctxcatcodes)}
+\ctxcommand{setactivecatcodes(\number\notcatcodes)}
+\ctxcommand{setactivecatcodes(\number\prtcatcodes)}
\def\chardescription#1%
{\ctxcommand{chardescription(\number#1)}}
diff --git a/tex/context/base/char-tex.lua b/tex/context/base/char-tex.lua
index e03307cc3..e1caa64b9 100644
--- a/tex/context/base/char-tex.lua
+++ b/tex/context/base/char-tex.lua
@@ -412,6 +412,11 @@ function texcharacters.safechar(n) -- was characters.safechar
end
end
+if not context or not commands then
+ -- used in e.g. mtx-bibtex
+ return
+end
+
function texcharacters.defineaccents()
for accent, group in next, accentmapping do
context.dodefineaccentcommand(accent)
@@ -421,11 +426,6 @@ function texcharacters.defineaccents()
end
end
-if not context or not commands then
- -- used in e.g. mtx-bibtex
- return
-end
-
-- all kind of initializations
local tex = tex
@@ -476,99 +476,119 @@ local forbidden = tohash { -- at least now
-- 0xFEFF,
}
-function characters.define(tobelettered, tobeactivated) -- catcodetables
+local csletters = characters.csletters -- also a signal that we have initialized
+local activated = { }
- if trace_defining then
- report_defining("defining active character commands")
- end
+if not csletters then
+
+ csletters = allocate()
+ characters.csletters = csletters
- local activated, a = { }, 0
+ report_defining("setting up character related commands")
- for u, chr in next, data do -- these will be commands
+ for u, chr in next, data do -- will move up
local fallback = chr.fallback
if fallback then
contextsprint("{\\catcode",u,"=13\\unexpanded\\gdef ",utfchar(u),"{\\checkedchar{",u,"}{",fallback,"}}}")
- a = a + 1
- activated[a] = u
+ activated[#activated+1] = u
else
local contextname = chr.contextname
+ local category = chr.category
if contextname then
- local category = chr.category
if is_character[category] then
if chr.unicodeslot < 128 then
if is_letter[category] then
- contextsprint(ctxcatcodes,format("\\def\\%s{%s}",contextname,utfchar(u))) -- has no s
+ -- setmacro
+ local c = utfchar(u)
+ contextsprint(ctxcatcodes,format("\\def\\%s{%s}",contextname,c)) -- has no s
+ csletters[c] = u
else
+ -- setchar
contextsprint(ctxcatcodes,format("\\chardef\\%s=%s",contextname,u)) -- has no s
end
else
- contextsprint(ctxcatcodes,format("\\def\\%s{%s}",contextname,utfchar(u))) -- has no s
+ -- setmacro
+ local c = utfchar(u)
+ contextsprint(ctxcatcodes,format("\\def\\%s{%s}",contextname,c)) -- has no s
+ if is_letter[chr.category] and u >= 32 and u <= 65536 then
+ csletters[c] = u
+ end
end
elseif is_command[category] and not forbidden[u] then
+ -- set
contextsprint("{\\catcode",u,"=13\\unexpanded\\gdef ",utfchar(u),"{\\"..contextname,"}}")
- a = a + 1
- activated[a] = u
+ activated[#activated+1] = u
end
+ elseif is_letter[chr.category] and u >= 32 and u <= 65536 then
+ csletters[utfchar(u)] = u
end
end
end
- if tobelettered then -- shared
- local saved = tex.catcodetable
- for i=1,#tobelettered do
- tex.catcodetable = tobelettered[i]
- if trace_defining then
- report_defining("defining letters (global, shared)")
- end
- for u, chr in next, data do
- if not chr.fallback and is_letter[chr.category] and u >= 128 and u <= 65536 then
- texsetcatcode(u,11)
- end
- local range = chr.range
- if range then
- for i=1,range.first,range.last do -- tricky as not all are letters
- texsetcatcode(i,11)
- end
- end
- end
- texsetcatcode(0x200C,11) -- non-joiner
- texsetcatcode(0x200D,11) -- joiner
- for k, v in next, blocks do
- if v.catcode == "letter" then
- for i=v.first,v.last do
- texsetcatcode(i,11)
- end
+ if false then
+ for k, v in next, blocks do
+ if v.catcode == "letter" then
+ for u=v.first,v.last do
+ csletters[utfchar(u)] = u
end
end
end
- tex.catcodetable = saved
end
- local nofactivated = #tobeactivated
- if tobeactivated and nofactivated > 0 then
- for i=1,nofactivated do
- local u = activated[i]
- if u then
- report_defining("character %U is active in set %a, containing %a",u,data[u].description,tobeactivated)
- end
- end
- local saved = tex.catcodetable
- for i=1,#tobeactivated do
- local vector = tobeactivated[i]
- if trace_defining then
- report_defining("defining %a active characters in vector %a",nofactivated,vector)
- end
- tex.catcodetable = vector
- for i=1,nofactivated do
- local u = activated[i]
- if u then
- texsetcatcode(u,13)
- end
- end
- end
- tex.catcodetable = saved
+ if storage then
+ storage.register("characters/csletters", csletters, "characters.csletters")
+ end
+
+end
+
+lpegpatterns.csletter = utfchartabletopattern(csletters)
+
+-- todo: get rid of activated
+-- todo: move first loop out ,merge with above
+
+function characters.setlettercatcodes(cct)
+ if trace_defining then
+ report_defining("assigning letter catcodes to catcode table %a",cct)
end
+ local saved = tex.catcodetable
+ tex.catcodetable = cct
+ texsetcatcode(0x200C,11) -- non-joiner
+ texsetcatcode(0x200D,11) -- joiner
+ for c, u in next, csletters do
+ texsetcatcode(u,11)
+ end
+ -- for u, chr in next, data do
+ -- if not chr.fallback and is_letter[chr.category] and u >= 32 and u <= 65536 then
+ -- texsetcatcode(u,11)
+ -- end
+ -- local range = chr.range
+ -- if range then
+ -- for i=1,range.first,range.last do -- tricky as not all are letters
+ -- texsetcatcode(i,11)
+ -- end
+ -- end
+ -- end
+ -- for k, v in next, blocks do
+ -- if v.catcode == "letter" then
+ -- for u=v.first,v.last do
+ -- texsetcatcode(u,11)
+ -- end
+ -- end
+ -- end
+ tex.catcodetable = saved
+end
+function characters.setactivecatcodes(cct)
+ local saved = tex.catcodetable
+ tex.catcodetable = cct
+ for i=1,#activated do
+ local u = activated[i]
+ texsetcatcode(u,13)
+ if trace_defining then
+ report_defining("character %U (%s) is active in set %a",u,data[u].description,cct)
+ end
+ end
+ tex.catcodetable = saved
end
--[[ldx--
@@ -676,5 +696,6 @@ end
-- entities.gt = utfchar(characters.activeoffset + utfbyte(">"))
-- end
-commands.definecatcodetable = characters.define
-commands.setcharactercodes = characters.setcodes
+commands.setlettercatcodes = characters.setlettercatcodes
+commands.setactivecatcodes = characters.setactivecatcodes
+commands.setcharactercodes = characters.setcodes
diff --git a/tex/context/base/char-utf.lua b/tex/context/base/char-utf.lua
index e3f7605a8..267c97c26 100644
--- a/tex/context/base/char-utf.lua
+++ b/tex/context/base/char-utf.lua
@@ -30,8 +30,11 @@ if not characters.blocks then require("char-ini") end
local lpegmatch = lpeg.match
local lpegpatterns = lpeg.patterns
local p_utf8character = lpegpatterns.utf8character
+local p_utf8byte = lpegpatterns.utf8byte
local utfchartabletopattern = lpeg.utfchartabletopattern
+local formatters = string.formatters
+
local allocate = utilities.storage.allocate or function() return { } end
local charfromnumber = characters.fromnumber
@@ -60,6 +63,8 @@ characters.filters = filters
local utffilters = { }
characters.filters.utf = utffilters
+local data = characters.data
+
-- is characters.combined cached?
--[[ldx--
@@ -611,4 +616,23 @@ end
--
-- print(test,done,test==done,false)
+local f_default = formatters["[%U] "]
+local f_description = formatters["[%s] "]
+
+local function convert(n)
+ local d = data[n]
+ d = d and d.description
+ if d then
+ return f_description(d)
+ else
+ return f_default(n)
+ end
+end
+
+local pattern = Cs((p_utf8byte / convert)^1)
+
+function utffilters.verbose(data)
+ return data and lpegmatch(pattern,data) or ""
+end
+
return characters
diff --git a/tex/context/base/cldf-bas.lua b/tex/context/base/cldf-bas.lua
index b982fc364..1067a17d5 100644
--- a/tex/context/base/cldf-bas.lua
+++ b/tex/context/base/cldf-bas.lua
@@ -24,10 +24,10 @@ if not modules then modules = { } end modules ['cldf-bas'] = {
-- maybe use context.generics
-local type = type
-local format = string.format
-local utfchar = utf.char
-local concat = table.concat
+local type = type
+local format = string.format
+local utfchar = utf.char
+local concat = table.concat
local context = context
local generics = context.generics
@@ -49,13 +49,23 @@ function context.char(k) -- used as escape too, so don't change to utf
elseif n > 0 then
context([[\char%s\relax]],concat(k,[[\relax\char]]))
end
- elseif k then
- context([[\char%s\relax]],k)
+ else
+ if type(k) == "string" then
+ k = tonumber(k)
+ end
+ if type(k) == "number" then
+ context([[\char%s\relax]],k)
+ end
end
end
function context.utfchar(k)
- context(utfchar(k))
+ if type(k) == "string" then
+ k = tonumber(k)
+ end
+ if type(k) == "number" then
+ context(utfchar(k))
+ end
end
-- plain variants
diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua
index 62158e08b..43d5cebd1 100644
--- a/tex/context/base/cldf-ini.lua
+++ b/tex/context/base/cldf-ini.lua
@@ -315,13 +315,15 @@ local registerfunction, unregisterfunction, reservefunction, knownfunctions, cal
interfaces.scanners = table.setmetatablenewindex(function(t,k,v)
if storedscanners[k] then
+ -- report_cld("warning: scanner %a is already set",k)
+ -- os.exit()
-- \scan_<k> is already in the format
-- report_cld("using interface scanner: %s",k)
else
-- todo: allocate slot here and pass it
storedscanners[k] = true
-- report_cld("installing interface scanner: %s",k)
- context("\\installctxfunction{scan_%s}{interfaces.scanners.%s}",k,k)
+ context("\\installctxfunction{clf_%s}{interfaces.scanners.%s}",k,k)
end
rawset(t,k,v)
end)
diff --git a/tex/context/base/cldf-scn.lua b/tex/context/base/cldf-scn.lua
new file mode 100644
index 000000000..a3d8b0d87
--- /dev/null
+++ b/tex/context/base/cldf-scn.lua
@@ -0,0 +1,100 @@
+if not modules then modules = { } end modules ['cldf-scn'] = {
+ version = 1.001,
+ comment = "companion to cldf-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+if not tokens.setters then return end
+
+local load, type = load, type
+
+local formatters = string.formatters
+local char = string.char
+local concat = table.concat
+
+local f_action_f = formatters["action%s(%s)"]
+local f_action_s = formatters["local action%s = action[%s]"]
+local f_command = formatters["local action = tokens._action\n%\nt\nreturn function(%s) return %s end"]
+
+local interfaces = interfaces
+local commands = commands
+local scanners = interfaces.scanners
+
+local compile = tokens.compile or function() end
+
+local report = logs.reporter("interfaces","implementor")
+
+function interfaces.implement(specification)
+ local actions = specification.actions
+ local name = specification.name
+ local arguments = specification.arguments
+ local scope = specification.scope
+ if not actions then
+ if name then
+ report("error: no actions for %a",name)
+ else
+ report("error: no actions and no name")
+ end
+ return
+ end
+ local scanner = compile(specification)
+ if not name or name == "" then
+ return scanner
+ end
+ local command = nil
+ if type(actions) == "function" then
+ command = actions
+ elseif actions == context then
+ command = context
+ elseif #actions == 1 then
+ command = actions[1]
+ else
+ tokens._action = actions
+ local f = { }
+ local a = { }
+ local args = ""
+ if arguments then
+ for i=1,#arguments do
+ local v = arguments[i]
+ local t = type(v)
+ if t == "boolean" then
+ a[i] = tostring(v)
+ else
+ a[i] = char(96+i)
+ end
+ end
+ args = concat(a,",")
+ end
+ command = args
+ for i=1,#actions do
+ command = f_action_f(i,command)
+ f[#f+1] = f_action_s(i,i)
+ end
+ command = f_command(f,args,command)
+ command = load(command)
+ if command then
+ command = command()
+ end
+ tokens._action = nil
+ end
+ if scanners[name] then
+ report("warning: 'scanners.%s' is redefined",name)
+ end
+ scanners[name] = scanner
+ if scope == "private" then
+ return
+ end
+ if commands[name] then
+ report("warning: 'commands.%s' is redefined",name)
+ end
+ commands[name] = command
+ -- return scanner, command
+end
+
+-- it's convenient to have copies here:
+
+interfaces.setmacro = tokens.setters.macro
+interfaces.setcount = tokens.setters.count
+interfaces.setdimen = tokens.setters.dimen
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 9891ab046..61bfc0ca9 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{2015.03.10 12:09}
+\newcontextversion{2015.03.25 22:13}
%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 2c2c7b0a5..4ffe51b69 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 7d6259737..8252c7b8c 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{2015.03.10 12:09}
+\edef\contextversion{2015.03.25 22:13}
\edef\contextkind {beta}
%D For those who want to use this:
@@ -99,6 +99,9 @@
% From here on we have \unexpanded being \normalprotected, as we already had
% \unexpanded long before etex came around.
+\loadmarkfile{luat-ini}
+\loadmarkfile{toks-ini}
+
\loadmarkfile{syst-aux}
\loadmarkfile{syst-lua}
\loadmarkfile{syst-con}
@@ -106,6 +109,9 @@
\loadmarkfile{syst-fnt}
\loadmarkfile{syst-rtp}
+% \loadmarkfile{luat-ini} % moved up
+% \loadmarkfile{toks-ini} % moved up
+
\loadmkvifile{file-ini}
\loadmkvifile{file-res}
\loadmkvifile{file-lib}
@@ -126,9 +132,8 @@
\loadmarkfile{cldf-int} % interface
-\loadmarkfile{luat-ini}
+% \loadmarkfile{luat-ini}
-\loadmarkfile{toks-ini}
\loadmarkfile{toks-tra}
%loadmarkfile{toks-map} % obsolete, never used
@@ -419,7 +424,7 @@
\loadmarkfile{prop-ini} % only for downward compatibility
-\loadmarkfile{mlib-ctx}
+\loadmarkfile{mlib-ctx} % messy order
\loadmarkfile{meta-ini}
\loadmarkfile{meta-tex}
diff --git a/tex/context/base/file-job.mkvi b/tex/context/base/file-job.mkvi
index 243a8d856..171dc1a6a 100644
--- a/tex/context/base/file-job.mkvi
+++ b/tex/context/base/file-job.mkvi
@@ -241,13 +241,13 @@
\newsystemmode\v!environment
\unexpanded\def\startprojectindeed
- {\starttext
+ {%starttext
\pushsystemmode\v!project
\setsystemmode\v!project}
\unexpanded\def\stopprojectindeed
{\popsystemmode\v!project
- \stoptext
+ %stoptext
\signalendofinput\v!project}
\unexpanded\def\startproductindeed
diff --git a/tex/context/base/file-res.lua b/tex/context/base/file-res.lua
index 458ef7276..78fdc3404 100644
--- a/tex/context/base/file-res.lua
+++ b/tex/context/base/file-res.lua
@@ -134,7 +134,7 @@ openers.fix = openers.file loaders.fix = loaders.file
openers.set = openers.file loaders.set = loaders.file
openers.any = openers.file loaders.any = loaders.file
-function getreadfilename(scheme,path,name) -- better do a split and then pass table
+local function getreadfilename(scheme,path,name) -- better do a split and then pass table
local fullname
if hasscheme(name) or is_qualified_path(name) then
fullname = name
diff --git a/tex/context/base/font-chk.lua b/tex/context/base/font-chk.lua
index 591d59d65..e5c46dd62 100644
--- a/tex/context/base/font-chk.lua
+++ b/tex/context/base/font-chk.lua
@@ -17,6 +17,8 @@ local fastcopy = table.fastcopy
local report_fonts = logs.reporter("fonts","checking")
+local allocate = utilities.storage.allocate
+
local fonts = fonts
fonts.checkers = fonts.checkers or { }
@@ -88,7 +90,7 @@ end
fonts.loggers.onetimemessage = onetimemessage
-local mapping = { -- this is just an experiment to illustrate some principles elsewhere
+local mapping = allocate { -- this is just an experiment to illustrate some principles elsewhere
lu = "placeholder uppercase red",
ll = "placeholder lowercase red",
lt = "placeholder uppercase red",
@@ -113,9 +115,15 @@ local mapping = { -- this is just an experiment to illustrate some principles el
so = "placeholder lowercase yellow",
}
-table.setmetatableindex(mapping,function(t,k) v = "placeholder unknown gray" t[k] = v return v end)
+table.setmetatableindex(mapping,
+ function(t,k)
+ v = "placeholder unknown gray"
+ t[k] = v
+ return v
+ end
+)
-local fakes = {
+local fakes = allocate {
{
name = "lowercase",
code = ".025 -.175 m .425 -.175 l .425 .525 l .025 .525 l .025 -.175 l .025 0 l .425 0 l .025 -.175 m h S",
@@ -153,7 +161,7 @@ local fakes = {
},
}
-local variants = {
+local variants = allocate {
{ tag = "gray", r = .6, g = .6, b = .6 },
{ tag = "red", r = .6, g = 0, b = 0 },
{ tag = "green", r = 0, g = .6, b = 0 },
diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua
index a7f915023..9f5559290 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -955,8 +955,11 @@ do -- else too many locals
local ctx_setsomefontsize = context.fntsetsomesize
local ctx_letvaluerelax = context.letvaluerelax
+ local starttiming = statistics.starttiming
+ local stoptiming = statistics.stoptiming
+
function commands.definefont_one(str)
- statistics.starttiming(fonts)
+ starttiming(fonts)
if trace_defining then
report_defining("memory usage before: %s",statistics.memused())
report_defining("start stage one: %s",str)
@@ -1186,7 +1189,7 @@ do -- else too many locals
lastmathids[mathsize] = lastfontid
end
--
- statistics.stoptiming(fonts)
+ stoptiming(fonts)
end
function definers.define(specification)
@@ -1195,7 +1198,7 @@ do -- else too many locals
if not name or name == "" then
return -1
else
- statistics.starttiming(fonts)
+ starttiming(fonts)
--
-- following calls expect a few properties to be set:
--
@@ -1251,7 +1254,7 @@ do -- else too many locals
constructors.finalize(tfmdata)
return id, tfmdata
end
- statistics.stoptiming(fonts)
+ stoptiming(fonts)
end
end
diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua
index e26f28e34..449a00f2e 100644
--- a/tex/context/base/font-map.lua
+++ b/tex/context/base/font-map.lua
@@ -23,6 +23,8 @@ local fonts = fonts or { }
local mappings = fonts.mappings or { }
fonts.mappings = mappings
+local allocate = utilities.storage.allocate
+
--[[ldx--
<p>Eventually this code will disappear because map files are kind
of obsolete. Some code may move to runtime or auxiliary modules.</p>
@@ -194,7 +196,7 @@ local namesplitter = Ct(C((1 - ligseparator - varseparator)^1) * (ligseparator *
-- to be completed .. for fonts that use unicodes for ligatures which
-- is a actually a bad thing and should be avoided in the first place
-local overloads = {
+local overloads = allocate {
IJ = { name = "I_J", unicode = { 0x49, 0x4A }, mess = 0x0132 },
ij = { name = "i_j", unicode = { 0x69, 0x6A }, mess = 0x0133 },
ff = { name = "f_f", unicode = { 0x66, 0x66 }, mess = 0xFB00 },
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index d795deacf..283d7dc72 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -1560,6 +1560,7 @@ local epstopdf = {
-dBATCH
-dAutoRotatePages=/None
-dPDFSETTINGS=/%presets%
+ -dCompatibilityLevel=%level%
-dEPSCrop
-sOutputFile="%newname%"
"%oldname%"
@@ -1605,6 +1606,7 @@ end
function epsconverter.pdf(oldname,newname,resolution) -- the resolution interface might change
local epstopdf = programs.epstopdf -- can be changed
local presets = epstopdf.resolutions[resolution or "high"] or epstopdf.resolutions.high
+ local level = codeinjections.getformatoption("pdf_level") or "1.3"
local tmpname = oldname
if cleanups.ai then
tmpname = cleaners.ai(oldname)
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index 192e32f3c..0c8970609 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -888,24 +888,155 @@ end
-- return make(tree)
-- end
+local p_false = P(false)
+local p_true = P(true)
+
+-- local function make(t,hash)
+-- local p = p_false
+-- local keys = sortedkeys(t)
+-- for i=1,#keys do
+-- local k = keys[i]
+-- local v = t[k]
+-- local h = hash[v]
+-- if h then
+-- if next(v) then
+-- p = p + P(k) * (make(v,hash) + p_true)
+-- else
+-- p = p + P(k) * p_true
+-- end
+-- else
+-- if next(v) then
+-- p = p + P(k) * make(v,hash)
+-- else
+-- p = p + P(k)
+-- end
+-- end
+-- end
+-- return p
+-- end
+
+-- local function make(t,hash)
+-- local p = p_false
+-- local keys = sortedkeys(t)
+-- local function making(t,w)
+-- local p = p_false
+-- local keys = sortedkeys(t)
+-- for i=1,#keys do
+-- local k = keys[i]
+-- local v = t[k]
+-- if w then
+-- if next(v) then
+-- p = p + P(k) * (making(v,w) + p_true)
+-- else
+-- p = p + P(k) * p_true
+-- end
+-- else
+-- if next(v) then
+-- p = p + P(k) * making(v,w)
+-- else
+-- p = p + P(k)
+-- end
+-- end
+-- end
+-- return p
+-- end
+-- for i=1,#keys do
+-- local k = keys[i]
+-- local v = t[k]
+-- local h = hash[v]
+-- if h then
+-- if next(v) then
+-- p = p + P(k) * (making(v,true) + p_true)
+-- else
+-- p = p + P(k) * p_true
+-- end
+-- else
+-- if next(v) then
+-- p = p + P(k) * making(v,false)
+-- else
+-- p = p + P(k)
+-- end
+-- end
+-- end
+-- return p
+-- end
+--
+-- function lpeg.utfchartabletopattern(list) -- goes to util-lpg
+-- local tree = { }
+-- local hash = { }
+-- local n = #list
+-- if n == 0 then
+-- for s in next, list do
+-- local t = tree
+-- for c in gmatch(s,".") do
+-- local tc = t[c]
+-- if not tc then
+-- tc = { }
+-- t[c] = tc
+-- end
+-- t = tc
+-- end
+-- hash[t] = s
+-- end
+-- else
+-- for i=1,n do
+-- local t = tree
+-- local s = list[i]
+-- for c in gmatch(s,".") do
+-- local tc = t[c]
+-- if not tc then
+-- tc = { }
+-- t[c] = tc
+-- end
+-- t = tc
+-- end
+-- hash[t] = s
+-- end
+-- end
+-- return make(tree,hash)
+-- end
+
+
local function make(t,hash)
- local p = P(false)
+ local p = p_false
local keys = sortedkeys(t)
+ local function making(t,w)
+ local p = p_false
+ local keys = sortedkeys(t)
+ for i=1,#keys do
+ local k = keys[i]
+ local v = t[k]
+ if w then
+ if v == true then
+ p = p + P(k) * p_true
+ else
+ p = p + P(k) * (making(v,w) + p_true)
+ end
+ else
+ if v == true then
+ p = p + P(k)
+ else
+ p = p + P(k) * making(v,w)
+ end
+ end
+ end
+ return p
+ end
for i=1,#keys do
local k = keys[i]
local v = t[k]
local h = hash[v]
if h then
- if next(v) then
- p = p + P(k) * (make(v,hash) + P(true))
+ if v == true then
+ p = p + P(k) * p_true
else
- p = p + P(k) * P(true)
+ p = p + P(k) * (making(v,true) + p_true)
end
else
- if next(v) then
- p = p + P(k) * make(v,hash)
- else
+ if v == true then
p = p + P(k)
+ else
+ p = p + P(k) * making(v,false)
end
end
end
@@ -914,41 +1045,62 @@ end
function lpeg.utfchartabletopattern(list) -- goes to util-lpg
local tree = { }
- local hash = { }
+-- local hash = { }
+ local hash
local n = #list
if n == 0 then
- -- we could always use this branch
+ hash = list
for s in next, list do
local t = tree
+ local p, pk
for c in gmatch(s,".") do
- local tc = t[c]
- if not tc then
- tc = { }
- t[c] = tc
+ if t == true then
+ t = { [c] = true }
+ p[pk] = t
+ p = t
+ t = true
+ else
+ local tc = t[c]
+ if not tc then
+ tc = true
+ t[c] = tc
+ end
+ p = t
+ t = tc
end
- t = tc
+ pk = c
end
- hash[t] = s
end
else
+ hash = { }
for i=1,n do
local t = tree
local s = list[i]
+ local p, pk
for c in gmatch(s,".") do
- local tc = t[c]
- if not tc then
- tc = { }
- t[c] = tc
+ if t == true then
+ t = { [c] = true }
+ p[pk] = t
+ p = t
+ t = true
+ else
+ local tc = t[c]
+ if not tc then
+ tc = true
+ t[c] = true
+ end
+ p = t
+ t = tc
end
- t = tc
+ pk = c
end
- hash[t] = s
+ hash[s] = true
end
end
return make(tree,hash)
end
--- inspect ( lpeg.utfchartabletopattern {
+-- lpeg.utfchartabletopattern {
-- utfchar(0x00A0), -- nbsp
-- utfchar(0x2000), -- enquad
-- utfchar(0x2001), -- emquad
@@ -964,7 +1116,7 @@ end
-- utfchar(0x200B), -- zerowidthspace
-- utfchar(0x202F), -- narrownobreakspace
-- utfchar(0x205F), -- math thinspace
--- } )
+-- }
-- a few handy ones:
--
diff --git a/tex/context/base/lang-hyp.lua b/tex/context/base/lang-hyp.lua
index 60e1699ca..68edcfc85 100644
--- a/tex/context/base/lang-hyp.lua
+++ b/tex/context/base/lang-hyp.lua
@@ -591,6 +591,7 @@ if context then
local glyph_code = nodecodes.glyph
local disc_code = nodecodes.disc
local math_code = nodecodes.math
+ local hlist_code = nodecodes.hlist
local discretionary_code = disccodes.discretionary
local explicit_code = disccodes.explicit
@@ -614,6 +615,7 @@ if context then
local getnext = nuts.getnext
local getprev = nuts.getprev
local getsubtype = nuts.getsubtype
+ local getlist = nuts.getlist
local insert_before = nuts.insert_before
local insert_after = nuts.insert_after
local copy_node = nuts.copy
@@ -667,42 +669,48 @@ if context then
if specification then
local resources = specification.resources
if resources then
- local patterns = resources.patterns
- if patterns then
- local data = patterns.data
- if data then
- -- regular patterns
- lpegmatch(p_pattern,data,1,dictionary.patterns,dictionary.specials)
- end
- local extra = patterns.extra
- if extra then
- -- special patterns
- lpegmatch(p_pattern,extra,1,dictionary.patterns,dictionary.specials)
- end
- end
- local exceptions = resources.exceptions
- if exceptions then
- local data = exceptions.data
- if data and data ~= "" then
- lpegmatch(p_exception,data,1,dictionary.exceptions)
- end
- end
- local usedchars = lpegmatch(p_split,patterns.characters)
- local characters = { }
- local unicodes = { }
- for i=1,#usedchars do
- local char = usedchars[i]
- local code = utfbyte(char)
- local upper = uccodes[code]
- characters[char] = code
- unicodes [code] = char
- if type(upper) == "table" then
- for i=1,#upper do
- local u = upper[i]
- unicodes[u] = utfchar(u)
+ local characters = dictionary.characters or { }
+ local unicodes = dictionary.unicodes or { }
+ for i=1,#resources do
+ local r = resources[i]
+ if not r.in_dictionary then
+ r.in_dictionary = true
+ local patterns = r.patterns
+ if patterns then
+ local data = patterns.data
+ if data then
+ -- regular patterns
+ lpegmatch(p_pattern,data,1,dictionary.patterns,dictionary.specials)
+ end
+ local extra = patterns.extra
+ if extra then
+ -- special patterns
+ lpegmatch(p_pattern,extra,1,dictionary.patterns,dictionary.specials)
+ end
+ end
+ local exceptions = r.exceptions
+ if exceptions then
+ local data = exceptions.data
+ if data and data ~= "" then
+ lpegmatch(p_exception,data,1,dictionary.exceptions)
+ end
+ end
+ local usedchars = lpegmatch(p_split,patterns.characters)
+ for i=1,#usedchars do
+ local char = usedchars[i]
+ local code = utfbyte(char)
+ local upper = uccodes[code]
+ characters[char] = code
+ unicodes [code] = char
+ if type(upper) == "table" then
+ for i=1,#upper do
+ local u = upper[i]
+ unicodes[u] = utfchar(u)
+ end
+ else
+ unicodes[upper] = utfchar(upper)
+ end
end
- else
- unicodes[upper] = utfchar(upper)
end
end
dictionary.characters = characters
@@ -1423,11 +1431,24 @@ if context then
return head, done
end
- function hyphenators.handler(head)
+ local getcount = tex.getcount
+
+ hyphenators.optimize = false
+
+ function hyphenators.handler(head,groupcode)
if usedmethod then
- return usedmethod(head)
+ if groupcode == "hbox" and hyphenators.optimize then
+ if getcount("hyphenstate") > 0 then
+ forced = false
+ return usedmethod(head)
+ else
+ return head, false
+ end
+ else
+ return usedmethod(head)
+ end
else
- return head, done
+ return head, false
end
end
@@ -1435,16 +1456,22 @@ if context then
methods.original = original
methods.expanded = expanded
methods.traditional = languages.hyphenators.traditional.hyphenate
- methods.none = function(head) return head, false end
+ methods.none = false -- function(head) return head, false end
usedmethod = original
local function setmethod(method)
- usedmethod = type(method) == "string" and methods[method] or methods.tex
+ usedmethod = type(method) == "string" and methods[method]
+ if usedmethod == nil then
+ usedmethod = methods.tex
+ end
end
local function pushmethod(method)
insert(stack,usedmethod)
- setmethod(method)
+ usedmethod = type(method) == "string" and methods[method]
+ if usedmethod == nil then
+ usedmethod = methods.tex
+ end
end
local function popmethod()
usedmethod = remove(stack) or methods.tex
@@ -1497,6 +1524,17 @@ if context then
end
end
+ function nodes.stripdiscretionaries(head)
+ local h = tonut(head)
+ for l in traverse_id(hlist_code,h) do
+ for d in traverse_id(disc_code,getlist(l)) do
+ remove_node(h,false,true)
+ end
+ end
+ return tonode(h)
+ end
+
+
else
-- traditional.loadpatterns("nl","lang-nl")
diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua
index 0c3d9d80b..27bab6129 100644
--- a/tex/context/base/lang-ini.lua
+++ b/tex/context/base/lang-ini.lua
@@ -131,7 +131,10 @@ local function loaddefinitions(tag,specification)
if trace_patterns then
report_initialization("pattern specification for language %a: %s",tag,specification.patterns)
end
- local dataused, ok = data.used, false
+ local dataused = data.used
+ local ok = false
+ local resources = data.resources or { }
+ data.resources = resources
for i=1,#definitions do
local definition = definitions[i]
if definition == "" then
@@ -153,14 +156,15 @@ local function loaddefinitions(tag,specification)
report_initialization("loading definition %a for language %a from %a",definition,tag,fullname)
end
local suffix, gzipped = gzip.suffix(fullname)
- local resources = table.load(fullname,gzipped and gzip.load)
- if resources then -- todo: version test
+ local loaded = table.load(fullname,gzipped and gzip.load)
+ if loaded then -- todo: version test
ok, nofloaded = true, nofloaded + 1
- -- instance:patterns (resources.patterns and resources.patterns .data or "")
- -- instance:hyphenation(resources.exceptions and resources.exceptions.data or "")
- instance:patterns (validdata(resources.patterns, "patterns", tag) or "")
- instance:hyphenation(validdata(resources.exceptions,"exceptions",tag) or "")
- data.resources = resources -- so we can use them otherwise
+ -- instance:patterns (loaded.patterns and resources.patterns .data or "")
+ -- instance:hyphenation(loaded.exceptions and resources.exceptions.data or "")
+ instance:patterns (validdata(loaded.patterns, "patterns", tag) or "")
+ instance:hyphenation(validdata(loaded.exceptions,"exceptions",tag) or "")
+ resources[#resources+1] = loaded -- so we can use them otherwise
+
else
report_initialization("invalid definition %a for language %a in %a",definition,tag,filename)
end
diff --git a/tex/context/base/lang-ini.mkiv b/tex/context/base/lang-ini.mkiv
index 71b631be9..ddd7a8808 100644
--- a/tex/context/base/lang-ini.mkiv
+++ b/tex/context/base/lang-ini.mkiv
@@ -438,6 +438,10 @@
\the\everylanguage
\relax}
+% experimental
+
+\newcount\hyphenstate
+
% so far
\newcount\hyphenminoffset
diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua
index ac608baa4..f5e320a00 100644
--- a/tex/context/base/lpdf-ano.lua
+++ b/tex/context/base/lpdf-ano.lua
@@ -117,7 +117,7 @@ local pdf_border_color = nil
local set_border = false
local function pdfborder()
- border_set = true
+ set_border = true
return pdf_border_style, pdf_border_color
end
diff --git a/tex/context/base/lpdf-xmp.lua b/tex/context/base/lpdf-xmp.lua
index 739b29ef7..695f0224a 100644
--- a/tex/context/base/lpdf-xmp.lua
+++ b/tex/context/base/lpdf-xmp.lua
@@ -157,7 +157,7 @@ local function flushxmpinfo()
local producer = format("LuaTeX-%0.2f.%s",tex.luatexversion/100,tex.luatexrevision)
local creator = "LuaTeX + ConTeXt MkIV"
local time = lpdf.timestamp()
- local fullbanner = tex.pdftexbanner
+ local fullbanner = status.banner
-- local fullbanner = gsub(tex.pdftexbanner,"kpse.*","")
pdfaddxmpinfo("DocumentID", documentid)
diff --git a/tex/context/base/luat-cnf.lua b/tex/context/base/luat-cnf.lua
index cf8a1e7e0..0f6b8598f 100644
--- a/tex/context/base/luat-cnf.lua
+++ b/tex/context/base/luat-cnf.lua
@@ -64,7 +64,7 @@ function texconfig.init()
"string", "table", "coroutine", "debug", "file", "io", "lpeg", "math", "os", "package", "bit32",
},
basictex = { -- noad
- "callback", "font", "img", "lang", "lua", "node", "pdf", "status", "tex", "texconfig", "texio", "token",
+ "callback", "font", "img", "lang", "lua", "node", "pdf", "status", "tex", "texconfig", "texio", "token", "newtoken"
},
extralua = {
"gzip", "zip", "zlib", "lfs", "ltn12", "mime", "socket", "md5", "profiler", "unicode", "utf",
@@ -75,6 +75,7 @@ function texconfig.init()
obsolete = {
"fontforge", -- can be filled by luat-log
"kpse",
+ "token",
},
functions = {
"assert", "pcall", "xpcall", "error", "collectgarbage",
diff --git a/tex/context/base/luat-ini.mkiv b/tex/context/base/luat-ini.mkiv
index 168b52095..78a324db2 100644
--- a/tex/context/base/luat-ini.mkiv
+++ b/tex/context/base/luat-ini.mkiv
@@ -34,7 +34,7 @@
% the \type {\normalexpanded} around \type {\directlua}. Something to discuss
% in the team.
-\unexpanded\def\startlua % \stoplua
+\normalprotected\def\startlua % \stoplua
{\begingroup
\obeylualines
\luat_start_lua_indeed}
@@ -42,7 +42,7 @@
\def\luat_start_lua_indeed#1\stoplua
{\normalexpanded{\endgroup\noexpand\directlua{#1}}} % \zerocount is default
-\unexpanded\def\startluacode % \stopluacode
+\normalprotected\def\startluacode % \stopluacode
{\begingroup
\obeylualines
\obeyluatokens
@@ -77,7 +77,7 @@
\edef\lua_letter_seven {\string\7} \edef\lua_letter_eight {\string\8}
\edef\lua_letter_nine {\string\9} \edef\lua_letter_zero {\string\0}
-\appendtoks
+\everyluacode {% \appendtoks
\let\\\lua_letter_backslash
\let\|\lua_letter_bar \let\-\lua_letter_dash
\let\(\lua_letter_lparent \let\)\lua_letter_rparent
@@ -92,13 +92,12 @@
\let\5\lua_letter_five \let\6\lua_letter_six
\let\7\lua_letter_seven \let\8\lua_letter_eight
\let\9\lua_letter_nine \let\0\lua_letter_zero
-\to \everyluacode
+} % \to \everyluacode
-\unexpanded\def\obeyluatokens
+\normalprotected\def\obeyluatokens
{\setcatcodetable\luacatcodes
\the\everyluacode}
-
\edef\luamajorversion{\ctxwrite{_MINORVERSION}}
\edef\luaminorversion{\ctxwrite{_MAJORVERSION}}
@@ -107,35 +106,30 @@
%D
%D We provide an interface for defining instances:
-\def\s!lua{lua} \def\v!code{code} \def\!!name{name} \def\s!data{data}
+\def\s!lua {lua}
+\def\s!code {code}
+\def\s!data {data}
+\def\s!start{start}
+\def\s!stop {stop}
%D Beware: because \type {\expanded} is een convert command, the error
%D message will show \type{<inserted text>} as part of the message.
-\installcorenamespace{luacode}
+\installsystemnamespace{luacode}
-\unexpanded\def\luat_start_named_lua_code#1%
+\normalprotected\def\luat_start_named_lua_code#1%
{\begingroup
\obeylualines
\obeyluatokens
\csname\??luacode#1\endcsname}
-% \unexpanded\def\definenamedlua[#1]#2[#3]% no optional arg handling here yet / we could use numbers instead (more efficient)
-% {\ifcsname\??luacode#1\endcsname \else
-% \scratchcounter\ctxlua{lua.registername("#1","#3")}%
-% \normalexpanded{\xdef\csname\??luacode#1\endcsname##1\csname\e!stop#1\v!code\endcsname}%
-% {\noexpand\normalexpanded{\endgroup\noexpand\directlua\the\scratchcounter{_G=protect("#1\s!data")##1}}}%
-% \expandafter\edef\csname\e!start#1\v!code\endcsname {\luat_start_named_lua_code{#1}}%
-% \expandafter\edef\csname #1\v!code\endcsname##1{\noexpand\directlua\the\scratchcounter{_G=protect("#1\s!data")##1}}%
-% \fi}
-
-\unexpanded\def\definenamedlua[#1]#2[#3]% no optional arg handling here yet / we could use numbers instead (more efficient)
+\normalprotected\def\definenamedlua[#1]#2[#3]% no optional arg handling here yet / we could use numbers instead (more efficient)
{\ifcsname\??luacode#1\endcsname \else
\expandafter\chardef\csname\??luacode:#1\endcsname\ctxlua{lua.registername("#1","#3")}%
- \normalexpanded{\xdef\csname\??luacode#1\endcsname##1\csname\e!stop#1\v!code\endcsname}%
+ \normalexpanded{\xdef\csname\??luacode#1\endcsname##1\csname\s!stop#1\s!code\endcsname}%
{\noexpand\normalexpanded{\endgroup\noexpand\directlua\csname\??luacode:#1\endcsname{_G=protect("#1\s!data")##1}}}%
- \expandafter\edef\csname\e!start#1\v!code\endcsname {\luat_start_named_lua_code{#1}}%
- \expandafter\edef\csname #1\v!code\endcsname##1{\noexpand\directlua\csname\??luacode:#1\endcsname{_G=protect("#1\s!data")##1}}%
+ \expandafter\edef\csname\s!start#1\s!code\endcsname {\luat_start_named_lua_code{#1}}%
+ \expandafter\edef\csname #1\s!code\endcsname##1{\noexpand\directlua\csname\??luacode:#1\endcsname{_G=protect("#1\s!data")##1}}%
\fi}
%D We predefine a few.
@@ -221,7 +215,7 @@
%D Experimental:
-\unexpanded\def\startluaparameterset[#1]%
+\normalprotected\def\startluaparameterset[#1]%
{\begingroup
\obeylualines
\obeyluatokens
@@ -260,7 +254,7 @@
%D \ctxluacode{context("%0.5f",1/3)}
%D \stoptyping
-\unexpanded\def\ctxluacode
+\normalprotected\def\ctxluacode
{\begingroup
\obeylualines
\obeyluatokens
@@ -289,7 +283,7 @@
% \dorecurse{10000}{\ctxlua{context(" C3 ")}} \page
% \stoptext
-\installcorenamespace{ctxfunction}
+\installsystemnamespace{ctxfunction}
\normalprotected\def\startctxfunctiondefinition #1 %
{\begingroup \obeylualines \obeyluatokens \luat_start_lua_function_definition_indeed{#1}}
@@ -297,17 +291,17 @@
% \def\luat_start_lua_function_definition_indeed#1#2\stopctxfunctiondefinition
% {\endgroup\expandafter\edef\csname#1\endcsname{\noexpand\luafunction\ctxcommand{ctxfunction(\!!bs#2\!!es)}\relax}}
-\installcorenamespace{luafunction}
+\installsystemnamespace{luafunction}
\def\luat_start_lua_function_definition_indeed#1#2\stopctxfunctiondefinition
{\endgroup
\expandafter\chardef\csname\??luafunction#1\endcsname\ctxcommand{ctxfunction(\!!bs#2\!!es)}\relax
\expandafter\edef\csname#1\endcsname{\noexpand\luafunction\csname\??luafunction#1\endcsname}}
-% \unexpanded\def\setctxluafunction#1#2% experiment
+% \normalprotected\def\setctxluafunction#1#2% experiment
% {\expandafter\chardef\csname#1\endcsname#2\relax}
-\unexpanded\def\setctxluafunction#1#2% experiment
+\normalprotected\def\setctxluafunction#1#2% experiment
{\expandafter\chardef\csname\??luafunction#1\endcsname#2\relax
\expandafter\edef\csname#1\endcsname{\noexpand\luafunction\csname\??luafunction#1\endcsname}}
diff --git a/tex/context/base/lxml-ini.lua b/tex/context/base/lxml-ini.lua
new file mode 100644
index 000000000..434814b66
--- /dev/null
+++ b/tex/context/base/lxml-ini.lua
@@ -0,0 +1,131 @@
+if not modules then modules = { } end modules ['lxml-ini'] = {
+ version = 1.001,
+ comment = "this module is the basis for the lxml-* ones",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local xml = xml
+local lxml = lxml
+
+local scanners = tokens.scanners
+local scanstring = scanners.string
+
+scanners.lxmlid = function() return getid(scanstring()) end
+
+local implement = interfaces.implement
+
+-- lxml.id
+
+implement { name = "xmldoif", actions = lxml.doif, arguments = { "string", "string" } }
+implement { name = "xmldoifnot", actions = lxml.doifnot, arguments = { "string", "string" } }
+implement { name = "xmldoifelse", actions = lxml.doifelse, arguments = { "string", "string" } }
+implement { name = "xmldoiftext", actions = lxml.doiftext, arguments = { "string", "string" } }
+implement { name = "xmldoifnottext", actions = lxml.doifnottext, arguments = { "string", "string" } }
+implement { name = "xmldoifelsetext", actions = lxml.doifelsetext, arguments = { "string", "string" } }
+
+implement { name = "xmldoifempty", actions = lxml.doifempty, arguments = { "string", "string" } }
+implement { name = "xmldoifnotempty", actions = lxml.doifnotempty, arguments = { "string", "string" } }
+implement { name = "xmldoifelseempty", actions = lxml.doifelseempty, arguments = { "string", "string" } }
+implement { name = "xmldoifselfempty", actions = lxml.doifempty, arguments = "string" }
+implement { name = "xmldoifnotselfempty", actions = lxml.doifnotempty, arguments = "string" }
+implement { name = "xmldoifelseselfempty", actions = lxml.doifelseempty, arguments = "string" }
+
+--------- { name = "xmlcontent", actions = lxml.content, arguments = "string" }
+--------- { name = "xmlflushstripped", actions = lxml.strip, arguments = { "string", true } }
+implement { name = "xmlall", actions = lxml.all, arguments = { "string", "string" } }
+implement { name = "xmlatt", actions = lxml.att, arguments = { "string", "string" } }
+implement { name = "xmlattdef", actions = lxml.att, arguments = { "string", "string", "string" } }
+implement { name = "xmlattribute", actions = lxml.attribute, arguments = { "string", "string", "string" } }
+implement { name = "xmlattributedef", actions = lxml.attribute, arguments = { "string", "string", "string", "string" } }
+implement { name = "xmlchainatt", actions = lxml.chainattribute, arguments = { "string", "string", "string" } }
+implement { name = "xmlchainattdef", actions = lxml.chainattribute, arguments = { "string", "string", "string", "string" } }
+implement { name = "xmlchecknamespace", actions = xml.checknamespace, arguments = { "lxmlid", "string", "string" } }
+implement { name = "xmlcommand", actions = lxml.command, arguments = { "string", "string", "string" } }
+implement { name = "xmlconcat", actions = lxml.concat, arguments = { "string", "string", "string" } } -- \detokenize{#3}
+implement { name = "xmlconcatrange", actions = lxml.concatrange, arguments = { "string", "string", "string", "string", "string" } } -- \detokenize{#5}
+implement { name = "xmlcontext", actions = lxml.context, arguments = { "string", "string" } }
+implement { name = "xmlcount", actions = lxml.count, arguments = { "string", "string" } }
+implement { name = "xmldelete", actions = lxml.delete, arguments = { "string", "string" } }
+implement { name = "xmldirect", actions = lxml.direct, arguments = "string" }
+implement { name = "xmldirectives", actions = lxml.directives.setup, arguments = "string" }
+implement { name = "xmldirectivesafter", actions = lxml.directives.after, arguments = "string" }
+implement { name = "xmldirectivesbefore", actions = lxml.directives.before, arguments = "string" }
+implement { name = "xmldisplayverbatim", actions = lxml.displayverbatim, arguments = "string" }
+implement { name = "xmlelement", actions = lxml.element, arguments = { "string", "integer" } }
+implement { name = "xmlfilter", actions = lxml.filter, arguments = { "string", "string" } }
+implement { name = "xmlfilterlist", actions = lxml.filterlist, arguments = { "string", "string" } }
+implement { name = "xmlfirst", actions = lxml.first, arguments = { "string", "string" } }
+implement { name = "xmlflush", actions = lxml.flush, arguments = "string" }
+implement { name = "xmlflushcontext", actions = lxml.context, arguments = "string" }
+implement { name = "xmlflushlinewise", actions = lxml.flushlinewise, arguments = "string" }
+implement { name = "xmlflushspacewise", actions = lxml.flushspacewise, arguments = "string" }
+implement { name = "xmlfunction", actions = lxml.applyfunction, arguments = { "string", "string" } }
+implement { name = "xmlinclude", actions = lxml.include, arguments = { "string", "string", "string", true } }
+implement { name = "xmlincludeoptions", actions = lxml.include, arguments = { "string", "string", "string", "string" } }
+implement { name = "xmlinclusion", actions = lxml.inclusion, arguments = "string" }
+implement { name = "xmlinclusions", actions = lxml.inclusions, arguments = "string" }
+implement { name = "xmlindex", actions = lxml.index, arguments = { "string", "string", "integer" } }
+implement { name = "xmlinfo", actions = lxml.info, arguments = "string" }
+implement { name = "xmlinlineverbatim", actions = lxml.inlineverbatim, arguments = "string" }
+implement { name = "xmllast", actions = lxml.last, arguments = "string" }
+implement { name = "xmlload", actions = lxml.load, arguments = { "string", "string", "string", "string" } }
+implement { name = "xmlloadbuffer", actions = lxml.loadbuffer, arguments = { "string", "string", "string", "string" } }
+implement { name = "xmlloaddata", actions = lxml.loaddata, arguments = { "string", "string", "string", "string" } }
+implement { name = "xmlloaddirectives", actions = lxml.directives.load, arguments = "string" }
+implement { name = "xmlloadregistered", actions = lxml.loadregistered, arguments = { "string", "string", "string" } }
+implement { name = "xmlmain", actions = lxml.main, arguments = "string" }
+implement { name = "xmlmatch", actions = lxml.match, arguments = "string" }
+implement { name = "xmlname", actions = lxml.name, arguments = "string" }
+implement { name = "xmlnamespace", actions = lxml.namespace, arguments = "string" }
+implement { name = "xmlnonspace", actions = lxml.nonspace, arguments = { "string", "string" } }
+implement { name = "xmlpos", actions = lxml.pos, arguments = "string" }
+implement { name = "xmlraw", actions = lxml.raw, arguments = { "string", "string" } }
+implement { name = "xmlregisterns", actions = xml.registerns, arguments = { "string", "string" } }
+implement { name = "xmlremapname", actions = xml.remapname, arguments = { "lxmlid", "string","string","string" } }
+implement { name = "xmlremapnamespace", actions = xml.renamespace, arguments = { "lxmlid", "string", "string" } }
+implement { name = "xmlsave", actions = lxml.save, arguments = { "string", "string" } }
+implement { name = "xmlsetfunction", actions = lxml.setaction, arguments = { "string", "string", "string" } }
+implement { name = "xmlsetsetup", actions = lxml.setsetup, arguments = { "string", "string", "string" } }
+implement { name = "xmlsnippet", actions = lxml.snippet, arguments = { "string", "integer" } }
+implement { name = "xmlstrip", actions = lxml.strip, arguments = { "string", "string" } }
+implement { name = "xmlstripanywhere", actions = lxml.strip, arguments = { "string", "string", true, true } }
+implement { name = "xmlstripnolines", actions = lxml.strip, arguments = { "string", "string", true } }
+implement { name = "xmlstripped", actions = lxml.stripped, arguments = { "string", "string" } }
+implement { name = "xmlstrippednolines", actions = lxml.stripped, arguments = { "string", "string", true } }
+implement { name = "xmltag", actions = lxml.tag, arguments = "string" }
+implement { name = "xmltext", actions = lxml.text, arguments = { "string", "string" } }
+implement { name = "xmltobuffer", actions = lxml.tobuffer, arguments = { "string", "string", "string" } }
+implement { name = "xmltobufferverbose", actions = lxml.tobuffer, arguments = { "string", "string", "string", true } }
+implement { name = "xmltofile", actions = lxml.tofile, arguments = { "string", "string", "string" } }
+implement { name = "xmltoparameters", actions = lxml.toparameters, arguments = "string" }
+implement { name = "xmlverbatim", actions = lxml.verbatim, arguments = "string" }
+
+implement { name = "xmlstartraw", actions = lxml.startraw }
+implement { name = "xmlstopraw", actions = lxml.stopraw }
+
+implement { name = "xmlprependsetup", actions = lxml.installsetup, arguments = { 1, "string", "string" } } -- 2:*
+implement { name = "xmlappendsetup", actions = lxml.installsetup, arguments = { 2, "string", "string" } } -- 2:*
+implement { name = "xmlbeforesetup", actions = lxml.installsetup, arguments = { 3, "string", "string", "string" } } -- 2:*
+implement { name = "xmlaftersetup", actions = lxml.installsetup, arguments = { 4, "string", "string", "string" } } -- 2:*
+implement { name = "xmlprependdocumentsetup", actions = lxml.installsetup, arguments = { 1, "string", "string" } }
+implement { name = "xmlappenddocumentsetup", actions = lxml.installsetup, arguments = { 2, "string", "string" } }
+implement { name = "xmlbeforedocumentsetup", actions = lxml.installsetup, arguments = { 3, "string", "string", "string" } }
+implement { name = "xmlafterdocumentsetup", actions = lxml.installsetup, arguments = { 4, "string", "string" } }
+implement { name = "xmlremovesetup", actions = lxml.removesetup, arguments = { "string", "string" } } -- 1:*
+implement { name = "xmlremovedocumentsetup", actions = lxml.removesetup, arguments = { "string", "string" } }
+implement { name = "xmlflushdocumentsetups", actions = lxml.flushsetups, arguments = { "string", "string", "string" } } -- 2:*
+implement { name = "xmlresetdocumentsetups", actions = lxml.resetsetups, arguments = "string" }
+
+implement { name = "xmlgetindex", actions = lxml.getindex, arguments = { "string", "string" } }
+implement { name = "xmlwithindex", actions = lxml.withindex, arguments = { "string", "string", "string" } }
+
+implement { name = "xmlsetentity", actions = xml.registerentity, arguments = { "string", "string" } }
+implement { name = "xmltexentity", actions = lxml.registerentity, arguments = { "string", "string" } }
+
+implement { name = "xmlsetcommandtotext", actions = lxml.setcommandtotext, arguments = "string" }
+implement { name = "xmlsetcommandtonone", actions = lxml.setcommandtonone, arguments = "string" }
+
+implement { name = "xmlstarttiming", actions = function() statistics.starttiming(lxml) end }
+implement { name = "xmlstoptiming", actions = function() statistics.stoptiming (lxml) end }
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
index a7cdff862..d82023c39 100644
--- a/tex/context/base/lxml-ini.mkiv
+++ b/tex/context/base/lxml-ini.mkiv
@@ -56,7 +56,6 @@
%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
-\def\xmlidx #1#2#3{\ctxlxml{idx("#1","#2",\number#3)}} % not ok
\def\xmlinclude #1#2#3{\ctxlxml{include("#1","#2","#3",true)}}
\def\xmlincludeoptions#1#2#3#4{\ctxlxml{include("#1","#2","#3","#4")}}
\def\xmlinclusion #1{\ctxlxml{inclusion("#1")}}
@@ -78,7 +77,7 @@
\def\xmlremapname #1#2#3#4{\ctxlua{xml.remapname(lxml.id("#1"),"#2","#3","#4")}} % element
\def\xmlremapnamespace #1#2#3{\ctxlua{xml.renamespace(lxml.id("#1"),"#2","#3")}} % document
\def\xmlchecknamespace #1#2#3{\ctxlua{xml.checknamespace(lxml.id("#1"),"#2","#3")}} % element
-\def\xmlsetfunction #1#2#3{\ctxlxml{setaction("#1",\!!bs#2\!!es,#3)}}
+\def\xmlsetfunction #1#2#3{\ctxlxml{setaction("#1",\!!bs#2\!!es,"#3")}}
\def\xmlsetsetup #1#2#3{\ctxlxml{setsetup("#1",\!!bs#2\!!es,"#3")}}
\def\xmlstrip #1#2{\ctxlxml{strip("#1","#2")}}
\def\xmlstripnolines #1#2{\ctxlxml{strip("#1","#2",true)}}
@@ -345,7 +344,6 @@
%D Experimental:
\def\xmlgetindex #1{\ctxlxml{getindex("\xmldocument","#1")}}
-\def\xmlrawindex #1{\ctxlxml{rawindex("#1")}}
\def\xmlwithindex #1#2{\ctxlxml{withindex("\xmldocument","#1","#2")}}
\def\xmlreference #1#2{\string\xmlwithindex{#1}{#2}}
diff --git a/tex/context/base/m-hemistich.mkiv b/tex/context/base/m-hemistich.mkiv
index 55fde7b92..685b1670f 100644
--- a/tex/context/base/m-hemistich.mkiv
+++ b/tex/context/base/m-hemistich.mkiv
@@ -41,21 +41,29 @@
{\scratchwidth\availablehsize}
{\scratchwidth\hemistichparameter\c!width\relax}%
\spaceskip\zeropoint\s!plus\plusone\s!fill\relax
+ \dostarttagged\t!division\currenthemistich
\hbox to \scratchwidth\bgroup
\scratchwidth.5\dimexpr\scratchwidth-\hemistichparameter\c!distance\relax
\hbox to \scratchwidth\bgroup
+ \dostarttagged\t!construct\c!lefttext
\usehemistichstyleandcolor\c!leftstyle\c!leftcolor#3%
+ \dostoptagged
\egroup
\hss
\begingroup
+ \dostarttagged\t!construct\c!separator
\usehemistichstyleandcolor\c!separatorstyle\c!separatorcolor
\hemistichparameter\c!separator
+ \dostoptagged
\endgroup
\hss
\hbox to \scratchwidth\bgroup
+ \dostarttagged\t!construct\c!righttext
\usehemistichstyleandcolor\c!rightstyle\c!rightcolor#4%
+ \dostoptagged
\egroup
\egroup
+ \dostoptagged
\endgroup}
\unexpanded\def\hemistichescaesura#1#2#3%
diff --git a/tex/context/base/m-translate.mkiv b/tex/context/base/m-translate.mkiv
index f36f9a9fb..2e6cbe950 100644
--- a/tex/context/base/m-translate.mkiv
+++ b/tex/context/base/m-translate.mkiv
@@ -22,12 +22,34 @@
local compiled, list = nil, nil
+ -- function translators.register(from,to)
+ -- local l = lpeg.P(from)/to
+ -- if not list then
+ -- list = l
+ -- else
+ -- list = list + l
+ -- end
+ -- compiled = nil
+ -- end
+ --
+ -- function translators.translate(s)
+ -- if list then
+ -- if not compiled then
+ -- compiled = lpeg.Cs((list + lpeg.P(1))^0)
+ -- end
+ -- return compiled:match(s)
+ -- else
+ -- return s
+ -- end
+ -- end
+
+ -- local function prepare()
+
function translators.register(from,to)
- local l = lpeg.P(from)/to
if not list then
- list = l
+ list = { [from] = to }
else
- list = list + l
+ list[from] = to
end
compiled = nil
end
@@ -35,7 +57,8 @@
function translators.translate(s)
if list then
if not compiled then
- compiled = lpeg.Cs((list + lpeg.P(1))^0)
+ local tree = lpeg.utfchartabletopattern(list)
+ compiled = lpeg.Cs((tree/list + lpeg.patterns.utf8character)^0 * lpeg.P(-1)) -- the P(1) is needed in order to accept non utf
end
return compiled:match(s)
else
diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua
index 61089e7e6..ef4db6941 100644
--- a/tex/context/base/mlib-run.lua
+++ b/tex/context/base/mlib-run.lua
@@ -44,6 +44,8 @@ local texerrormessage = logs.texerrormessage
local starttiming = statistics.starttiming
local stoptiming = statistics.stoptiming
+local formatters = string.formatters
+
local mplib = mplib
metapost = metapost or { }
local metapost = metapost
@@ -177,11 +179,11 @@ function metapost.reporterror(result)
return true
end
-local preamble = [[
+local f_preamble = formatters [ [[
boolean mplib ; mplib := true ;
let dump = endinput ;
input "%s" ;
-]]
+]] ]
local methods = {
double = "double",
@@ -199,6 +201,20 @@ function metapost.scripterror(str)
report_metapost("script error: %s",str)
end
+-- todo: random_seed
+
+local f_textext = formatters[ [[rawtextext("%s")]] ]
+
+function metapost.maketext(s,mode)
+ if mode and mode == 1 then
+ -- report_metapost("ignoring verbatimtex: %s",s)
+ else
+ -- report_metapost("handling btex ... etex: %s",s)
+ s = gsub(s,'"','"&ditto&"')
+ return f_textext(s)
+ end
+end
+
function metapost.load(name,method)
starttiming(mplib)
method = method and methods[method] or "scaled"
@@ -207,13 +223,15 @@ function metapost.load(name,method)
math_mode = method,
run_script = metapost.runscript,
script_error = metapost.scripterror,
+ make_text = metapost.maketext,
+ extensions = 1,
}
report_metapost("initializing number mode %a",method)
local result
if not mpx then
result = { status = 99, error = "out of memory"}
else
- result = mpx:execute(format(preamble, file.addsuffix(name,"mp"))) -- addsuffix is redundant
+ result = mpx:execute(f_preamble(file.addsuffix(name,"mp"))) -- addsuffix is redundant
end
stoptiming(mplib)
metapost.reporterror(result)
@@ -317,10 +335,11 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
if not mp_inp[mpx] then
mp_tag = mp_tag + 1
local jobname = tex.jobname
- mp_inp[mpx] = io.open(format("%s-mplib-run-%03i.mp", jobname,mp_tag),"w")
- mp_log[mpx] = io.open(format("%s-mplib-run-%03i.log",jobname,mp_tag),"w")
+ mp_inp[mpx] = io.open(formatters["%s-mplib-run-%03i.mp"] (jobname,mp_tag,"w"))
+ mp_log[mpx] = io.open(formatters["%s-mplib-run-%03i.log"](jobname,mp_tag,"w"))
end
- local banner = format("%% begin graphic: n=%s, trialrun=%s, multipass=%s, isextrapass=%s\n\n", metapost.n, tostring(trialrun), tostring(multipass), tostring(isextrapass))
+ local banner = formatters["%% begin graphic: n=%s, trialrun=%s, multipass=%s, isextrapass=%s\n\n"](
+ metapost.n, tostring(trialrun), tostring(multipass), tostring(isextrapass))
mp_inp[mpx]:write(banner)
mp_log[mpx]:write(banner)
end
@@ -359,9 +378,9 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
-- d = string.gsub(d,"\r","")
if d then
if trace_graphics then
- mp_inp[mpx]:write(format("\n%% begin snippet %s\n",i))
+ mp_inp[mpx]:write(formatters["\n%% begin snippet %s\n"](i))
mp_inp[mpx]:write(d)
- mp_inp[mpx]:write(format("\n%% end snippet %s\n",i))
+ mp_inp[mpx]:write(formatters["\n%% end snippet %s\n"](i))
end
starttiming(metapost.exectime)
result = mpx:execute(d)
@@ -484,7 +503,7 @@ function metapost.directrun(formatname,filename,outputformat,astable,mpdata)
else
output = figures[v]:svg() -- (3) for prologues
end
- local outname = format("%s-%s.%s",basename,v,outputformat)
+ local outname = formatters["%s-%s.%s"](basename,v,outputformat)
report_metapost("saving %s bytes in %a",#output,outname)
io.savedata(outname,output)
end
@@ -517,7 +536,7 @@ function metapost.quickanddirty(mpxformat,data)
stopfigure = function()
end
}
- local data = format("; beginfig(1) ;\n %s\n ; endfig ;",data)
+ local data = formatters["; beginfig(1) ;\n %s\n ; endfig ;"](data)
metapost.process(mpxformat, { data }, false, flusher, false, false, "all")
if code then
return {
diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv
index 1fb951048..2cc1c6399 100644
--- a/tex/context/base/mult-aux.mkiv
+++ b/tex/context/base/mult-aux.mkiv
@@ -223,14 +223,30 @@
\def#8##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\s!empty\fi\endcsname}%
\def#9##1{\csname#1#2:##1\endcsname}}
+% pre-expansion can be a bit faster but handly any effect on a normal run so let's go for
+% saving some memory
+%
+% \unexpanded\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only)
+% {\ifx#2\relax\let#2\empty\fi % it is hardly faster but produces less expansion tracing
+% %\def#3##1{\csname#4{#1#2}{##1}\endcsname}%
+% \edef#3##1{\noexpand\csname\noexpand\ifcsname#1\noexpand#2:##1\endcsname#1\noexpand#2:##1\noexpand\else\noexpand\expandafter\noexpand#5\noexpand\csname#1\noexpand#2:\s!parent\endcsname{##1}\noexpand\fi\endcsname}%
+% \edef#4##1##2{\noexpand\ifcsname##1:##2\endcsname##1:##2\noexpand\else\noexpand\expandafter\noexpand#5\noexpand\csname##1:\s!parent\endcsname{##2}\noexpand\fi}%
+% \def #5##1##2{\ifx##1\relax\s!empty\else#4{##1}{##2}\fi}% is {} needed around ##1 ?
+% \edef#6##1##2{\noexpand\csname\noexpand\ifcsname#1##1:##2\endcsname#1##1:##2\noexpand\else\noexpand\expandafter\noexpand#5\noexpand\csname#1##1:\s!parent\endcsname{##2}\noexpand\fi\endcsname}%
+% \def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2:##1\endcsname}}% always root, no backtrack
+% % \def#7##1{\mult_interfaces_detokenize{\csname#4{#1#2}{##1}\endcsname}}% compact version
+% % \def#7##1{\mult_interfaces_detokenize{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}}%
+% \edef#8##1{\noexpand\csname\noexpand\ifcsname#1\noexpand#2:##1\endcsname#1\noexpand#2:##1\noexpand\else\s!empty\noexpand\fi\endcsname}%
+% \edef#9##1{\noexpand\csname#1#2:##1\endcsname}}
+
\unexpanded\def\installparameterhandler#1#2%
{\normalexpanded
{\mult_interfaces_install_parameter_handler
{\noexpand#1}% \??aa
\expandafter\noexpand\csname current#2\endcsname
\expandafter\noexpand\csname #2parameter\endcsname
- \expandafter\noexpand\csname do#2parameter\endcsname % or : #2_parameter_hash
- \expandafter\noexpand\csname do#2parentparameter\endcsname % or : #2_parent_parameter_hash
+ \expandafter\noexpand\csname do#2parameter\endcsname % or : #2_parameter
+ \expandafter\noexpand\csname do#2parentparameter\endcsname % or : #2_parent_parameter
\expandafter\noexpand\csname named#2parameter\endcsname
\expandafter\noexpand\csname detokenized#2parameter\endcsname
\expandafter\noexpand\csname strict#2parameter\endcsname % checked
diff --git a/tex/context/base/mult-mps.lua b/tex/context/base/mult-mps.lua
index 1275af47b..a6bebc266 100644
--- a/tex/context/base/mult-mps.lua
+++ b/tex/context/base/mult-mps.lua
@@ -66,7 +66,7 @@ return {
"outputformat", "outputtemplate", "filenametemplate", "fontmapfile", "fontmapline",
"fontpart", "fontsize", "glyph", "restoreclipcolor", "troffmode",
--
- "runscript",
+ "runscript", "maketext",
},
commands = {
"upto", "downto",
diff --git a/tex/context/base/page-brk.mkiv b/tex/context/base/page-brk.mkiv
index cf74a73c3..600819b1b 100644
--- a/tex/context/base/page-brk.mkiv
+++ b/tex/context/base/page-brk.mkiv
@@ -178,6 +178,8 @@
\global\pageornamentstate\plusone
\fi}
+% also needed: \page \doifoddpageelse\relax{\page[\v!blank,\v!right]
+
\installpagebreakmethod \v!no
{\ifconditional\c_page_breaks_enabled
\dosomebreak\nobreak
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index be5f1eca8..9be765985 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -409,21 +409,23 @@ do
local space = S(" \t\n\r\f") -- / " "
local collapsed = space^1/" "
+ ----- csletter = R("az","AZ")
+ local csletter = lpegpatterns.csletter
----- command = P("\\") * Cc("btxcmd{") * (R("az","AZ")^1) * Cc("}")
----- command = P("\\") * (Carg(1) * C(R("az","AZ")^1) / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
----- command = P("\\") * (Carg(1) * C(R("az","AZ")^1) * space^0 / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
- local command = P("\\") * (Carg(1) * C(R("az","AZ")^1) * space^0 / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
+ local command = P("\\") * (Carg(1) * C(csletter^1) * space^0 / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
local whatever = P("\\") * P(" ")^1 / " "
+ P("\\") * ( P("hbox") + P("raise") ) -- bah
local somemath = P("$") * ((1-P("$"))^1) * P("$") -- let's not assume nested math
----- character = lpegpatterns.utf8character
local any = P(1)
local done = P(-1)
- local one_l = P("{") / ""
- local one_r = P("}") / ""
- local two_l = P("{{") / ""
- local two_r = P("}}") / ""
+ -- local one_l = P("{") / ""
+ -- local one_r = P("}") / ""
+ -- local two_l = P("{{") / ""
+ -- local two_r = P("}}") / ""
local zero_l_r = P("{}") / "" * #P(1)
local special = P("#") / "\\letterhash "
@@ -460,13 +462,16 @@ do
local function do_definition(category,tag,tab,dataset)
publicationsstats.nofdefinitions = publicationsstats.nofdefinitions + 1
+ if tag == "" then
+ tag = "no-tag-set"
+ end
local fields = dataset.fields
local luadata = dataset.luadata
local hashtag = tag
if luadata[tag] then
local t = tags[tag]
local d = dataset.name
- local n = (t[n] or 0) + 1
+ local n = (t[d] or 0) + 1
t[d] = n
hashtag = tag .. "-" .. n
if trace_duplicates then
@@ -561,23 +566,27 @@ do
[2] = left * V(1) * right,
}
- local unbalanced = P {
- [1] = left * V(2) * right,
- [2] = ((escape * (left+right)) + (collapsed + 1 - (left+right))^1 + V(1))^0,
- }
+ -- local unbalanced = P {
+ -- [1] = left * V(2) * right,
+ -- [2] = ((escape * (left+right)) + (collapsed + 1 - (left+right))^1 + V(1))^0,
+ -- }
+
+ local unbalanced = (left/"") * balanced * (right/"") * P(-1)
local keyword = C((R("az","AZ","09") + S("@_:-"))^1)
local key = C((1-space-equal)^1)
- local tag = C((1-space-comma)^1)
+ local tag = C((1-space-comma)^0)
local reference = keyword
local category = C((1-space-left)^1)
local s_quoted = ((escape*single) + collapsed + (1-single))^0
local d_quoted = ((escape*double) + collapsed + (1-double))^0
local b_value = p_left * balanced * p_right
- local u_value = p_left * unbalanced * p_right -- get rid of outer { }
- local s_value = (single/"") * (u_value + s_quoted) * (single/"")
- local d_value = (double/"") * (u_value + d_quoted) * (double/"")
+ -- local u_value = p_left * unbalanced * p_right -- get rid of outer { }
+ -- local s_value = (single/"") * (u_value + s_quoted) * (single/"")
+ -- local d_value = (double/"") * (u_value + d_quoted) * (double/"")
+ local s_value = (single/"") * (unbalanced + s_quoted) * (single/"")
+ local d_value = (double/"") * (unbalanced + d_quoted) * (double/"")
local r_value = reference * Carg(1) /resolve
local somevalue = d_value + b_value + s_value + r_value
@@ -647,9 +656,9 @@ do
local compact = false -- can be a directive but then we also need to deal with newlines ... not now
- function publications.converttoxml(dataset,nice,dontstore,usedonly) -- we have fields !
+ function publications.converttoxml(dataset,nice,dontstore,usedonly,subset) -- we have fields !
local current = datasets[dataset]
- local luadata = current and current.luadata
+ local luadata = subset or (current and current.luadata)
if luadata then
statistics.starttiming(publications)
--
@@ -1011,73 +1020,86 @@ do
]]
- function savers.bib(dataset,filename,usedonly)
- local current = datasets[dataset]
- local luadata = current.luadata or { }
- local usedonly = usedonly and publications.usedentries()
- local f_start = formatters["@%s{%s,\n"]
- local f_field = formatters[" %s = {%s},\n"]
- local s_stop = "}\n\n"
- local result = { s_preamble }
+ function savers.bib(dataset,filename,tobesaved)
+ local f_start = formatters["@%s{%s,\n"]
+ local f_field = formatters[" %s = {%s},\n"]
+ local s_stop = "}\n\n"
+ local result = { s_preamble }
local n, r = 0, 1
- for tag, data in sortedhash(luadata) do
- if not usedonly or usedonly[tag] then
- r = r + 1 ; result[r] = f_start(data.category or "article",tag)
- for key, value in sortedhash(data) do
- if not privates[key] then
- r = r + 1 ; result[r] = f_field(key,value)
- end
+ for tag, data in sortedhash(tobesaved) do
+ r = r + 1 ; result[r] = f_start(data.category or "article",tag)
+ for key, value in sortedhash(data) do
+ if not privates[key] then
+ r = r + 1 ; result[r] = f_field(key,value)
end
- r = r + 1 ; result[r] = s_stop
- n = n + 1
end
+ r = r + 1 ; result[r] = s_stop
+ n = n + 1
end
report("%s entries from dataset %a saved in %a",n,dataset,filename)
io.savedata(filename,concat(result))
end
- function savers.lua(dataset,filename,usedonly)
- local current = datasets[dataset]
- local luadata = current.luadata or { }
- local usedonly = usedonly and publications.usedentries()
- if usedonly then
- local list = { }
- if usedonly then
- for key, value in next, luadata do
- if not privates[key] and usedonly[key] then
- list[key] = value
- end
- end
- else
- for key, value in next, luadata do
- if not privates[key] then
- list[key] = value
- end
+ function savers.lua(dataset,filename,tobesaved)
+ local list = { }
+ local n = 0
+ for tag, data in next, tobesaved do
+ local t = { }
+ for key, value in next, data do
+ if not privates[key] then
+ d[key] = value
end
end
- luadata = list
+ list[tag] = t
+ n = n + 1
end
- report("%s entries from dataset %a saved in %a",table.count(luadata),dataset,filename)
- table.save(filename,luadata)
+ report("%s entries from dataset %a saved in %a",n,dataset,filename)
+ table.save(filename,list)
end
- function savers.xml(dataset,filename,usedonly)
- local result, n = publications.converttoxml(dataset,true,true,usedonly) -- maybe also private? but then we need to have tag as attr
+ function savers.xml(dataset,filename,tobesaved)
+ local result, n = publications.converttoxml(dataset,true,true,false,tobesaved)
report("%s entries from dataset %a saved in %a",n,dataset,filename)
io.savedata(filename,result)
end
- function publications.save(dataset,filename,kind,usedonly)
+ function publications.save(specification)
+ local dataset = specification.dataset
+ local filename = specification.filename
+ local filetype = specification.filetype
+ local criterium = specification.criterium
statistics.starttiming(publications)
- if not kind or kind == "" then
- kind = file.suffix(filename)
+ if not filename or filename == "" then
+ report("no filename for saving given")
+ return
+ end
+ if not filetype or filetype == "" then
+ filetype = file.suffix(filename)
+ end
+ if not criterium or criterium == "" then
+ criterium = v_all
end
- local saver = savers[kind]
+ local saver = savers[filetype]
if saver then
- usedonly = usedonly ~= v_all
- saver(dataset,filename,usedonly)
+ local current = datasets[dataset]
+ local luadata = current.luadata or { }
+ local tobesaved = { }
+ local result = structures.lists.filter({criterium = criterium, names = "btx"}) or { }
+ for i=1,#result do
+ local userdata = result[i].userdata
+ if userdata then
+ local set = userdata.btxset or v_default
+ if set == dataset then
+ local tag = userdata.btxref
+ if tag then
+ tobesaved[tag] = luadata[tag]
+ end
+ end
+ end
+ end
+ saver(dataset,filename,tobesaved)
else
- report("unknown format %a for saving %a",kind,dataset)
+ report("unknown format %a for saving %a",filetype,dataset)
end
statistics.stoptiming(publications)
return dataset
diff --git a/tex/context/base/publ-fnd.lua b/tex/context/base/publ-fnd.lua
index 2457709ff..65c025f22 100644
--- a/tex/context/base/publ-fnd.lua
+++ b/tex/context/base/publ-fnd.lua
@@ -19,7 +19,7 @@ local publications = publications
local tonumber, next, type = tonumber, next, type
local find = string.find
-local P, R, S, C, Cs, Cp, Cc, Carg, V = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Carg, lpeg.V
+local P, R, S, C, Cs, Cp, Cc, Carg, Ct, V = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Carg, lpeg.Ct, lpeg.V
local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
local concat = table.concat
@@ -143,10 +143,10 @@ local percent = P("-") / "%%"
local word = Cs(lpegpatterns.unquoted + lpegpatterns.argument + valid)
local range = P("<") * space^0 * C((1-space)^1) * space^1 * C((1-space- P(">"))^1) * space^0 * P(">")
-local f_key_fld = formatters[" local kf_%s = get(entry,%q) \n if kf_%s then kf_%s = lower(kf_%s) end"]
-local f_key_set = formatters[" local ks_%s = get(entry,%q,categories)\n if ks_%s then ks_%s = lower(ks_%s) end"]
-local f_number_fld = formatters[" local nf_%s = tonumber(get(entry,%q))"]
-local f_number_set = formatters[" local ns_%s = tonumber(get(entry,%q,categories))"]
+local f_key_fld = formatters[" local kf_%s = get(entry,%q) \n if kf_%s then kf_%s = lower(kf_%s) end"]
+local f_key_set = formatters[" local ks_%s = get(entry,%q,categories)\n if ks_%s then ks_%s = lower(ks_%s) end"]
+local f_number_fld = formatters[" local nf_%s = tonumber(get(entry,%q))"]
+local f_number_set = formatters[" local ns_%s = tonumber(get(entry,%q,categories))"]
local f_fld_exact = formatters["(kf_%s == %q)"]
local f_set_exact = formatters["(ks_%s == %q)"]
@@ -161,7 +161,7 @@ local function test_key_value(keys,where,key,first,last)
if not key or key == "" then
return "(false)"
elseif key == "*" then
- last = "^.*" .. topattern(lowercase(last)) .. ".*$"
+ last = "^.*" .. topattern(lowercase(last)) .. ".*$" -- todo: make an lpeg
return f_all_match(last)
elseif first == false then
-- exact
@@ -197,7 +197,7 @@ end
local p_compare = P { "all",
all = (V("one") + V("operator") + V("nested") + C(" "))^1,
- nested = C("(") * V("all") * C(")"),
+ nested = C("(") * V("all") * C(")"), -- C really needed?
operator = C("and")
+ C("or")
+ C("not"),
@@ -216,11 +216,27 @@ local p_compare = P { "all",
range = range,
}
-local p_combine = space^0
- * (P(",")/" or ")
- * space^0
-
-local pattern = Cs((P("match")/"" * space^0 * p_compare + p_combine)^1)
+-- local p_combine = space^0 * (P(",")/" or ") * space^0
+
+-- local pattern = Cs((P("match")/"" * space^0 * p_compare + p_combine)^1)
+
+local comma = P(",")
+local p_spaces = space^0
+local p_combine = p_spaces * comma * p_spaces / " or "
+local p_expression = P("match")/"" * Cs(p_compare)
+ + Carg(1)
+ * Cc("")
+ * Cc("tag")
+ * Cc(false)
+ * (
+ P("tag") * p_spaces * P("(") * Cs((1-S(")")-space)^1) * p_spaces * P(")")
+ + p_spaces * Cs((1-space-comma)^1) * p_spaces
+ ) / test_key_value
+
+local pattern = Cs {
+ [1] = V(2) * (p_combine * V(2))^0,
+ [2] = p_expression,
+}
-- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- --
@@ -233,6 +249,14 @@ function publications.anywhere(entry,str) -- helpers
end
end
+-- todo: use an environment instead of
+
+-- table={
+-- { "match", "((kf_editor and find(kf_editor,\"^.*braslau.*$\")))" },
+-- { "hash", "foo1234" },
+-- { "tag", "bar5678" },
+-- }
+
local f_template = string.formatters[ [[
local find = string.find
local lower = characters.lower
@@ -246,46 +270,6 @@ return function(entry)
end
]] ]
------ function compile(expr,start)
--- local function compile(dataset,expr)
--- local keys = { }
--- -- local expression = lpegmatch(pattern,expr,start,keys)
--- local expression = lpegmatch(pattern,expr,1,keys)
--- if trace_match then
--- report("compiling expression: %s",expr)
--- end
--- local definitions = { }
--- local anywhere = false
--- for k, v in next, keys do
--- if k == "anywhere" then
--- anywhere = true
--- else
--- definitions[#definitions+1] = v
--- end
--- end
--- if not anywhere or #definitions == 0 then
--- report("invalid expression: %s",expr)
--- elseif trace_match then
--- for i=1,#definitions do
--- report("% 3i : %s",i,definitions[i])
--- end
--- end
--- definitions = concat(definitions,"\n")
--- local code = f_template(definitions,expression)
--- if trace_match then
--- report("generated code: %s",code)
--- end
--- code = loadstring(code)
--- if type(code) == "function" then
--- code = code()
--- if type(code) == "function" then
--- return code
--- end
--- end
--- report("invalid expression: %s",expr)
--- return false
--- end
-
local function compile(dataset,expr)
local keys = { }
-- local expression = lpegmatch(pattern,expr,start,keys)
@@ -309,11 +293,11 @@ local function compile(dataset,expr)
if trace_match then
report("generated code: %s",code)
end
- code = loadstring(code)
- if type(code) == "function" then
- code = code()
- if type(code) == "function" then
- return code
+ local finder = loadstring(code) -- use an environment
+ if type(finder) == "function" then
+ finder = finder()
+ if type(finder) == "function" then
+ return finder, code
end
end
report("invalid expression: %s",expr)
@@ -344,7 +328,8 @@ end
-- test("match(*:foo)")
-- test("match(*:*)")
-local check = P("match") -- * space^0 * Cp()
+local trigger = (P("match") + P("tag")) * p_spaces * P("(")
+local check = (1-trigger)^0 * trigger
local function finder(dataset,expression)
local found = lpegmatch(check,expression) and compile(dataset,expression) or false
@@ -373,7 +358,11 @@ function publications.search(dataset,expression)
for i=1,#ordered do
local entry = ordered[i]
if find(entry) then
- target[entry.tag] = entry
+ local tag = entry.tag
+ if not target[tag] then
+ -- we always take the first
+ target[tag] = entry
+ end
end
end
return target
diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua
index 5182e016d..18360d527 100644
--- a/tex/context/base/publ-imp-apa.lua
+++ b/tex/context/base/publ-imp-apa.lua
@@ -359,7 +359,8 @@ categories.manual = {
"address",
"subtitle", "file",
"editionset", "month", "year",
- "doi", "note", "isbn"
+ "doi", "note", "isbn",
+-- "abstract",
},
}
diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi
index 256636325..87a9c522b 100644
--- a/tex/context/base/publ-imp-apa.mkvi
+++ b/tex/context/base/publ-imp-apa.mkvi
@@ -29,12 +29,6 @@
% The APA style sorts the unnumbered rendered list by authoryear
-% Hans: should we be using or not using \c!, \s! and \v! ??
-
-% Sure: not using \c! and v! would mean that only the english interface is
-% supported and \s! saves some bytes (only within the setups). I'll deal with
-% that in the end.
-
\definebtxrendering
[apa]
[\c!specification=apa,
@@ -48,55 +42,14 @@
\c!distance=.5\emwidth,
\c!margin=3\emwidth]
-% The sameauthor feature may not be APA compliant
-% (there is nothing in the manual cited above).
-% It can be removed using the command:
-% \resetsetups [apa:list:sameauthor]
-
-% Or texdefinition?
-
-\startsetups [apa:list:sameauthor]
- \fastsetup{apa:list:sameauthor:rule}
-\stopsetups
-
-\startsetups [apa:list:sameauthor:rule]
- \blackrule
- [\c!width=\dimexpr\listparameter\c!margin-\interwordspace\relax,
- \c!height=1.5\linewidth]% are you sure you want to inconsistent with the rest? happens nowhere!
-\stopsetups
-
-\startsetups [apa:list:sameauthor:\v!empty]% it's not a space
- \kern\dimexpr\listparameter\c!margin-\interwordspace\relax
-\stopsetups
-
-\startsetups [apa:list:sameauthor:ditto] % horrible !
- \inframed
- [\c!width=\dimexpr\listparameter\c!margin-\interwordspace\relax,
- \c!frame=\v!off,
- \c!align=\v!middle]
- {\doubleprime}
-\stopsetups
-
% set ALL specific APA compliant values
-% Note that fallback is apa, default, then root
\definebtx
[apa]
- [\c!default=, % no fallback on default rendering
- \c!namesep={,\space},
- \c!lastnamesep={,\nobreakspace\textampersand\space}, % comma separated list
- \c!finalnamesep={\nobreakspace\textampersand\space}, % last of two, no comma!
- \c!firstnamesep=\space,
+ [\c!default=default,
\c!otherstext={\space\btxlabeltext{apa:others}},
- \c!juniorsep={\space},
- \c!vonsep={\space},
- \c!initialsep={\space},
- \c!surnamesep={,\space},
- \c!surnameinitialsep={,\space},
- \c!surnamefirstnamesep={,\space},
- \c!pubsep={,\space},
- \c!lastpubsep={,\space\btxlabeltext{apa:and}\space},% not btxcomma?
- \c!finalpubsep={\space\btxlabeltext{apa:and}\space}]
+ %c!journalconversion=\v!normal,
+ \c!monthconversion=\v!month]
\definebtx
[apa:list]
@@ -104,9 +57,10 @@
[\c!otherstext={,\nobreakspace\textellipsis\space},
\c!etallimit=7,
\c!etaldisplay=6,
- %c!journalconversion=\v!normal,
- \c!monthconversion=\v!month,
- \c!authorconversion=invertedshort]
+ \c!authorconversion=invertedshort,
+ \c!separator:names:2={,\space}, % aka namesep - in this namespace
+ \c!separator:names:3={,\nobreakspace\textampersand\space}, % comma separated list
+ \c!separator:names:4= {\nobreakspace\textampersand\space}] % last of two, no comma!
% The following are similar to default, but inherit from apa:list
@@ -282,18 +236,13 @@
\c!etaldisplay=1, % TODO: when 2-4, show all first time, etaldisplay subsequently...
\c!authorconversion=\v!name,
\c!sorttype=authoryear,
- \c!compress=\v!no,
- \c!inbetween=\space,
- \c!range=\endash,
- \c!left=,
- \c!middle=,
- \c!right=]
+ \c!separator:names:2={,\space},
+ \c!separator:names:3={,\space\btxlabeltext{apa:and}\space}, % not \textampersand
+ \c!separator:names:4= {\space\btxlabeltext{apa:and}\space}] % not \textampersand
\definebtx
[apa:cite:author]
[apa:cite]
- [\c!lastnamesep={,\space\btxlabeltext{apa:and}\space}, % not \textampersand
- \c!finalnamesep={\space\btxlabeltext{apa:and}\space}] % not \textampersand
% The following are similar to default, but inherit from apa:cite
@@ -303,20 +252,18 @@
[\c!compress=\v!yes,
\c!left={(},
\c!right={)},
- \c!inbetween={,\space},
- \c!pubsep={;\space},
- \c!lastpubsep={;\space},
- \c!finalpubsep={;\space}]
+ \c!inbetween={,\space}]
+
+\definebtx
+ [apa:cite:default]
+ [apa:cite:authoryear]
\definebtx
[apa:cite:authoryears]
[apa:cite:authoryear]
[\c!left=,
\c!right=,
- \c!inbetween={\space},
- \c!pubsep={;\space},
- \c!lastpubsep={;\space},
- \c!finalpubsep={;\space}]
+ \c!inbetween={\space}]
\definebtx
[apa:cite:authornum]
@@ -351,18 +298,18 @@
\definebtx
[apa:cite:year]
[apa:cite]
- [\c!pubsep={,\space},
- \c!lastpubsep={,\space\btxlabeltext{apa:and}\space}, % not \textampersand
- \c!finalpubsep={\space\btxlabeltext{apa:and}\space}, % not \textampersand
+ [\c!separator:2={,\space}, % :0 and :1 - between items of a list
+ \c!separator:3={,\space\btxlabeltext{apa:and}\space}, % not \textampersand
+ \c!separator:4= {\space\btxlabeltext{apa:and}\space}, % not \textampersand
\c!compress=\v!yes,
\c!sorttype=\v!default]
\definebtx
[apa:cite:title]
[apa:cite]
- [\c!pubsep={,\space},
- \c!lastpubsep={,\space\btxlabeltext{apa:and}\space}, % not \textampersand
- \c!finalpubsep={\space\btxlabeltext{apa:and}\space}, % not \textampersand
+ [\c!separator:2={,\space}, % :0 and :1 - between items of a list
+ \c!separator:3={,\space\btxlabeltext{apa:and}\space}, % not \textampersand
+ \c!separator:4= {\space\btxlabeltext{apa:and}\space}, % not \textampersand
\c!command={\language[\currentbtxlanguage]}, % BAH
\c!style=\v!italic]
@@ -391,9 +338,9 @@
[apa:cite]
[\c!left=,
\c!right=,
- \c!pubsep={,\space},
- \c!lastpubsep={,\space\btxlabeltext{apa:and}\space}, % not \textampersand
- \c!finalpubsep={\space\btxlabeltext{apa:and}\space}] % not \textampersand
+ [\c!separator:2={,\space}, % :0 and :1 - between items of a list
+ \c!separator:3={,\space\btxlabeltext{apa:and}\space}, % not \textampersand
+ \c!separator:4= {\space\btxlabeltext{apa:and}\space}] % not \textampersand
\definebtx
[apa:cite:pages]
@@ -441,18 +388,28 @@
[\c!compress=\v!yes,
\c!left={[},
\c!right={]},
- \c!pubsep={,},
- \c!lastpubsep={,},
- \c!finalpubsep={,}]
+ \c!separator:2={,}, % no space
+ \c!separator:3=\btxparameter{\c!separator:2},
+ \c!separator:4=\btxparameter{\c!separator:2}]
\definebtx
[apa:cite:textnum]
[apa:cite:num]
[\c!left={Ref.\nbsp},
\c!right=,
- \c!pubsep={,},
- \c!lastpubsep={\space\btxlabeltext{apa:and}\space},
- \c!finalpubsep={\space\btxlabeltext{apa:and}\space}]
+ \c!separator:2={,\space},
+ \c!separator:3={\space\btxlabeltext{apa:and}\space},
+ \c!separator:4={\space\btxlabeltext{apa:and}\space}]
+
+\definebtx
+ [apa:cite:entry]
+ [apa:cite]
+ [\c!left=,
+ \c!right=,
+ \c!inbetween={\space},
+ \c!separator:2={;\space},
+ \c!separator:3=\btxparameter{\c!separator:2},
+ \c!separator:4=\btxparameter{\c!separator:2}]
%D Sometimes we have verbose injections in an entry and these can be language
%D dependent, so we use labels.
@@ -476,10 +433,10 @@
apa:mastersthesis={Master's thesis},
apa:phdthesis={Doctoral dissertation},
apa:technicalreport={Tech. Rep.}, % Technical report
- apa:supplement={Suppl.}, % Supplement
+ apa:supplement={Suppl.}, % Supplement (not used?)
apa:patent=Patent,
apa:Author=Author,
- apa:Translator={Trans.}, % Translator(s)
+ apa:Translator={Trans.}, % Translator(s) (not used?)
apa:Advanced={Advanced online publication},
apa:Retrieved={Available from}, % {Retrieved from},
apa:In=In]
@@ -611,46 +568,6 @@
% cite setups
-% as we don't fallback on default (no sane person will render the titles
-% differently so it's a bit over the top):
-
-\startsetups btx:apa:cite:empty
- \fastsetup{\s!btx:\s!cite:\s!empty}
-\stopsetups
-\startsetups btx:apa:cite:unknown
- \fastsetup{\s!btx:\s!cite:\s!unknown}
-\stopsetups
-\startsetups btx:apa:cite:author
- \fastsetup{\s!btx:\s!cite:author}
-\stopsetups
-\startsetups btx:apa:cite:authoryear
- \fastsetup{\s!btx:\s!cite:author}
-\stopsetups
-\startsetups btx:apa:cite:authoryears
- \fastsetup{\s!btx:\s!cite:author}
-\stopsetups
-\startsetups btx:apa:cite:authornum
- \fastsetup{\s!btx:\s!cite:author}
-\stopsetups
-\startsetups btx:apa:cite:title
- \fastsetup{\s!btx:\s!cite:\s!normal}
-\stopsetups
-\startsetups btx:apa:cite:booktitle
- \fastsetup{btx:apa:cite:title}
-\stopsetups
-\startsetups btx:apa:cite:entry
- \fastsetup{\s!btx:\s!cite:\s!normal}
-\stopsetups
-\startsetups btx:apa:cite:num
- \fastsetup{\s!btx:\s!cite:range}
-\stopsetups
-\startsetups btx:apa:cite:textnum
- \fastsetup{\s!btx:\s!cite:range}
-\stopsetups
-\startsetups btx:apa:cite:year
- \fastsetup{\s!btx:\s!cite:range}
-\stopsetups
-
\startsetups btx:apa:cite:author:year
\texdefinition{\s!btx:\s!cite:concat}
\ifx\currentbtxfirst\empty
@@ -709,6 +626,35 @@
\fi
\stopsetups
+% The sameauthor feature may not be APA compliant
+% (there is nothing in the manual cited above).
+% It can be removed using the command:
+% \resetsetups [apa:list:sameauthor]
+
+% Or texdefinition?
+
+\startsetups [apa:list:sameauthor]
+ \fastsetup{apa:list:sameauthor:rule}
+\stopsetups
+
+\startsetups [apa:list:sameauthor:rule]
+ \blackrule
+ [\c!width=\dimexpr\listparameter\c!margin-\interwordspace\relax,
+ \c!height=1.5\linewidth]% are you sure you want to inconsistent with the rest? happens nowhere!
+\stopsetups
+
+\startsetups [apa:list:sameauthor:\v!empty]% it's not a space
+ \kern\dimexpr\listparameter\c!margin-\interwordspace\relax
+\stopsetups
+
+\startsetups [apa:list:sameauthor:ditto] % horrible !
+ \inframed
+ [\c!width=\dimexpr\listparameter\c!margin-\interwordspace\relax,
+ \c!frame=\v!off,
+ \c!align=\v!middle]
+ {\doubleprime}
+\stopsetups
+
%D Instead of texdefinitions without arguments, we could have used setups but in my
%D editor (hh, scite) the commands stand out better. It also saves an additional
%D component in the name (e.g. common:) because commands and setups have a different
@@ -853,7 +799,7 @@
\texdefinition{btx:apa:author-or-editor} {editor}
}
\btxspace
- \btxstartstyleandcolor[apa:list:title] % NOT :\currentbtxcategory !
+ \btxstartstyleandcolor[apa:list:title]
\texdefinition{btx:apa:composed-title} {booktitle}
\btxstopstyleandcolor
\btxperiod
@@ -917,8 +863,9 @@
}
\stoptexdefinition
+ % this could be simplified!
+
\starttexdefinition btx:apa:journal-volume-number-pages
- % this could be simplified!
\btxdoif {journal} {
\btxspace
\btxstartstyleandcolor[apa:list:journal]
@@ -1020,8 +967,9 @@
\definebreakpoint [doi][-][nleft=3,type=1]
\definebreakpoint [doi][.][nleft=3,type=1]
+% use \btxentry here?
+
\starttexdefinition btx:apa:url
- % use \btxentry here?
\btxspace
\btxlabeltext{apa:Retrieved}
\btxspace
@@ -1039,8 +987,9 @@
\endgroup
\stoptexdefinition
+% use \btxentry here?
+
\starttexdefinition btx:apa:doi
- % use \btxentry here?
\btxspace
\begingroup
\setbreakpoints[doi]
@@ -1056,8 +1005,9 @@
\endgroup
\stoptexdefinition
+% also issn - see publ-imp-apa.lua
+
\starttexdefinition btx:apa:isbn
- % also issn - see publ-imp-apa.lua
\btxdoif {isbn} {
\btxleftparenthesis
\WORD{\btxfoundname{isbn}}:\btxspace
@@ -1121,8 +1071,10 @@
% Required fields: title, year
% Optional fields: editor, publisher, subtitle, series, volume, number, month, organization, doi, url, issn, note
+% needs to be tuned...
+
\startsetups btx:apa:list:periodical
- \fastsetup{btx:apa:list:article} % needs to be tuned...
+ \fastsetup{btx:apa:list:article}
\stopsetups
% National and international standards issued by a standards body
diff --git a/tex/context/base/publ-imp-aps.lua b/tex/context/base/publ-imp-aps.lua
index 1530bc09d..c143e648b 100644
--- a/tex/context/base/publ-imp-aps.lua
+++ b/tex/context/base/publ-imp-aps.lua
@@ -30,43 +30,27 @@ local specification = {
-- vons Last, Jrs, First
-- Vons, Last, Jrs, First
--
- author = "author",
+ author = "author", -- interpreted as name(s)
editor = "author",
artist = "author",
interpreter = "author",
composer = "author",
producer = "author",
- doi = "url",
- url = "url",
- page = "pagenumber",
+ doi = "url", -- an external link
+ url = "url",
+ page = "pagenumber", -- number or range: f--t
pages = "pagenumber",
- keywords = "keyword",
+ volume = "range",
+ number = "range",
+ keywords = "keyword", -- comma|-|separated list
+ year = "number",
},
--
-- categories with their specific fields
--
categories = {
--
- -- the following fields are for documentation and testing purposes
- --
- ["demo-a"] = {
- sets = {
- author = { "author", "institution", "organization" },
- doi = { "doi", "url" },
- },
- required = { "author", "title", "year", "note", "doi" },
- optional = { "subtitle", "file" },
- },
- ["demo-b"] = {
- sets = {
- authors = { "author", "institution", "organization" },
- doi = { "doi", "url" },
- },
- required = { "authors", "title", "year", "note", "doi" },
- optional = { "subtitle", "file" },
- },
- --
- -- more categories are added below
+ -- categories are added below
--
},
}
@@ -78,7 +62,8 @@ local generic = {
-- allows the substitution of an alternate field.
--
-- note that anything can get assigned a doi or be available online.
- doi = { "doi", "url" },
+ doi = { "doi", "url" },
+ editionset = { "edition", "volume", "number", "pages" },
}
-- Note that the APS specification allows an additional field "collaboration"
@@ -90,7 +75,7 @@ local generic = {
-- all other fields will be ignored.
-- Sets contain either/or in order of precedence.
---
+--
-- For a category *not* defined here yet present in the dataset, *all* fields
-- are taken as optional. This allows for flexibility in the addition of new
-- categories.
@@ -130,7 +115,7 @@ categories.magazine = {
optional = {
"collaboration",
"subtitle", "type", "file",
- "volume",
+ "number",
"month", "day",
"doi", "note", "isbn"
},
@@ -182,16 +167,16 @@ categories.standard = {
categories.book = {
sets = {
- author = { "author", "editor", "publisher", "title" },
- edition = { "edition", "volume", "number", "pages" },
- doi = generic.doi,
+ author = { "author", "editor", "publisher", "title" },
+ editionset = generic.editionset,
+ doi = generic.doi,
},
required = { "author" },
optional = {
"collaboration",
"year", "month", "day",
"subtitle", "type", "file",
- "edition", "series",
+ "editionset", "series",
"address",
"doi", "note", "isbn"
},
@@ -201,9 +186,9 @@ categories.book = {
categories.inbook = {
sets = {
- author = { "author", "editor", "publisher", "title", "chapter" },
- edition = { "edition", "volume", "number", "pages" },
- doi = generic.doi,
+ author = { "author", "editor", "publisher", "title", },
+ editionset = generic.editionset,
+ doi = generic.doi,
},
required = {
"author",
@@ -212,64 +197,69 @@ categories.inbook = {
optional = {
"collaboration",
"subtitle", "type", "file",
- "edition", "series",
+ "booktitle",
+ -- "chapter",
+ "editionset", "series",
"month",
"address",
"doi", "note", "isbn"
},
}
--- a work that is printed and bound, but without a named publisher or sponsoring institution.
+-- a book having its own title as part of a collection.
+-- (like inbook, but we here make booktitle required)
-categories.booklet = {
+categories.incollection = {
sets = {
- author = { "author", "title" },
- doi = generic.doi,
+ author = { "author", "editor", "publisher", "title", },
+ editionset = generic.editionset,
+ doi = generic.doi,
},
required = {
- "author"
+ "author",
+ "booktitle",
+ "year",
},
optional = {
"collaboration",
- "year", "month",
"subtitle", "type", "file",
+ "editionset", "series",
+ "chapter",
+ "month",
"address",
- "howpublished",
"doi", "note", "isbn"
- },
+ },
}
--- a part of a book having its own title.
+-- a work that is printed and bound, but without a named publisher or sponsoring institution.
-categories.incollection = {
+categories.booklet = {
sets = {
- author = { "author", "editor", "publisher", "title" },
- edition = { "edition", "volume", "number", "pages" },
- doi = generic.doi,
+ author = { "author", "title", },
+ publisher = { "howpublished" }, -- no "publisher"!
+ doi = generic.doi,
},
required = {
- "author",
- "booktitle",
- "year",
+ "author"
},
optional = {
+ "publisher",
"collaboration",
+ "year", "month",
"subtitle", "type", "file",
- "month",
- "edition", "series",
- "chapter",
"address",
"doi", "note", "isbn"
- },
+ },
}
-- the proceedings of a conference.
categories.proceedings = {
sets = {
- author = { "editor", "publisher", "title" },
- edition = { "edition", "volume", "number", "pages" },
- doi = generic.doi,
+ author = { "editor", "organization", "publisher", "title" }, -- no "author"!
+ publisher = { "publisher", "organization" },
+ editionset = generic.editionset,
+ doi = generic.doi,
},
required = {
"author",
@@ -277,10 +267,11 @@ categories.proceedings = {
},
optional = {
"collaboration",
+ "publisher",
"subtitle", "file",
- "edition", "series",
+ "editionset", "series",
"month",
- "address", "organization",
+ "address",
"doi", "note", "isbn"
},
}
@@ -347,9 +338,10 @@ categories.phdthesis = categories.mastersthesis
categories.techreport = {
sets = {
- -- no "edition"!
- edition = { "type", "volume", "number", "pages" },
- doi = generic.doi,
+ author = { "author", "institution", "publisher", "title" },
+ publisher = { "publisher", "institution", },
+ editionset = { "type", "volume", "number", "pages" }, -- no "edition"!
+ doi = generic.doi,
},
required = {
"author",
@@ -359,10 +351,11 @@ categories.techreport = {
},
optional = {
"collaboration",
+ "publisher",
+ "address",
"subtitle", "file",
- "edition", -- set, not field!
+ "editionset",
"month",
- "address",
"doi", "note", "isbn"
},
}
@@ -371,18 +364,21 @@ categories.techreport = {
categories.manual = {
sets = {
- edition = { "edition", "volume", "number", "pages" },
- doi = generic.doi,
+ author = { "author", "organization", "publisher", "title" },
+ publisher = { "publisher", "organization", },
+ editionset = generic.editionset,
+ doi = generic.doi,
},
required = {
"title"
},
optional = {
+ "author", "publisher",
"collaboration",
+ "address",
"subtitle", "file",
- "author", "address", "organization",
- "edition", "month", "year",
- "doi", "note", "isbn"
+ "editionset", "month", "year",
+ "doi", "note", "isbn",
},
}
@@ -390,21 +386,26 @@ categories.manual = {
categories.patent = {
sets = {
+ author = { "author", "assignee", },
+ publisher = { "publisher", "assignee", },
+ year = { "year", "yearfiled", },
+ month = { "month", "monthfiled", },
+ day = { "day", "dayfiled", },
doi = generic.doi,
},
required = {
"nationality",
"number",
- "year", "yearfiled"
+ "year",
},
optional = {
"type",
--check this: "language",
+ "author", "publisher",
"collaboration",
- "author", "assignee",
"title", "subtitle", "file",
"address",
- "day", "dayfiled", "month", "monthfiled",
+ "day", "month",
"doi", "note"
},
}
diff --git a/tex/context/base/publ-imp-aps.mkvi b/tex/context/base/publ-imp-aps.mkvi
index dde6a289a..996f78592 100644
--- a/tex/context/base/publ-imp-aps.mkvi
+++ b/tex/context/base/publ-imp-aps.mkvi
@@ -1,10 +1,6 @@
-\endinput
-
-% todo
-
%D \module
%D [ file=publ-imp-aps,
-%D version=2013.12.12,
+%D version=2015.03.22,
%D title=APS bibliography style,
%D subtitle=Publications,
%D author=Alan Braslau and Hans Hagen,
@@ -31,105 +27,73 @@
%D }
%D \stopTEX
-% set all APS compliant values (may be redundant but we do not count on defaults.)
+\definebtxrendering
+ [aps]
+ [\c!specification=aps]
+
+\setupbtxlist
+ [aps]
+ [alternative=paragraph,
+ width=auto,
+ distance=0pt]
-\setupbtxrendering
- [sorttype=, % num ?
- numbering=yes]
+% set ALL specific APS compliant values
-\definebtxlistvariant
+\definebtx
[aps]
- [\c!namesep={,\space},
- \c!lastnamesep={,\space and\space},
- \c!finalnamesep={,\space and\space},
- \c!firstnamesep=\space,
- \c!otherstext={\space\btxlabeltext{\currentbtxspecification:others}},
- \c!juniorsep=\space,
- \c!vonsep=\space,
- \c!initialsep=\space, % between initials and lastname
- %\c!initialssep=\space, % between multiple initials % todo
- %\c!initialsterminator={.}, % todo
- \c!surnamesep={,\space},
- \c!surnameinitialsep={,\space},
- \c!surnamefirstnamesep={,\space},
+ [\c!default=default,
+ \c!otherstext={\space\btxlabeltext{aps:others}},
\c!etallimit=10,
- \c!etaldisplay=\btxlistvariantparameter\c!etallimit,
- %\c!journalconversion=\v!normal,
+ \c!etaldisplay=\btxparameter\c!etallimit,
+ %c!journalconversion=\v!normal,
\c!monthconversion=\v!month,
- \c!authorconversion=normalshort]
-
-\definebtxlistvariant
- [author]
-
-\definebtxlistvariant
- [editor]
- [author]
-
-% like \setupbtxlistvariant above but not exactly...
-
-\setupbtxcitevariant
- [\c!alternative=num,
- \c!namesep=\btxlistvariantparameter\c!namesep,
- \c!lastnamesep=\btxlistvariantparameter\c!lastnamesep,
- \c!finalnamesep={\nobreakspace\textampersand\space}, % no comma!
- \c!firstnamesep=\btxlistvariantparameter\c!firstnamesep,
- \c!otherstext=\btxlistvariantparameter\c!otherstext,
- \c!juniorsep=\btxlistvariantparameter\c!juniorsep,
- \c!vonsep=\btxlistvariantparameter\c!vonsep,
- \c!initialsep=\btxlistvariantparameter\c!initialsep,
- %\c!initialssep=\btxlistvariantparameter\c!initialssep,
- %\c!initialsterminator=\btxlistvariantparameter\c!initialsterminator,
- \c!surnamesep=\btxlistvariantparameter\c!surnamesep,
- \c!surnameinitialsep=\btxlistvariantparameter\c!surnameinitialsep,
- \c!surnamefirstnamesep=\btxlistvariantparameter\c!surnamefirstnamesep,
- \c!etallimit=\btxlistvariantparameter\c!etallimit,
- \c!etaldisplay=\btxlistvariantparameter\c!etaldisplay,
- % \c!monthconversion=\btxlistvariantparameter\c!monthconversion,
- \c!authorconversion=\btxlistvariantparameter\c!authorconversion,
- \c!interaction=\v!start,
- % \c!setups=btx:cite:initialize,
- \c!pubsep={,\space},
- \c!lastpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
- \c!finalpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
- \c!sorttype=,
- \c!compress=\v!no,
- \c!inbetween=\space,
- \c!range=\endash,
- \c!left={[},
- \c!middle=,
- \c!right={]}]
+ \c!separator:names:2={,\space},
+ \c!separator:names:3={,\space\btxlabeltext{aps:and}\space}, % not \textampersand
+ \c!separator:names:4= {\space\btxlabeltext{aps:and}\space}] % not \textampersand
+
+\definebtx
+ [aps:list]
+ [aps]
+ [\c!authorconversion=normalshort,
+ placetitle=\v!yes] % can be set to no for journal, for example.
+ % this does not work - see below? (would title=yes be acceptable?)
+
+% The following are similar to default, but inherit from aps:list
-\definebtxcitevariant
- [author]
- [\c!lastnamesep={,\nobreakspace\textampersand\space},
- \c!finalnamesep={\nobreakspace\textampersand\space}, % no comma!
- \c!authorconversion=\v!name]
-
-\definebtxcitevariant
- [authoryear]
- [\c!compress=\v!yes,
- \c!inbetween={,\space},
- \c!left={(},
- \c!right={)},
- \c!pubsep={;\space},
- \c!lastpubsep={;\space},
- \c!finalpubsep={;\space},
- \c!lastnamesep={,\space\btxlabeltext{\currentbtxspecification:and}\space},
- \c!finalnamesep={\space\btxlabeltext{\currentbtxspecification:and}\space}, % no comma!
- \c!authorconversion=\v!name]
-
-\definebtxcitevariant
- [authoryears]
- [authoryear]
- [\c!left=,
- \c!inbetween={\space(},
- \c!pubsep={);\space},
- \c!lastpubsep={);\space},
- \c!finalpubsep={);\space},
- \c!lastnamesep={,\space\btxlabeltext{\currentbtxspecification:and}\space},
- \c!finalnamesep={\space\btxlabeltext{\currentbtxspecification:and}\space}, % no comma!
- \c!authorconversion=\v!name]
+\definebtx
+ [aps:list:author]
+ [aps:list]
+\definebtx
+ [aps:list:editor]
+ [aps:list:author]
+
+\definebtx
+ [aps:list:suffix]
+ [aps:list]
+
+\definebtx
+ [aps:list:url]
+ [aps:list]
+
+\definebtx
+ [aps:list:doi]
+ [aps:list]
+
+\definebtx
+ [aps:list:invertedshort]
+ [aps:list]
+
+\definebtx
+ [aps:list:short]
+ [aps:list]
+
+% This is for numbering=yes
+\definebtx
+ [aps:list:yes]
+ [aps:list]
+ [\c!command={\high}, % also, left, right, stopper, style, color...
+ \c!align=flushright]
%D In order to be able to get journals expanded (or normalized or abbreviated) you need
%D to load a list:
@@ -138,6 +102,303 @@
%D \btxloadjournallist[journals.txt] % the jabref list
%D \stoptyping
+% TODO
+
+\definebtx
+ [aps:list:journal]
+ [\c!style=\v!italic]
+ %command=\btxexpandedjournal] % btxabbreviatedjournal
+
+\definebtx
+ [aps:list:title]
+ [\c!style=\v!italic,
+ \c!command=\Word]
+
+\definebtx
+ [aps:list:title:article]
+ [aps:list:title]
+ [\c!style=] % journal is set in italics
+
+\definebtx
+ [aps:list:title:magazine]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:newspaper]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:periodical]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:standard]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:book]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:inbook]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:incollection]
+ [aps:list:title]
+ [\c!style=] % booktitle is set in italics
+
+\definebtx
+ [aps:list:title:proceedings]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:inproceedings]
+ [aps:list:title]
+ [\c!style=] % booktitle is set in italics
+
+\definebtx
+ [aps:list:title:conference]
+ [aps:list:title]
+ [\c!style=] % booktitle is set in italics
+
+\definebtx
+ [aps:list:title:thesis]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:phdthesis]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:mastersthesis]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:booklet]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:manual]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:techreport]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:unpublished]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:patent]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:electronic]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:other]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:misc]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:title:literal]
+ [aps:list:title]
+
+\definebtx
+ [aps:list:type]
+ [\c!command=\Word]
+
+% We define [page] settings in the aps namespace, inheriting the root
+% settings, in order to eventually allow for modifications without touching
+% root.
+
+\definebtx
+ [aps:page]
+ [\s!page]
+
+\definebtx
+ [aps:page:list]
+ [aps:page]
+ [\c!command={\wordright}]
+
+\definebtx
+ [aps:cite]
+ [aps:list]
+ [\c!authorconversion=\v!name]
+
+\definebtx
+ [aps:cite:author]
+ [aps:cite]
+
+% The following are similar to default, but inherit from aps:cite
+
+\definebtx
+ [aps:cite:authoryear]
+ [aps:cite:author]
+ [\c!compress=\v!yes,
+ \c!left={(},
+ \c!right={)},
+ \c!inbetween={,\space}]
+
+\definebtx
+ [aps:cite:authoryears]
+ [aps:cite:authoryear]
+ [\c!left=,
+ \c!right=,
+ \c!inbetween={\space}]
+
+\definebtx
+ [aps:cite:authornum]
+ [aps:cite:author]
+ [\c!left={(},
+ \c!right={)},
+ \c!sorttype=authornum]
+
+\definebtx
+ [aps:cite:authorref]
+ [aps:cite:authornum]
+
+\definebtx
+ [aps:cite:author:num] % todo
+ [aps:cite:authornum]
+ [\c!left={[},
+ \c!right={]}]
+
+\definebtx
+ [aps:cite:author:year] % todo
+ [aps:cite:authoryear]
+ [\c!left=,
+ \c!right=]
+
+\definebtx
+ [aps:cite:author:years] % todo
+ [aps:cite:authoryears]
+ [\c!inbetween=,
+ \c!left=(,
+ \c!right=)]
+
+\definebtx
+ [aps:cite:year]
+ [aps:cite]
+ [\c!compress=\v!yes]
+
+\definebtx
+ [aps:cite:title]
+ [aps:cite]
+ [\c!command={\language[\currentbtxlanguage]}, % BAH
+ \c!style=\v!italic]
+
+\definebtx
+ [aps:cite:booktitle]
+ [aps:cite:title]
+
+\definebtx
+ [aps:cite:tag]
+ [aps:cite]
+ [\c!left={[},
+ \c!right={]}]
+
+\definebtx
+ [aps:cite:key]
+ [aps:cite:tag]
+
+\definebtx
+ [aps:cite:serial]
+ [aps:cite]
+ [\c!left={[},
+ \c!right={]}]
+
+\definebtx
+ [aps:cite:page]
+ [aps:cite]
+ [\c!left=,
+ \c!right=,
+ [\c!separator:2={,\space}, % :0 and :1 - between items of a list
+ \c!separator:3={,\space\btxlabeltext{aps:and}\space}, % not \textampersand
+ \c!separator:4= {\space\btxlabeltext{aps:and}\space}] % not \textampersand
+
+\definebtx
+ [aps:cite:pages]
+ [aps:cite:page]
+
+\definebtx
+ [aps:cite:keywords]
+ [aps:cite]
+ [\c!left={(},
+ \c!right={)}]
+
+\definebtx
+ [aps:cite:invertedshort]
+ [aps:cite]
+
+\definebtx
+ [aps:cite:short]
+ [aps:cite]
+ [\c!left={[},
+ \c!right={]}]
+
+\definebtx
+ [aps:cite:category]
+ [aps:cite]
+ [\c!left={[},
+ \c!right={]}]
+
+\definebtx
+ [aps:cite:type]
+ [aps:cite:category]
+
+\definebtx
+ [aps:cite:url]
+ [aps:cite]
+ [\c!left={[},
+ \c!right={]}]
+
+\definebtx
+ [aps:cite:doi]
+ [aps:cite:url]
+
+\definebtx
+ [aps:cite:num]
+ [aps:cite]
+ [\c!compress=\v!yes,
+ \c!left={[},
+ \c!right={]},
+ %\c!left=, % TODO: PRB uses superscript references...
+ %\c!right=, % and after punctuation, PRA, C, D, E, and L are before!
+ %\c!command={\high},
+ \c!separator:2={,}, % no space
+ \c!separator:3=\btxparameter{\c!separator:2},
+ \c!separator:4=\btxparameter{\c!separator:2}]
+
+\definebtx
+ [aps:cite:default]
+ [aps:cite:num]
+
+\definebtx
+ [aps:cite:textnum]
+ [aps:cite:num]
+ [\c!left={Ref.\nbsp},
+ \c!command=,
+ \c!separator:2={,\space},
+ \c!separator:3={\space\btxlabeltext{aps:and}\space},
+ \c!separator:4={\space\btxlabeltext{aps:and}\space}]
+
+\definebtx
+ [aps:cite:entry]
+ [aps:cite]
+ [\c!left=,
+ \c!right=,
+ \c!inbetween={\space},
+ \c!separator:2={;\space},
+ \c!separator:3=\btxparameter{\c!separator:2},
+ \c!separator:4=\btxparameter{\c!separator:2}]
+
%D Sometimes we have verbose injections in an entry and these can be language
%D dependent, so we use labels.
%D
@@ -146,222 +407,332 @@
\setupbtxlabeltext
[en]
- [aps:mastersthesis={Master's thesis},
- aps:phdthesis={PhD thesis},
+ [aps:and=and,
+ aps:number={no.},
+ aps:edition={ed.},
+ aps:Editor={Ed.},
+ aps:Editors={Eds.},
+ aps:Volume={Vol.},
+ aps:Volumes={Vols.},
+ aps:others={et al.},
+ aps:page={p.},
+ aps:pages={pp.},
+ aps:mastersthesis={Master's thesis},
+ aps:phdthesis={Doctoral dissertation},
aps:technicalreport={Tech. Rep.}, % Technical report
- aps:supplement={Suppl.}, % Supplement
+ aps:supplement={Suppl.}, % Supplement (not used?)
aps:patent=Patent,
- aps:Translator={Trans.}, % Translator(s)
- aps:Editor={Ed.}, % Editor
- aps:Editors={Eds.}, % Editors
- aps:edition={ed.}, % edition
- aps:volume=volume, % used?
- aps:Volume={Vol.}, % Volume
- aps:Volumes={Vols.}, % Volumes
- aps:number=number,
- aps:Number={No.}, % Number
- aps:nd={n.d.}, % no date
- aps:in=in,
- aps:of=of,
- aps:In=In,
- aps:Part={Pt.}, % Part
- aps:p={p.},
- aps:pp={pp.},
- aps:pages=pages,
- aps:and=and,
- aps:period={. },
aps:Author=Author,
- aps:Reference={Ref.},
- aps:References={Refs.},
- aps:Advanced={to be published},
+ aps:Translator={Trans.}, % Translator(s) (not used?)
+ aps:inpress={in press},
+ aps:tobe={to be published},
+ aps:unpublished={unpublished},
+ aps:Advanced={Advanced online publication},
aps:Retrieved={Available from}, % {Retrieved from},
- aps:others={\it et al.}]
+ aps:In=In]
+
+% Check this (google translate!!):
+
+\setupbtxlabeltext
+ [nl]
+ [aps:and=en,
+ aps:number={nr.},
+ aps:edition={ed.}, % editie
+ aps:Editor=Editor, % Ed./Eds.
+ aps:Editors=Editors,
+ aps:Volume={Vol.},
+ aps:Volumes={Vols.},
+ aps:others={et al.},
+ aps:page={p.},
+ aps:pages={pp.},
+ aps:mastersthesis=Masterproef,
+ aps:phdthesis=Proefschrift,
+ aps:technicalreport={Technisch rapport}, % Technical report
+ aps:supplement=Supplement,
+ aps:patent=Octrooi,
+ aps:Author=Auteur,
+ aps:Translator=Vertaler,
+ aps:inpress={in press}, % CHECK THESE!
+ aps:tobe={worden gepubliceerd},
+ aps:unpublished={onuitgegeven},
+ aps:Advanced={Geavanceerde online publicatie},
+ aps:Retrieved={Beschikbaar vanaf}, % {Ontvangen van},
+ aps:In=In]
\setupbtxlabeltext
[fr]
- [aps:mastersthesis={Thèse de master (DEA, DESS, master)},
- aps:phdthesis={Thèse de doctorat},
- aps:technicalreport={Rapport technique},
- aps:supplement=Supplément,
- aps:patent=Brevet,
- aps:Translator=Traducteur,
+ [aps:and=et,
+ aps:others={et al.},
+ aps:number={n\high{o}},
+ aps:edition={édition},
aps:Editor=Éditeur,
aps:Editors=Éditeurs,
- aps:edition=édition,
- aps:volume=volume,
aps:Volume=Volume,
aps:Volumes=Volumes,
- aps:number=numéro,
- aps:Number=Numéro,
- aps:nd={s.d.} % sans date
- aps:in=dans,
- aps:of=de,
- aps:In=Dans,
- aps:Part=Partie,
- aps:p={p.},
- aps:pp={pp.},
- aps:pages=pages,
- aps:and=et,
- aps:period={. },
+ aps:others={et al.},
+ aps:page={p.},
+ aps:pages={pp.},
+ aps:mastersthesis={Thèse de master (DEA, DESS, master)},
+ aps:phdthesis={Thèse de doctorat},
+ aps:technicalreport={Rapport technique},
+ aps:supplement=Supplément,
+ aps:patent=Brevet,
aps:Author=Auteur,
- aps:Reference={Réf.},
- aps:References={Réfs.},
- aps:Advanced={à être publié},
+ aps:Translator=Traducteur,
+ aps:inpress={sous impression},
+ aps:tobe={à paraître},
+ aps:unpublished={inédit}, % pour un livre
+ aps:Advanced={Publication en ligne anticipée},
aps:Retrieved={Disponible à}, % {Téléchargé de},
- aps:others={\it et al.}]
+ aps:In=Dans]
\setupbtxlabeltext
[de]
- [aps:mastersthesis={Masterarbeit},
+ [aps:and=und,
+ aps:number={nr.},
+ aps:edition=Auf\/lage,
+ aps:Editor=Herausgeber, % Hrsg./Hg.
+ aps:Editors=Herausgeber,
+ aps:Volume=Band, % Bd.
+ aps:Volumes={Bände},
+ aps:others={et al.},
+ aps:page={S.},
+ aps:pages={S.},
+ aps:mastersthesis={Masterarbeit},
aps:phdthesis={Dissertation},
aps:technicalreport={Technischer Bericht},
aps:supplement={Beilage}, % Supplement
aps:patent=Patent,
- aps:Translator={Übersetzer}, % Übers.
- aps:Editor=Herausgeber, % Hrsg./Hg.
- aps:Editors=Herausgeber,
- aps:edition=Auf\/lage,
- aps:volume=Band, % Bd.
- aps:Volume=Band,
- aps:Volumes={Bände},
- aps:number=Nummer,
- aps:Number={Nr.},
- aps:nd={o.D.}, % ohne Datum (mostly: o.J. / ohne Jahr)
- aps:in=in,
- aps:of=von,
- aps:In=In,
- aps:Part=Teil,
- aps:p={S.},
- aps:pp={S.},
- aps:pages=Seiten,
- aps:and=und,
- aps:period={. },
aps:Author=Autor,
- aps:Reference={Ref.},
- aps:References={Ref.},
- aps:Advanced={veröffentlicht werden},
+ aps:Translator={Übersetzer}, % Übers.
+ aps:inpress={in der Presse}, % CHECK THESE!
+ aps:tobe={veröffentlicht werden},
+ aps:unpublished={unveröffentlicht},
+ aps:Advanced={Erweiterte Online-Publikation},
aps:Retrieved={heruntergeladen von},
- aps:others={\it et al.}]
+ aps:In=In]
% thanks: Andrea Valle
\setupbtxlabeltext
[it]
- [aps:mastersthesis={Tesi di laurea},
+ [aps:and=e,
+ aps:number={nº},
+ aps:edition={ed.}, % edizione
+ aps:Editor={A cura di},
+ aps:Editors={A cura di},
+ aps:Volume={Vol.}, % Volume
+ aps:Volumes={Vol.}, % Volumi
+ aps:others={et al.},
+ aps:page={p.},
+ aps:pages={pp.},
+ aps:mastersthesis={Tesi di laurea},
aps:phdthesis={Tesi di dottorato},
aps:technicalreport={Relazione tecnica},
aps:supplement={Supplemento},
aps:patent=Brevetto,
- aps:Translator={Trad.}, % Translator(s)
- aps:Editor={A cura di},
- aps:Editors={A cura di},
- aps:edition={ed.},
- aps:volume=volume,
- aps:Volume={Vol.},
- aps:Volumes={Vol.},
- aps:number=numero,
- aps:Number=Numero,
- aps:nd={s.d.},
- aps:in=in,
- aps:of=di,
- aps:In=In,
- aps:Part=Parte,
- aps:p={p.},
- aps:pp={pp.},
- aps:pages=pagine,
- aps:and=e,
- aps:period={. },
aps:Author=Autore,
- aps:Reference={Rif.},
- aps:References={Rif.},
- aps:Advanced={da pubblicare},
+ aps:Translator={Trad.}, % Translator(s)
+ aps:inpress={in press}, % CHECK THESE!
+ aps:tobe={da pubblicare},
+ aps:unpublished={inedito},
+ aps:Advanced={Pre-pubblicazione on line},
aps:Retrieved={Accessible online},
- aps:others={\it et al.}]
+ aps:In=In]
-%D Instead of texdefinitions without arguments, we could have used setups but in my
-%D editor (hh, scite) the commands stand out better. It also saves an additional
-%D component in the name (e.g. common:) because commands and setups have a different
-%D namespace, so similar calls don't clash. Performance of definitions is somewhat
-%D better.
+\setupbtxlabeltext
+ [es]
+ [aps:and=y,
+ aps:number={nº},
+ aps:edition={ed.}, % edición
+ aps:Editor=Editor, % Ed./Eds.
+ aps:Editors=Editores,
+ aps:Volume={Vol.}, % Volumen
+ aps:Volumes={Vols.}, % Volúmenes
+ aps:others={et al.},
+ aps:page={p.},
+ aps:pages={pp.},
+ aps:mastersthesis={Tesis de maestría},
+ aps:phdthesis={Tesis doctoral},
+ aps:technicalreport={Informe técnico},
+ aps:supplement=Suplemento,
+ aps:patent=Patente,
+ aps:Author=Autor,
+ aps:Translator=Traductor,
+ aps:inpress={en prensa}, % CHECK THESE!
+ aps:tobe={que se publicará},
+ aps:unpublished={inédito},
+ aps:Advanced={Publicación en línea avanzada},
+ aps:Retrieved={Disponible desde}, % {Obtenido de},
+ aps:In=En]
+
+% cite setups
+
+\startsetups btx:aps:nd
+ \doifelse {\currentbtxcategory} {journal} {
+ \btxlabeltext{aps:tobe}
+ } {
+ \doifelse {\currentbtxcategory} {book} {
+ \btxlabeltext{aps:inpress}
+ } {
+ \btxlabeltext{aps:unpublished}
+ }
+ }
+\stopsetups
-%D \btxdoif... and \btxflush rely on the definitions in publ-imp-aps.lua:
-%D fields that are not listed as required nor optional are IGNORED.
+\startsetups btx:aps:cite:author:year
+ \texdefinition{\s!btx:\s!cite:concat}
+ \ifx\currentbtxfirst\empty
+ \fastsetup{btx:aps:nd}
+ \else
+ \texdefinition {\s!btx:\s!cite:inject} {
+ \btxcitereference
+ \currentbtxfirst
+ }
+ \ifx\currentbtxsecond\empty \else
+ \btxparameter\v!inbetween
+ \texdefinition {\s!btx:\s!cite:inject} {
+ \currentbtxsecond
+ }
+ \fi
+ \ifx\currentbtxthird\empty \else
+ \texdefinition {\s!btx:\s!cite:inject} {
+ \currentbtxthird
+ }
+ \fi
+ \fi
+\stopsetups
-% First some helpers:
+\startsetups btx:aps:cite:author:years
+ \fastsetup{btx:aps:cite:author:year}
+\stopsetups
-\starttexdefinition btx:aps:inject #link #content
+\startsetups [btx:aps:page:list]
+ \fastsetup{\s!btx:\s!page:concat}
+ \ifx\currentbtxlastpage\empty
+ \btxlabeltext{aps:page}
+ \else
+ \btxlabeltext{aps:pages}
+ \fi
+ \btxnbsp
\ifconditional\btxinteractive
- \ifx\currentbtxinternal\empty
- #content
- \else
+ \goto {
+ \currentbtxfirstpage
+ } [
+ internal(\currentbtxfirstinternal)
+ ]
+ \ifx\currentbtxlastpage\empty \else
+ \btxparameter\c!pageconnector
\goto {
- #content
+ \currentbtxlastpage
} [
- #link
+ internal(\currentbtxlastinternal)
]
\fi
\else
- #content
+ \currentbtxfirstpage
+ \ifx\currentbtxlastpage\empty \else
+ \btxparameter\c!pageconnector
+ \currentbtxlastpage
+ \fi
\fi
-\stoptexdefinition
+\stopsetups
-\starttexdefinition btx:aps:title
- \btxdoif {file} {
- % we make the title active, opening file
- \texdefinition{btx:aps:inject} {url(file:\btxflush{file})}
- }
- {
- \begingroup
- \it
- \btxflush{Word -> title}
- \btxdoif {subtitle} {
+%D Instead of texdefinitions without arguments, we could have used setups but in my
+%D editor (hh, scite) the commands stand out better. It also saves an additional
+%D component in the name (e.g. common:) because commands and setups have a different
+%D namespace, so similar calls don't clash. Performance of definitions is somewhat
+%D better.
+
+%D We use "texdefinitions" (with eventual arguments) for helpers that are used
+%D in the rendering "setups" defined for each category below.
+
+%D Note that \btxdoif... and \btxflush rely on the definitions in
+%D publ-imp-aps.lua: fields that are not listed as required nor optional are
+%D IGNORED. We also make heavy use of the notion of sets - comma-separated lists
+%D of alternative fields to be used in hierarchal order. For example:
+%D author = { "author", "editor", "publisher", "title" }, will return the
+%D author field if it exists; if not, the editor field will be returned, if it
+%D exists; if not, the publisher field will be returned, if it exists; if not,
+%D the title field will be returned, it it exists; if not, nothing will be
+%D returned. In lua syntax, it can be understood as
+%D author or editor or publisher or title or ""
+
+\starttexdefinition btx:aps:composed-title #title
+ \begingroup
+ \language[\currentbtxlanguage]
+ \btxusecommand[aps:list:title:\currentbtxcategory] {
+ \btxflush{#title}
+ \btxdoif {sub#title} {
\btxcolon
- \btxflush{Word -> subtitle}
- }
- \italiccorrection
- \endgroup
- \doifnot {\currentbtxcategory} {techreport} {
- \doifnotmode {btx:aps:thesis} {
- \btxdoif{type} {
- \btxleftbracket
- \btxflush{Word -> type}
- \btxrightbracket
- }
+ \btxflush{sub#title}
}
}
- }
+ \endgroup
\stoptexdefinition
-% need for a global option to activate or inhibit....
+\starttexdefinition btx:aps:title
+ \setmode{btx:aps:title-placed}
+ % we make the title active, opening file
+ \btxdoifelse {file} {
+ \texdefinition{btx:format:inject}
+ {url(file:\btxflush{file})}
+ {
+ \btxstartstyleandcolor [aps:list:title:\currentbtxcategory]
+ \texdefinition{btx:aps:composed-title}{title}
+ \btxstopstyleandcolor
+ }
+ } {
+ \btxstartstyleandcolor [aps:list:title:\currentbtxcategory]
+ \texdefinition{btx:aps:composed-title}{title}
+ \btxstopstyleandcolor
+ }
+\stoptexdefinition
-\starttexdefinition btx:aps:optional-title
- \btxdoif {title} {
- \btxdoif {file} {
- % we make the title active, opening file
- \texdefinition{btx:aps:inject} {url(file:\btxflush{file})}
- }
- {
- \quotation{%
- \btxflush{Word -> title}
- \btxdoif {subtitle} {
- \btxcolon
- \btxflush{Word -> subtitle}
- }
+\starttexdefinition btx:aps:title-if-not-placed
+ \doifmodeelse {btx:aps:title-placed} {
+ \resetmode{btx:aps:title-placed}
+ } {
+ %does not work (need to check the setting)
+ %\doifelse{\btxparameter{placetitle}}\v!yes {
+ \btxdoif {title} {
+ \texdefinition {btx:aps:title}
+ \btxcomma
}
- \btxcomma
- }
+ %}
}
\stoptexdefinition
-\starttexdefinition btx:aps:editor
- \btxflush{editor}
- \btxleftparenthesis
- \btxsingularorplural {editor} {
- \btxlabeltext{aps:Editor}
+\starttexdefinition btx:aps:year
+ \btxdoifelse {year} {
+ \btxflush{year}
} {
- \btxlabeltext{aps:Editors}
+ \fastsetup{btx:aps:nd}
+ }
+\stoptexdefinition
+
+%\starttexdefinition btx:aps:suffixedyear
+% \btxdoifelse {year} {
+% \btxflush{year}
+% \btxflush{suffix}
+% } {
+% \fastsetup{btx:aps:nd}
+% }
+%\stoptexdefinition
+
+\starttexdefinition btx:aps:author-or-editor #author
+ \btxdoif {#author} {
+ \btxflush{#author}
+ \doif {\btxfoundname{#author}} {editor} {
+ \btxleftparenthesis
+ \btxsingularorplural {editor} {
+ \btxlabeltext{aps:Editor}
+ } {
+ \btxlabeltext{aps:Editors}
+ }
+ \btxrightparenthesisperiod
+ }
}
- \btxrightparenthesisperiod
\stoptexdefinition
\starttexdefinition btx:aps:author
@@ -375,98 +746,137 @@
}
\stoptexdefinition
-\starttexdefinition btx:aps:italic #field
- \begingroup
- \it
- \btxflush{#field}
- \italiccorrection
- \endgroup
-\stoptexdefinition
-
-\starttexdefinition btx:aps:bold #field
- \begingroup
- \bf
- \btxflush{#field}
- \endgroup
-\stoptexdefinition
-
-\starttexdefinition btx:aps:editor-in- #title
- \btxdoifelse {editor} {
+\starttexdefinition btx:aps:editor-in
+ \btxdoif {booktitle} {
\btxlabeltext{aps:In}
- \btxspace
- \texdefinition{btx:aps:editor}
- \btxdoif {#title} {
- \texdefinition{btx:aps:italic}{Word -> #title}
- }
- } {
- \btxdoif {#title} {
- \btxlabeltext{aps:In}
+ \doifnot {\btxfoundname{author}} {editor} {
\btxspace
- \texdefinition{btx:aps:italic}{Word -> #title}
+ \texdefinition{btx:aps:author-or-editor} {editor}
}
+ \btxspace
+ \btxstartstyleandcolor[aps:list:title]
+ \texdefinition{btx:aps:composed-title} {booktitle}
+ \btxstopstyleandcolor
+ \btxcomma
}
\stoptexdefinition
\starttexdefinition btx:aps:editionset
- \btxdoifelse {edition} {
- \btxspace
- \doif {\currentbtxcategory} {techreport} {
- \btxdoifelse {type} {
- \btxflush{Word -> type}
- } {
- \btxlabeltext{aps:technicalreport}
- }
- \setmode{btx:aps:comma}
- }
- \doif {\btxfoundname{edition}} {edition} {
- \doifmode {btx:aps:comma}
- {\btxcomma}
- \btxflush{edition}
- \btxspace
- \btxlabeltext{aps:edition}
- \setmode{btx:aps:comma}
- }
- \btxdoif {volume} {
- \doifmode {btx:aps:comma}
- {\btxcomma}
- \btxoneorrange {volume} {
- \btxlabeltext{aps:Volume}
- } {
- \btxlabeltext{aps:Volumes}
+ \doif {\currentbtxcategory} {techreport} {
+ \btxdoifelse {type} {
+ \btxusecommand[aps:list:type] {
+ \btxflush{type}
}
- \btxspace
- \btxflush{volume}
- \setmode{btx:aps:comma}
- }
- \btxdoif {number} {
- \doifmode {btx:aps:comma}
- {\btxcomma}
- \btxlabeltext{aps:Number}
- \btxspace
- \btxflush{number}
- \setmode{btx:aps:comma}
+ } {
+ \btxlabeltext{aps:technicalreport}
}
- \btxdoif {pages} {
- \doifmode {btx:aps:comma}
- {\btxcomma}
- \btxoneorrange {pages} {
- \btxlabeltext{aps:p}
- } {
- \btxlabeltext{aps:pp}
- }
- \btxspace
- \btxflush{pages}
+ \btxcomma
+ }
+ \btxdoif {volume} {
+ \btxoneorrange {volume} {
+ \btxlabeltext{aps:Volume}
+ } {
+ \btxlabeltext{aps:Volumes}
}
- \btxperiod
- } {
- \doif {\currentbtxcategory} {techreport} {
- \btxleftparenthesis
- \btxlabeltext{aps:technicalreport}
- \btxrightparenthesisperiod
+ \btxspace
+ \btxflush{volume}
+ \btxcomma
+ }
+ \btxdoif {number} {
+ \btxlabeltext{aps:number}
+ \btxspace
+ \btxflush{number}
+ \btxcomma
+ }
+ \btxdoif {edition} {
+ \btxflush{edition}
+ \btxspace
+ \btxlabeltext{aps:edition}
+ \btxcomma
+ }
+ \btxdoif {pages} {
+ \btxoneorrange {pages} {
+ \btxlabeltext{aps:page}
+ } {
+ \btxlabeltext{aps:pages}
}
+ \btxnbsp
+ \btxflush{pages}
+ \btxcomma
}
\stoptexdefinition
+%% this could be simplified!
+%\starttexdefinition btx:aps:journal-volume-number-pages
+% \btxdoif {journal} {
+% \btxspace
+% \btxstartstyleandcolor[aps:list:journal]
+% \btxusecommand[aps:list:journal] {
+% \btxflush{journal}
+% }
+% \btxstopstyleandcolor
+% \btxdoif {volume} {
+% \btxcomma
+% \btxstartstyleandcolor[aps:list:journal]
+% \btxflush{volume}
+% \btxstopstyleandcolor
+% \btxdoifnot {number} {
+% \btxdoifelse {pages}
+% {\btxcomma}
+% {\btxperiod}
+% }
+% }
+% \btxdoif {number} {
+% \btxdoifelse {volume} {
+% \removeunwantedspaces(
+% } {
+% \btxcomma
+% \btxleftparenthesis
+% }
+% \btxflush{number}
+% \btxdoifelse {pages}
+% {\btxrightparenthesiscomma}
+% {\btxrightparenthesisperiod}
+% }
+% \btxdoif {pages} {
+% \btxdoifnot {volume} {
+% \btxdoifnot {number} {
+% \btxcomma
+% }
+% }
+% \doif {\currentbtxcategory} {newspaper} {
+% \btxoneorrange {pages} {
+% \btxlabeltext{aps:page}
+% } {
+% \btxlabeltext{aps:pages}
+% }
+% \btxnbsp
+% }
+% \btxflush{pages}
+% \btxperiod
+% }
+% \doifnot {\currentbtxcategory} {newspaper} {
+% \btxdoifnot {volume} {
+% \btxdoifnot {number} {
+% \btxdoifnot {pages} {
+% \btxdoifelse {doi} {
+% \btxperiod
+% \btxlabeltext{aps:Advanced}
+% \btxperiod
+% } {
+% \btxdoif {url} {
+% \btxperiod
+% \btxlabeltext{aps:Advanced}
+% \btxperiod
+% }
+% }
+% }
+% }
+% }
+% }
+% }
+%\stoptexdefinition
+
\starttexdefinition btx:aps:journal-volumeset-year
\btxdoif {journal} {
% expandedjournal abbreviatedjournal
@@ -492,24 +902,44 @@
\btxflush{pages}
}
\btxleftparenthesis
- \btxdoifelse {year} {
- \btxflush{year}
- } {
- \btxlabeltext{aps:Advanced}
- }
+ \fastsetup{btx:aps:year}
\btxrightparenthesis
\btxperiod
}
\stoptexdefinition
+\starttexdefinition btx:aps:publisher-wherefrom-year
+ \removeunwantedspaces
+ \removepunctuation
+ \btxleftparenthesis
+ \btxflush{publisher}
+ \btxdoifelse {address} {
+ \btxdoif {publisher} {
+ \btxcomma
+ }
+ \btxflush{address}
+ \btxdoif {country} {
+ \btxcomma
+ \btxflush{country}
+ }
+ \btxcomma
+ } {
+ \btxdoif {publisher} {
+ \btxcomma
+ }
+ }
+ \fastsetup{btx:aps:year}
+ \btxrightparenthesis
+\stoptexdefinition
+
\definebreakpoints[doi]
\definebreakpoint [doi][:][nleft=3,type=1]
\definebreakpoint [doi][/][nleft=3,type=1]
\definebreakpoint [doi][-][nleft=3,type=1]
\definebreakpoint [doi][.][nleft=3,type=1]
+% use \btxentry here?
\starttexdefinition btx:aps:url
- % use \btxentry here?
\btxspace
\btxlabeltext{aps:Retrieved}
\btxspace
@@ -527,8 +957,8 @@
\endgroup
\stoptexdefinition
+% use \btxentry here?
\starttexdefinition btx:aps:doi
- % use \btxentry here?
\btxspace
\begingroup
\setbreakpoints[doi]
@@ -544,143 +974,128 @@
\endgroup
\stoptexdefinition
+% also issn - see publ-imp-aps.lua
\starttexdefinition btx:aps:isbn
- % also issn - see publ-imp-aps.lua
\btxdoif {isbn} {
\btxleftparenthesis
\WORD{\btxfoundname{isbn}}:\btxspace
+ \setbreakpoints[doi]
\btxflush{isbn}
\btxrightparenthesis
}
\stoptexdefinition
\starttexdefinition btx:aps:note
- % grouping could indeed be useful for note.
\btxdoif {note} {
- \btxspace
- {\btxflush{note}}
+ \btxleftparenthesis
+ \btxflush{note}
+ \btxrightparenthesis
}
\stoptexdefinition
-\starttexdefinition btx:aps:url-note-doi
+\starttexdefinition btx:aps:url-doi-note
\doif {\btxfoundname{doi}} {url} {
\texdefinition{btx:aps:url}
}
\texdefinition{btx:aps:isbn}
- \texdefinition{btx:aps:note}
\doif {\btxfoundname{doi}} {doi} {
\texdefinition{btx:aps:doi}
}
+ \texdefinition{btx:aps:note}
\removeunwantedspaces
\stoptexdefinition
-\starttexdefinition btx:aps:publisher-wherefrom-year
- \btxleftparenthesis
- \btxflush{publisher}
- \btxdoifelse {address} {
- \btxdoif {publisher} {
- \btxcomma
- }
- \btxflush{address}
- \btxdoif {country} {
- \btxcomma
- \btxflush{country}
- }
- \btxcomma
- } {
- \btxdoif {publisher} {
- \btxcomma
- }
- }
- \btxdoifelse {year} {
- \btxflush{year}
- } {
- \btxlabeltext{aps:Advanced}
- }
- \btxrightparenthesis
-\stoptexdefinition
-
-% Then by category
+% Then setups, by category
% An article from a journal
% Required fields: author or editor or title, journal, (year).
% Optional fields: volume, number, pages, type, doi, url, note.
% Note that bibtex (and tools) do not include editor (e.g. special issue or section)
-\startsetups btx:aps:article
+\startsetups btx:aps:list:article
\texdefinition{btx:aps:author}
- \texdefinition{btx:aps:optional-title}
+ \texdefinition{btx:aps:title-if-not-placed}
\texdefinition{btx:aps:journal-volumeset-year}
\texdefinition{btx:aps:url-note-doi}
\stopsetups
% An article from a magazine.
% Required fields: author or title, journal, (year).
-% Optional fields: volume, number, pages, type, month, day, doi, url, note.
+% Optional fields: number, pages, type, month, day, doi, url, note.
-\startsetups btx:aps:magazine
- \texdefinition{btx:aps:author}
- \texdefinition{btx:aps:optional-title}
- \texdefinition{btx:aps:journal-volumeset-year}
- \texdefinition{btx:aps:url-note-doi}
+\startsetups btx:aps:list:magazine
+ \fastsetup{btx:aps:list:article}
\stopsetups
% An article from a newspaper.
% Required fields: author or title, journal, (year).
% Optional fields: volume, number, pages, type, month, day, doi, url, note.
-\startsetups btx:aps:newspaper
+\startsetups btx:aps:list:newspaper
+ \fastsetup{btx:aps:list:article}
+\stopsetups
+
+% A complete issue of a periodical, such as a special issue of a journal.
+% Required fields: title, year
+% Optional fields: editor, publisher, subtitle, series, volume, number, month, organization, doi, url, issn, note
+
+% needs to be tuned...
+\startsetups btx:aps:list:periodical
+ \fastsetup{btx:aps:list:article}
+\stopsetups
+
+% National and international standards issued by a standards body
+% Required fields: author, institution, or organization, year, title
+% Optional fields: subtitle, doi, url, note
+
+\startsetups btx:aps:list:standard
\texdefinition{btx:aps:author}
- \texdefinition{btx:aps:optional-title}
- \texdefinition{btx:aps:journal-volumeset-year}
- \texdefinition{btx:aps:url-note-doi}
+ \texdefinition{btx:aps:title-if-not-placed}
+ \texdefinition{btx:aps:url-doi-note}
\stopsetups
+% year?
% A book with an explicit publisher.
% Required fields: author or editor or publisher, title, (year).
% Optional fields: volume or number, series, address, edition, month, day, note.
+% APS? ignores: month, day
% todo: series?
-\startsetups btx:aps:book
+\startsetups btx:aps:list:book
\texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:title-if-not-placed}
\texdefinition{btx:aps:editionset}
- \texdefinition{btx:aps:url-note-doi}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-doi-note}
\stopsetups
+% There is some debate about how inbook should differ from incollection
+
% A part of a book, which may be a chapter (or section or whatever) and/or a range of pages.
+% (note that inbook is handled differently by bibtex and biblatex)
% Required fields: author or editor, title, chapter and/or pages, publisher, year.
% Optional fields: volume or number, series, type, address, edition, month, note.
+% We add optional: booktitle.
+% APS? ignores: chapter, month
-% todo: series?
-
-\startsetups btx:aps:inbook
+\startsetups btx:aps:list:inbook
\texdefinition{btx:aps:author}
- \btxdoif {chapter} {
- \btxflush{Word -> chapter}
- \btxspace
- }
- \texdefinition{btx:aps:editor-in-}{title}
- \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:title-if-not-placed}
+ \texdefinition{btx:aps:editor-in}
\texdefinition{btx:aps:editionset}
- \texdefinition{btx:aps:url-note-doi}
+ \texdefinition{btx:aps:publisher-wherefrom-year}
+ \texdefinition{btx:aps:url-doi-note}
\stopsetups
+% chapter?
% A part of a book having its own title.
% Required fields: author, title, booktitle, publisher, year.
% Optional fields: editor, volume or number, series, type, chapter, pages, address, edition, month, note.
+% APS? ignores: chapter, month
-% todo: series?
-
-\startsetups btx:aps:incollection
- \texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \texdefinition{btx:aps:editor-in-}{booktitle}
- \texdefinition{btx:aps:publisher-wherefrom-year}
- \texdefinition{btx:aps:editionset}
- \texdefinition{btx:aps:url-note-doi}
+\startsetups btx:aps:list:incollection
+ \fastsetup{btx:aps:list:inbook}
\stopsetups
% The proceedings of a conference.
@@ -688,57 +1103,46 @@
% Optional fields: editor, volume or number, series, address, month, organization, publisher, note.
% todo: series?
-\startsetups btx:aps:proceedings
- \texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \btxdoif {editor} {
- \btxdoif {organization} {
- \btxspace
- \btxflush{organization}
- \btxcomma
- }
- }
- \texdefinition{btx:aps:publisher-wherefrom-year}
- \texdefinition{btx:aps:editionset}
- \texdefinition{btx:aps:url-note-doi}
+\startsetups btx:aps:list:proceedings
+ \fastsetup{btx:aps:list:book}
\stopsetups
% An article in a conference proceedings.
% Required fields: author, title, booktitle, year.
% Optional fields: editor, volume or number, series, pages, address, month, organization, publisher, note.
-% todo: series?
-\startsetups btx:aps:inproceedings
+\startsetups btx:aps:list:inproceedings
\texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \texdefinition{btx:aps:editor-in-}{booktitle}
+ \texdefinition{btx:aps:title-if-not-placed}
+ \texdefinition{btx:aps:editor-in}
+ \texdefinition{btx:aps:editionset}
\btxdoif {organization} {
\btxspace
\btxflush{organization}
\btxcomma
}
\texdefinition{btx:aps:publisher-wherefrom-year}
- \texdefinition{btx:aps:editionset}
- \texdefinition{btx:aps:url-note-doi}
+ \texdefinition{btx:aps:url-doi-note}
\stopsetups
-\startsetups btx:aps:conference
- \fastsetup{btx:aps:inproceedings}
+\startsetups btx:aps:list:conference
+ \fastsetup{btx:aps:list:inproceedings}
\stopsetups
% A thesis.
% Required fields: author, title, school, year.
% Optional fields: type, address, month, note.
-\startsetups btx:aps:thesis
- \setmode{btx:aps:thesis}
+\startsetups btx:aps:list:thesis
\texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:title-if-not-placed}
\btxleftparenthesis
\btxdoifelse {type} {
- \btxflush{Word -> type}
+ \btxusecommand[aps:list:type] {
+ \btxflush{type}
+ }
} {
- \Word{\btxlabeltext{aps:\currentbtxcategory}}
+ \btxlabeltext{aps:\currentbtxcategory}
}
\btxrightparenthesis
\btxdoif {school} {
@@ -758,60 +1162,47 @@
}
}
\btxperiod
- \texdefinition{btx:aps:url-note-doi}
+ \texdefinition{btx:aps:url-doi-note}
\stopsetups
-\startsetups btx:aps:phdthesis
- \fastsetup{btx:aps:thesis}
+\startsetups btx:aps:list:phdthesis
+ \fastsetup{btx:aps:list:thesis}
\stopsetups
-\startsetups btx:aps:mastersthesis
- \fastsetup{btx:aps:thesis}
+\startsetups btx:aps:list:mastersthesis
+ \fastsetup{btx:aps:list:thesis}
\stopsetups
% A work that is printed and bound, but without a named publisher or sponsoring institution.
% Required field: title.
% Optional fields: author, howpublished, address, month, year, note.
-\startsetups btx:aps:booklet
- \texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \texdefinition{btx:aps:publisher-wherefrom-year}
- \texdefinition{btx:aps:url-note-doi}
+\startsetups btx:aps:list:booklet
+ \fastsetup{btx:aps:list:book}
\stopsetups
% Technical documentation.
% Required field: title.
% Optional fields: author, organization, address, edition, month, year, note.
-\startsetups btx:aps:manual
- \texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \texdefinition{btx:aps:publisher-wherefrom-year}
- \texdefinition{btx:aps:editionset}
- \texdefinition{btx:aps:url-note-doi}
+\startsetups btx:aps:list:manual
+ \fastsetup{btx:aps:list:book}
\stopsetups
% A report published by a school or other institution, usually numbered within a series.
% Required fields: author, title, institution, year.
% Optional fields: type, number, address, month, note.
-\startsetups btx:aps:techreport
- \texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \texdefinition{btx:aps:publisher-wherefrom-year}
- \texdefinition{btx:aps:editionset}
- \texdefinition{btx:aps:url-note-doi}
+\startsetups btx:aps:list:techreport
+ \fastsetup{btx:aps:list:book}
\stopsetups
% A document having an author and title, but not formally published.
% Required fields: author, title, note.
% Optional fields: month, year.
-\startsetups btx:aps:unpublished
- \texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \texdefinition{btx:aps:url-note-doi}
+\startsetups btx:aps:list:unpublished
+ \fastsetup{btx:aps:list:book}
\stopsetups
% A patent. Note that this category was not defined with BIBTEX. Below from JabRef:
@@ -821,9 +1212,9 @@
% todo: yearfiled, monthfiled, dayfiled
-\startsetups btx:aps:patent
+\startsetups btx:aps:list:patent
\texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:title-if-not-placed}
\begingroup
\it
\btxdoif {nationality} {
@@ -834,41 +1225,14 @@
\btxlabeltext{aps:patent}
\btxdoif {number} {
\btxspace
- \btxlabeltext{aps:Number}
+ \btxlabeltext{aps:number}
\btxspace
\btxflush{number}
}
\btxperiod
\italiccorrection
\endgroup
- \btxdoifelse {author} {
- \btxdoifelse {country} {
- \btxspace
- \btxdoif {address} {
- \btxflush{address}
- \btxcomma
- }
- \btxflush{country}
- \btxdoifelse {assignee}
- {\btxcolon} {\btxperiod}
- } {
- \btxdoifelse {address} {
- \btxspace
- \btxflush{address}
- \btxdoifelse {assignee}
- {\btxcolon} {\btxperiod}
- } {
- \btxdoifelse {assignee}
- {\btxspace} {}
- }
- }
- \btxdoif {assignee} {
- \btxflush{assignee}
- \btxperiod
- }
- } {
- \texdefinition{btx:aps:publisher-wherefrom-year}
- }
+ \texdefinition{btx:aps:publisher-wherefrom-year}
\texdefinition{btx:aps:url}
\texdefinition{btx:aps:note}
\stopsetups
@@ -880,9 +1244,9 @@
% Like Misc below but includes organization.
-\startsetups btx:aps:electronic
+\startsetups btx:aps:list:electronic
\texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:title-if-not-placed}
\btxdoif {organization} {
\btxspace
\btxflush{organization}
@@ -893,50 +1257,42 @@
\btxflush{howpublished}
\btxperiod
}
- \texdefinition{btx:aps:url-note-doi}
+ \texdefinition{btx:aps:url-doi-note}
\stopsetups
% Other. Note that this category was not defined with BIBTEX. Below from JabRef:
% Required fields: author or title, year
% Optional fields: note, doi, url
-\startsetups btx:aps:other
- \texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
- \texdefinition{btx:aps:url-note-doi}
+\startsetups btx:aps:list:other
+ \fastsetup{btx:aps:list:book}
\stopsetups
% Use this type when nothing else fits.
% Required fields: none.
% Optional fields: author, title, howpublished, month, year, note.
-\startsetups btx:aps:misc
+\startsetups btx:aps:list:misc
\texdefinition{btx:aps:author}
- \texdefinition{btx:aps:title}
+ \texdefinition{btx:aps:title-if-not-placed}
\btxdoif {howpublished} {
\btxspace
\btxflush{howpublished}
\btxperiod
}
- \texdefinition{btx:aps:url-note-doi}
+ \texdefinition{btx:aps:url-doi-note}
\stopsetups
% If all else fails to match:
-\startsetups btx:aps:literal
+\startsetups btx:aps:list:literal
+ %\btxleftparenthesis
+ \removeunwantedspaces(
+ \btxflush{key}
+ \btxrightparenthesis
\btxdoif {text} {
\btxflush{text}
}
\stopsetups
-%D Experiment:
-
-\startsetups btx:aps:lefttext
- \currentbtxlefttext
-\stopsetups
-
-\startsetups btx:aps:righttext
- \currentbtxrighttext
-\stopsetups
-
\stopbtxrenderingdefinitions
diff --git a/tex/context/base/publ-imp-author.mkvi b/tex/context/base/publ-imp-author.mkvi
index 6547573cf..534d8ce0b 100644
--- a/tex/context/base/publ-imp-author.mkvi
+++ b/tex/context/base/publ-imp-author.mkvi
@@ -31,15 +31,9 @@
\startsetups \s!btx:\s!cite:\s!author:concat
\ifcase\currentbtxoverflow
- \ifcase\currentbtxconcat \or \or
- \btxparameter\c!namesep
- \or
- \btxparameter\c!lastnamesep
- \or
- \btxparameter\c!finalnamesep
- \fi
+ \btxparameter{\c!separator:names:\number\currentbtxconcat}
\else
- % \btxparameter\c!namesep
+ %\btxparameter{\c!separator:names:2}
\fi
\stopsetups
@@ -53,18 +47,18 @@
\fastsetup{\s!btx:\s!cite:\s!author:concat}
\ifx\currentbtxfirstnames\empty \else
\currentbtxfirstnames
- \btxparameter\c!firstnamesep
+ \btxparameter{\c!separator:firstnames}
\fi
\ifx\currentbtxvons\empty \else
\currentbtxvons
\ifx\currentbtxsurnames\empty \else
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\fi
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
- \btxparameter\c!juniorsep
+ \btxparameter{\c!separator:juniors}
\currentbtxjuniors
\fi
\fi
@@ -75,18 +69,18 @@
\fastsetup{\s!btx:\s!cite:\s!author:concat}
\ifx\currentbtxinitials\empty \else
\currentbtxinitials
- \btxparameter\c!initialsep
+ \btxparameter{\c!separator:initials}
\fi
\ifx\currentbtxvons\empty \else
\currentbtxvons
\ifx\currentbtxsurnames\empty \else
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\fi
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
- \btxparameter\c!juniorsep
+ \btxparameter{\c!separator:juniors}
\currentbtxjuniors
\fi
\fi
@@ -99,25 +93,25 @@
\texdefinition{\s!btx:\s!cite:\s!author:\s!de}
\doifmode {\s!btx:\s!de} {
\currentbtxvons
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
}
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
- \btxparameter\c!juniorsep
+ \btxparameter{\c!separator:juniors}
\currentbtxjuniors
\fi
\fi
\ifx\currentbtxfirstnames\empty
% firstnames are optional
\else
- \btxparameter\c!surnamefirstnamesep
+ \btxparameter{\c!separator:invertedfirstnames}
\currentbtxfirstnames
\fi
\ifx\currentbtxvons\empty \else
\doifnotmode {\s!btx:\s!de} {
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\currentbtxvons
}
\fi
@@ -130,25 +124,25 @@
\texdefinition{\s!btx:\s!cite:\s!author:\s!de}
\doifnotmode {\s!btx:\s!de} {
\currentbtxvons
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
}
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
- \btxparameter\c!juniorsep
+ \btxparameter{\c!separator:juniors}
\currentbtxjuniors
\fi
\fi
\ifx\currentbtxinitials\empty
% initials are optional
\else
- \btxparameter\c!surnameinitialsep
+ \btxparameter{\c!separator:invertedinitials}
\currentbtxinitials
\fi
\ifx\currentbtxvons\empty \else
\doifmode {\s!btx:\s!de} {
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\currentbtxvons
}
\fi
@@ -160,13 +154,13 @@
% is this treated differently in german?
\ifx\currentbtxvons\empty \else
\currentbtxvons
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\fi
\currentbtxsurnames
\ifcase\currentbtxauthorstate \else
% potential clash of names so we force initials
\ifx\currentbtxinitials\empty \else
- \btxparameter\c!surnameinitialsep
+ \btxparameter{\c!separator:invertedinitials}
\currentbtxinitials
\fi
\fi
@@ -177,15 +171,9 @@
\startsetups \s!btx:\s!list:\s!author:concat
\ifcase\currentbtxoverflow
- \ifcase\currentbtxconcat \or \or
- \btxparameter\c!namesep
- \or
- \btxparameter\c!lastnamesep
- \or
- \btxparameter\c!finalnamesep
- \fi
+ \btxparameter{\c!separator:names:\number\currentbtxconcat}
\else
- \btxparameter\c!namesep
+ \btxparameter{\c!separator:names:2}
\fi
\stopsetups
@@ -199,18 +187,18 @@
\fastsetup{\s!btx:\s!list:\s!author:concat}
\ifx\currentbtxfirstnames\empty \else
\currentbtxfirstnames
- \btxparameter\c!firstnamesep
+ \btxparameter{\c!separator:firstnames}
\fi
\ifx\currentbtxvons\empty \else
\currentbtxvons
\ifx\currentbtxsurnames\empty \else
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\fi
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
- \btxparameter\c!juniorsep
+ \btxparameter{\c!separator:juniors}
\currentbtxjuniors
\fi
\fi
@@ -221,18 +209,18 @@
\fastsetup{\s!btx:\s!list:\s!author:concat}
\ifx\currentbtxinitials\empty \else
\currentbtxinitials
- \btxparameter\c!initialsep
+ \btxparameter{\c!separator:initials}
\fi
\ifx\currentbtxvons\empty \else
\currentbtxvons
\ifx\currentbtxsurnames\empty \else
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\fi
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
- \btxparameter\c!juniorsep
+ \btxparameter{\c!separator:juniors}
\currentbtxjuniors
\fi
\fi
@@ -245,25 +233,25 @@
\texdefinition{\s!btx:\s!cite:\s!author:\s!de}
\doifnotmode {\s!btx:\s!de} {
\currentbtxvons
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
}
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
- \btxparameter\c!juniorsep
+ \btxparameter{\c!separator:juniors}
\currentbtxjuniors
\fi
\fi
\ifx\currentbtxfirstnames\empty
% firstnames are optional
\else
- \btxparameter\c!surnamefirstnamesep
+ \btxparameter{\c!separator:invertedfirstnames}
\currentbtxfirstnames
\fi
\ifx\currentbtxvons\empty \else
\doifmode {\s!btx:\s!de} {
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\currentbtxvons
}
\fi
@@ -276,25 +264,25 @@
\texdefinition{\s!btx:\s!cite:\s!author:\s!de}
\doifnotmode {\s!btx:\s!de} {
\currentbtxvons
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
}
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
- \btxparameter\c!juniorsep
+ \btxparameter{\c!separator:juniors}
\currentbtxjuniors
\fi
\fi
\ifx\currentbtxinitials\empty
% initials are optional
\else
- \btxparameter\c!surnameinitialsep
+ \btxparameter{\c!separator:invertedinitials}
\currentbtxinitials
\fi
\ifx\currentbtxvons\empty \else
\doifmode {\s!btx:\s!de} {
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\currentbtxvons
}
\fi
@@ -306,7 +294,7 @@
% is this treated differently in german?
\ifx\currentbtxvons\empty \else
\currentbtxvons
- \btxparameter\c!vonsep
+ \btxparameter{\c!separator:vons}
\fi
\currentbtxsurnames
\fastsetup{\s!btx:\s!list:\s!author:others}
diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi
index f743a7212..ca4f2a970 100644
--- a/tex/context/base/publ-imp-cite.mkvi
+++ b/tex/context/base/publ-imp-cite.mkvi
@@ -51,13 +51,18 @@
\startsetups btx:cite:unknown
\begingroup
\btxcitereference
- \currentbtxfirst
+ unknown: \currentbtxfirst
\endgroup
\stopsetups
-\startsetups btx:cite:invalid
+\startsetups btx:cite:empty
\btxcitereference
- <\currentbtxreference>
+ <empty>
+\stopsetups
+
+\startsetups btx:cite:invalid
+ \btxcitereference
+ {\tt <\currentbtxreference>}
\stopsetups
% \startsetups btx:cite:normal
@@ -101,13 +106,7 @@
%\stopsetups
\starttexdefinition btx:cite:concat
- \ifcase\currentbtxconcat \or \or
- \btxparameter\c!pubsep
- \or
- \btxparameter\c!lastpubsep
- \or
- \btxparameter\c!finalpubsep
- \fi
+ \btxparameter{\c!separator:\number\currentbtxconcat}
\stoptexdefinition
\startsetups btx:cite:normal
@@ -117,21 +116,21 @@
\else
\texdefinition {\s!btx:\s!cite:inject} {
\btxcitereference
- \btxusecommand[\currentbtxspecification:cite:\currentbtxcitevariant] {
+ \btxusecommand[\currentbtxspecification:cite:\currentbtxcitealternative] {
\currentbtxfirst
}
}
\ifx\currentbtxsecond\empty \else
\btxparameter\v!inbetween
\texdefinition {\s!btx:\s!cite:inject} {
- \btxusecommand[\currentbtxspecification:cite:\currentbtxcitevariant] {
+ \btxusecommand[\currentbtxspecification:cite:\currentbtxcitealternative] {
\currentbtxsecond
}
}
\fi
\ifx\currentbtxthird\empty \else
\texdefinition {\s!btx:\s!cite:inject} {
- \btxusecommand[\currentbtxspecification:cite:\currentbtxvariant] {
+ \btxusecommand[\currentbtxspecification:cite:\currentbtxcitealternative] {
\currentbtxthird
}
}
@@ -194,6 +193,11 @@
\fi
\stopsetups
+\startsetups \s!btx:\s!cite:entry
+ \texdefinition{\s!btx:\s!cite:concat}
+ \btxhandleciteentry
+\stopsetups
+
% these three are goodies to get something bit are not set up as it makes no
% sense to have something root for combinations like this (esp not because one
% gets default anyway
@@ -219,6 +223,12 @@
\startsetups btx:cite:num
\fastsetup{btx:cite:range}
\stopsetups
+\startsetups btx:cite:default
+ \fastsetup{btx:cite:num}
+\stopsetups
+\startsetups btx:cite:textnum
+ \fastsetup{btx:cite:num}
+\stopsetups
\startsetups btx:cite:year
\fastsetup{btx:cite:range}
\stopsetups
@@ -231,13 +241,13 @@
\else\ifconditional\btxinteractive
\goto {
\btxcitereference
- \hyphenatedurl{\doif{\currentbtxcitevariant}{doi}{doi:}\currentbtxfirst}
+ \hyphenatedurl{\doif{\currentbtxcitealternative}{doi}{doi:}\currentbtxfirst}
} [
- url(\doif{\currentbtxcitevariant}{doi}{http://dx.doi.org/}\currentbtxfirst)
+ url(\doif{\currentbtxcitealternative}{doi}{http://dx.doi.org/}\currentbtxfirst)
]
\else
\btxcitereference
- \hyphenatedurl{\doif{\currentbtxcitevariant}{doi}{doi:}\currentbtxfirst}
+ \hyphenatedurl{\doif{\currentbtxcitealternative}{doi}{doi:}\currentbtxfirst}
\fi\fi
\stopsetups
diff --git a/tex/context/base/publ-imp-default.mkvi b/tex/context/base/publ-imp-default.mkvi
index e3e032d12..c6657ffa9 100644
--- a/tex/context/base/publ-imp-default.mkvi
+++ b/tex/context/base/publ-imp-default.mkvi
@@ -22,46 +22,30 @@
% \definebtx [\s!default:\s!list ] [\s!list]
% \definebtx [\s!default:\s!author] [\s!author]
-\definebtxrendering % no need to set \c!default ! ... also confusing
+\definebtxrendering
[\s!default]
[\c!specification=\s!default]
\definebtx
[\s!default]
- [\c!namesep={,\space},
- \c!lastnamesep={\space\btxlabeltext{default:and}\space},
- \c!finalnamesep={\space\btxlabeltext{default:and}\space},
- \c!firstnamesep=\space,
+ [\c!default=, % we do not want to fall|-|back on ourself.
\c!otherstext={\space\btxlabeltext{default:others}},
- \c!juniorsep=\space,
- \c!vonsep=\space,
- \c!initialsep=\space,
- \c!surnamesep={,\space},
- \c!surnameinitialsep={,\space},
- \c!surnamefirstnamesep={,\space},
- \c!pubsep={,\space},
- \c!lastpubsep={,\space\btxlabeltext{default:and}\space},
- \c!finalpubsep={\space\btxlabeltext{default:and}\space}]
+ %c!journalconversion=\v!normal,
+ \c!monthconversion=\v!number,
+ \c!separator:names:2={,\space},
+ \c!separator:names:3={\space\btxlabeltext{default:and}\space},
+ \c!separator:names:4={\space\btxlabeltext{default:and}\space}]
\definebtx
[\s!default:\s!list]
[\s!default]
- [%c!journalconversion=\v!normal,
- \c!monthconversion=\v!number,
- \c!authorconversion=normalshort]
+ [\c!authorconversion=normalshort]
\definebtx
[\s!default:\s!cite]
[\s!default:\s!list]
[\c!alternative=num,
- \c!authorconversion=\v!name,
- \c!sorttype=,
- \c!compress=\v!no,
- \c!inbetween=\space,
- \c!range=\endash,
- \c!left=,
- \c!middle=,
- \c!right=]
+ \c!authorconversion=\v!name]
% We define [page] settings in the default namespace, inheriting the root
% settings, in order to eventually allow for modifications without touching
@@ -71,6 +55,10 @@
[\s!default:\s!page]
[\s!page]
+\definebtx
+ [\s!default:\s!page:list]
+ [\s!default:\s!page]
+
% List variants, some having specific settings:
\definebtx
@@ -130,10 +118,7 @@
[\s!default:\s!cite:authornum]
[\s!default:\s!cite:author]
[\c!left={(},
- \c!right={)},
- \c!pubsep={;\space},
- \c!lastpubsep={;\space},
- \c!finalpubsep={;\space}]
+ \c!right={)}]
\definebtx
[\s!default:\s!cite:authoryear]
@@ -141,10 +126,7 @@
[\c!compress=\v!yes,
\c!left={(},
\c!right={)},
- \c!inbetween={,\space},
- \c!pubsep={;\space},
- \c!lastpubsep={;\space},
- \c!finalpubsep={;\space}]
+ \c!inbetween={,\space}]
\definebtx
[\s!default:\s!cite:authorref]
@@ -253,18 +235,28 @@
[\c!compress=\v!yes,
\c!left={[},
\c!right={]},
- \c!pubsep={,},
- \c!lastpubsep={,},
- \c!finalpubsep={,}]
+ \c!separator:2={,}, % no space
+ \c!separator:3=\btxparameter{\c!separator:2},
+ \c!separator:4=\btxparameter{\c!separator:2}]
+
+\definebtx
+ [\s!default:\s!cite:default]
+ [\s!default:\s!cite:num]
\definebtx
[\s!default:\s!cite:textnum]
[\s!default:\s!cite:num]
[\c!left=, % in apa: {Ref.\nbsp} or so
\c!right=,
- \c!pubsep={,},
- \c!lastpubsep={,\space\btxlabeltext{default:and}\space},
- \c!finalpubsep={\space\btxlabeltext{default:and}\space}]
+ \c!separator:2={,\space},
+ \c!separator:3={,\space\btxlabeltext{default:and}\space},
+ \c!separator:4= {\space\btxlabeltext{default:and}\space}]
+
+\definebtx
+ [\s!default:\s!cite:entry]
+ [\s!default:\s!cite]
+ [\c!left={(},
+ \c!right={)}]
% Multilingual text strings
@@ -509,6 +501,9 @@
\startsetups \s!btx:\s!default:\s!cite:authornum
\fastsetup{\s!btx:\s!cite:author}
\stopsetups
+\startsetups \s!btx:\s!default:\s!cite:authorref
+ \fastsetup{\s!btx:\s!cite:authorref}
+\stopsetups
\startsetups \s!btx:\s!default:\s!cite:author:num
\fastsetup{\s!btx:\s!cite:range}
@@ -548,8 +543,11 @@
\startsetups \s!btx:\s!default:\s!cite:num
\fastsetup{\s!btx:\s!cite:range}
\stopsetups
+\startsetups \s!btx:\s!default:\s!cite:default
+ \fastsetup{\s!btx:\s!default:\s!cite:num}
+\stopsetups
\startsetups \s!btx:\s!default:\s!cite:textnum
- \fastsetup{\s!btx:\s!cite:range}
+ \fastsetup{\s!btx:\s!default:\s!cite:num}
\stopsetups
\startsetups \s!btx:\s!default:\s!cite:title
\fastsetup{\s!btx:\s!cite:normal}
@@ -566,9 +564,12 @@
\startsetups \s!btx:\s!default:\s!cite:url
\fastsetup{\s!btx:\s!cite:url}
\stopsetups
+\startsetups \s!btx:\s!default:\s!cite:nocite
+ \fastsetup{\s!btx:\s!cite:nocite}
+\stopsetups
-\startsetups \s!btx:\s!default:\s!cite:unknown
- \fastsetup{\s!btx:\s!cite:unknown}
+\startsetups \s!btx:\s!default:\s!cite:entry
+ \fastsetup{\s!btx:\s!cite:entry}
\stopsetups
\startsetups \s!btx:\s!default:\s!cite:none
\fastsetup{\s!btx:\s!cite:none}
diff --git a/tex/context/base/publ-imp-list.mkvi b/tex/context/base/publ-imp-list.mkvi
index 815bb2038..77c009911 100644
--- a/tex/context/base/publ-imp-list.mkvi
+++ b/tex/context/base/publ-imp-list.mkvi
@@ -51,9 +51,16 @@
\stopsetups
\startsetups \s!btx:\s!list:yes
- \texdefinition {\s!btx:\s!list:inject} {
- \currentbtxfirst
- }
+ \btxstartstyleandcolor [\currentbtxspecification:list:yes]
+ \btxusecommand[\currentbtxspecification:list:yes] {
+ %\btxparameter\c!left
+ \texdefinition {\s!btx:\s!list:inject} {
+ \currentbtxfirst
+ \btxparameter\c!stopper
+ }
+ %\btxparameter\c!right
+ }
+ \btxstopstyleandcolor
\stopsetups
\startsetups \s!btx:\s!list:num
\texdefinition {\s!btx:\s!list:inject} {
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index f20bf5102..789b772fe 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -93,85 +93,72 @@ manipulatormethods.WORD = converters.WORD
manipulatormethods.Words = converters.Words
manipulatormethods.WORDS = converters.WORDS
-local context = context
-local commands = commands
-
-local ctx_doifelse = commands.doifelse
-local ctx_doif = commands.doif
-local ctx_doifnot = commands.doifnot
-
-local ctx_firstoftwoarguments = context.firstoftwoarguments
-local ctx_secondoftwoarguments = context.secondoftwoarguments
-local ctx_firstofoneargument = context.firstofoneargument
-
-local ctx_gobbleoneargument = context.gobbleoneargument
-local ctx_gobbletwoarguments = context.gobbletwoarguments
-
-local ctx_btxdirectlink = context.btxdirectlink
-local ctx_btxhandlelistentry = context.btxhandlelistentry
-local ctx_btxhandlelisttextentry = context.btxhandlelisttextentry
-local ctx_btxchecklistentry = context.btxchecklistentry
-local ctx_btxchecklistcombi = context.btxchecklistcombi
------ ctx_btxsetcitereference = context.btxsetcitereference
------ ctx_btxsetlistreference = context.btxsetlistreference
-
-local ctx_btxsetdataset = context.btxsetdataset
-local ctx_btxsettag = context.btxsettag
-local ctx_btxsetnumber = context.btxsetnumber
-local ctx_btxsetlanguage = context.btxsetlanguage
-local ctx_btxsetcombis = context.btxsetcombis
-local ctx_btxsetcategory = context.btxsetcategory
-local ctx_btxcitesetup = context.btxcitesetup
-local ctx_btxpagesetup = context.btxpagesetup
-local ctx_btxsetfirst = context.btxsetfirst
-local ctx_btxsetsecond = context.btxsetsecond
-local ctx_btxsetthird = context.btxsetthird
-local ctx_btxsetinternal = context.btxsetinternal
-local ctx_btxsetlefttext = context.btxsetlefttext
-local ctx_btxsetrighttext = context.btxsetrighttext
-local ctx_btxsetbefore = context.btxsetbefore
-local ctx_btxsetafter = context.btxsetafter
-local ctx_btxsetbacklink = context.btxsetbacklink
-local ctx_btxsetbacktrace = context.btxsetbacktrace
-local ctx_btxsetcount = context.btxsetcount
-local ctx_btxsetconcat = context.btxsetconcat
-local ctx_btxsetoveflow = context.btxsetoverflow
-local ctx_btxsetfirstpage = context.btxsetfirstpage
-local ctx_btxsetlastpage = context.btxsetlastpage
-local ctx_btxsetfirstinternal = context.btxsetfirstinternal
-local ctx_btxsetlastinternal = context.btxsetlastinternal
-local ctx_btxstartcite = context.btxstartcite
-local ctx_btxstopcite = context.btxstopcite
-local ctx_btxstartciteauthor = context.btxstartciteauthor
-local ctx_btxstopciteauthor = context.btxstopciteauthor
-local ctx_btxstartsubcite = context.btxstartsubcite
-local ctx_btxstopsubcite = context.btxstopsubcite
-local ctx_btxstartlistentry = context.btxstartlistentry
-local ctx_btxstoplistentry = context.btxstoplistentry
-local ctx_btxlistsetup = context.btxlistsetup
-local ctx_btxflushauthor = context.btxflushauthor
-local ctx_btxsetnoflistentries = context.btxsetnoflistentries
-local ctx_btxsetcurrentlistentry = context.btxsetcurrentlistentry
-local ctx_btxsetcurrentlistindex = context.btxsetcurrentlistindex
-
-local ctx_setmacro = tokens.setters and tokens.setters.macro
-
-languages.data = languages.data or { }
-local data = languages.data
-
--- local registeredcitevariants = publications.registeredcitevariants or { }
--- local registeredlistvariants = publications.registeredlistvariants or { }
---
--- storage.register("publications/registeredcitevariants", registeredcitevariants,"publications.registeredcitevariants")
--- storage.register("publications/registeredlistvariants", registeredlistvariants,"publications.registeredlistvariants")
---
--- function commands.registerbtxcitevariant(name,parent)
--- registeredcitevariants[name] = parent or ""
--- end
---
--- function commands.registerbtxlistvariant(name,parent)
--- registeredlistvariants[name] = parent or ""
--- end
+local context = context
+local commands = commands
+
+local ctx_doifelse = commands.doifelse
+local ctx_doif = commands.doif
+local ctx_doifnot = commands.doifnot
+
+local ctx_firstoftwoarguments = context.firstoftwoarguments
+local ctx_secondoftwoarguments = context.secondoftwoarguments
+local ctx_firstofoneargument = context.firstofoneargument
+
+local ctx_gobbleoneargument = context.gobbleoneargument
+local ctx_gobbletwoarguments = context.gobbletwoarguments
+
+local ctx_btxdirectlink = context.btxdirectlink
+local ctx_btxhandlelistentry = context.btxhandlelistentry
+local ctx_btxhandlelisttextentry = context.btxhandlelisttextentry
+local ctx_btxchecklistentry = context.btxchecklistentry
+local ctx_btxchecklistcombi = context.btxchecklistcombi
+----- ctx_btxsetcitereference = context.btxsetcitereference
+----- ctx_btxsetlistreference = context.btxsetlistreference
+
+local ctx_btxsetdataset = context.btxsetdataset
+local ctx_btxsettag = context.btxsettag
+local ctx_btxsetnumber = context.btxsetnumber
+local ctx_btxsetlanguage = context.btxsetlanguage
+local ctx_btxsetcombis = context.btxsetcombis
+local ctx_btxsetcategory = context.btxsetcategory
+local ctx_btxcitesetup = context.btxcitesetup
+local ctx_btxpagesetup = context.btxpagesetup
+local ctx_btxsetfirst = context.btxsetfirst
+local ctx_btxsetsecond = context.btxsetsecond
+local ctx_btxsetthird = context.btxsetthird
+local ctx_btxsetinternal = context.btxsetinternal
+local ctx_btxsetlefttext = context.btxsetlefttext
+local ctx_btxsetrighttext = context.btxsetrighttext
+local ctx_btxsetbefore = context.btxsetbefore
+local ctx_btxsetafter = context.btxsetafter
+local ctx_btxsetbacklink = context.btxsetbacklink
+local ctx_btxsetbacktrace = context.btxsetbacktrace
+local ctx_btxsetcount = context.btxsetcount
+local ctx_btxsetconcat = context.btxsetconcat
+local ctx_btxsetoveflow = context.btxsetoverflow
+local ctx_btxsetfirstpage = context.btxsetfirstpage
+local ctx_btxsetlastpage = context.btxsetlastpage
+local ctx_btxsetfirstinternal = context.btxsetfirstinternal
+local ctx_btxsetlastinternal = context.btxsetlastinternal
+local ctx_btxstartcite = context.btxstartcite
+local ctx_btxstopcite = context.btxstopcite
+local ctx_btxstartciteauthor = context.btxstartciteauthor
+local ctx_btxstopciteauthor = context.btxstopciteauthor
+local ctx_btxstartsubcite = context.btxstartsubcite
+local ctx_btxstopsubcite = context.btxstopsubcite
+local ctx_btxstartlistentry = context.btxstartlistentry
+local ctx_btxstoplistentry = context.btxstoplistentry
+local ctx_btxlistsetup = context.btxlistsetup
+local ctx_btxflushauthor = context.btxflushauthor
+local ctx_btxsetnoflistentries = context.btxsetnoflistentries
+local ctx_btxsetcurrentlistentry = context.btxsetcurrentlistentry
+local ctx_btxsetcurrentlistindex = context.btxsetcurrentlistindex
+
+local implement = interfaces.implement
+local ctx_setmacro = interfaces.setmacro
+
+languages.data = languages.data or { }
+local data = languages.data
local specifications = publications.specifications
local currentspecification = specifications[false]
@@ -1269,12 +1256,7 @@ do
publications.found = found
publications.get = get
- function commands.btxfieldname(name,tag,field) context(get(name,tag,field,false,false)) end
- function commands.btxfieldtype(name,tag,field) context(get(name,tag,field,true, false)) end
- function commands.btxfoundname(name,tag,field) context(get(name,tag,field,false,true )) end
- function commands.btxfoundtype(name,tag,field) context(get(name,tag,field,true, true )) end
-
- function commands.btxflush(name,tag,field)
+ local function btxflush(name,tag,field)
local dataset = rawget(datasets,name)
if dataset then
local fields = dataset.luadata[tag]
@@ -1300,7 +1282,7 @@ do
end
end
- function commands.btxfield(name,tag,field)
+ local function btxfield(name,tag,field)
local dataset = rawget(datasets,name)
if dataset then
local fields = dataset.luadata[tag]
@@ -1325,7 +1307,7 @@ do
end
end
- function commands.btxdetail(name,tag,field)
+ local function btxdetail(name,tag,field)
local dataset = rawget(datasets,name)
if dataset then
local fields = dataset.luadata[tag]
@@ -1355,6 +1337,26 @@ do
end
end
+ local function btxdirect(name,tag,field)
+ local dataset = rawget(datasets,name)
+ if dataset then
+ local fields = dataset.luadata[tag]
+ if fields then
+ local manipulator, field = splitmanipulation(field)
+ local value = fields[field]
+ if value then
+ context(typesetters.default(field,value,manipulator))
+ elseif trace_detail then
+ report("field %a of tag %a in dataset %a has no value",field,tag,name)
+ end
+ else
+ report("unknown tag %a in dataset %a",tag,name)
+ end
+ else
+ report("unknown dataset %a",name)
+ end
+ end
+
local function okay(name,tag,field)
local dataset = rawget(datasets,name)
if dataset then
@@ -1372,9 +1374,41 @@ do
publications.okay = okay
- function commands.btxdoifelse(name,tag,field) ctx_doifelse(okay(name,tag,field)) end
- function commands.btxdoif (name,tag,field) ctx_doif (okay(name,tag,field)) end
- function commands.btxdoifnot (name,tag,field) ctx_doifnot (okay(name,tag,field)) end
+ if implement then
+
+ implement { name = "btxfield", actions = btxfield, arguments = { "string", "string", "string" } }
+ implement { name = "btxdetail", actions = btxdetail, arguments = { "string", "string", "string" } }
+ implement { name = "btxflush", actions = btxflush, arguments = { "string", "string", "string" } }
+ implement { name = "btxdirect", actions = btxdirect, arguments = { "string", "string", "string" } }
+
+ implement { name = "btxfieldname", actions = { get, context }, arguments = { "string", "string", "string", false, false } }
+ implement { name = "btxfieldtype", actions = { get, context }, arguments = { "string", "string", "string", true, false } }
+ implement { name = "btxfoundname", actions = { get, context }, arguments = { "string", "string", "string", false, true } }
+ implement { name = "btxfoundtype", actions = { get, context }, arguments = { "string", "string", "string", true, true } }
+
+ implement { name = "btxdoifelse", actions = { okay, ctx_btxdoifelse }, arguments = { "string", "string", "string" } }
+ implement { name = "btxdoif", actions = { okay, ctx_btxdoif }, arguments = { "string", "string", "string" } }
+ implement { name = "btxdoifnot", actions = { okay, ctx_btxdoifnot }, arguments = { "string", "string", "string" } }
+
+
+ else
+
+ commands.btxflush = btxflush
+ commands.btxfield = btxfield
+ commands.btxdetail = btxdetail
+ commands.btxdirect = btxdirect
+
+ function commands.btxfieldname(name,tag,field) context(get(name,tag,field,false,false)) end
+ function commands.btxfieldtype(name,tag,field) context(get(name,tag,field,true, false)) end
+ function commands.btxfoundname(name,tag,field) context(get(name,tag,field,false,true )) end
+ function commands.btxfoundtype(name,tag,field) context(get(name,tag,field,true, true )) end
+
+ function commands.btxdoifelse (name,tag,field) ctx_doifelse(okay(name,tag,field)) end
+ function commands.btxdoif (name,tag,field) ctx_doif (okay(name,tag,field)) end
+ function commands.btxdoifnot (name,tag,field) ctx_doifnot (okay(name,tag,field)) end
+
+ end
+
end
@@ -1468,39 +1502,6 @@ do
-- helper
- -- local function sortedtags(dataset,list,sorttype)
- -- local luadata = datasets[dataset].luadata
- -- local valid = { }
- -- for i=1,#list do
- -- local tag = list[i]
- -- local entry = luadata[tag]
- -- if entry then
- -- local key = entry[sorttype]
- -- if key then
- -- valid[#valid+1] = {
- -- tag = tag,
- -- split = sortsplitter(sortstripper(key))
- -- }
- -- end
- -- end
- -- end
- -- if #valid == 0 or #valid ~= #list then
- -- return list
- -- else
- -- sorters.sort(valid,basicsorter)
- -- for i=1,#valid do
- -- valid[i] = valid[i].tag
- -- end
- -- return valid
- -- end
- -- end
- --
- -- if sorttype and sorttype ~= "" then
- -- tags = sortedtags(dataset,tags,sorttype)
- -- end
-
- -- why shorts vs tags: only for sorting
-
function lists.register(dataset,tag,short) -- needs checking now that we split
local r = renderings[dataset]
if not short or short == "" then
@@ -1560,6 +1561,8 @@ do
end
end
+ -- todo: names = { "btx" }
+
methods[v_force] = function (dataset,rendering,keyword)
-- only for checking, can have duplicates, todo: collapse page numbers, although
-- we then also needs deferred writes
@@ -1601,7 +1604,9 @@ do
local pages = { }
local current = datasets[dataset]
local luadata = current.luadata
-rendering.result = result
+ -- handy for tracing :
+ rendering.result = result
+ --
for listindex=1,#result do
local r = result[listindex]
local u = r.userdata
@@ -2094,13 +2099,6 @@ do
end
end
- -- function commands.btxcitevariant(dataset,block,tags,variant) -- uses? specification ?
- -- local action = citevariants[variant]
- -- if action then
- -- action(dataset,tags,variant)
- -- end
- -- end
-
-- sorter
local keysorter = function(a,b)
@@ -2119,41 +2117,6 @@ do
end
end
- -- local suffix = 0
- -- local function setsuffix(entry,suffix,sortfld)
- -- entry.suffix = suffix
- -- local dataset = datasets[entry.dataset]
- -- if dataset then
- -- local suffixes = dataset.suffixes[entry.tag]
- -- if suffixes then
- -- suffixes[sortfld] = suffix
- -- else
- -- dataset.suffixes[entry.tag] = { [sortfld] = suffix }
- -- end
- -- end
- -- end
- -- for i=1,#source do
- -- local entry = source[i]
- -- local sortfld = entry.sortfld
- -- if sortfld then
- -- local value = entry.sortkey
- -- if value == oldvalue then
- -- if suffix == 0 then
- -- suffix = 1
- -- local entry = source[i-1]
- -- setsuffix(entry,suffix,sortfld)
- -- end
- -- suffix = suffix + 1
- -- setsuffix(entry,suffix,sortfld)
- -- else
- -- oldvalue = value
- -- suffix = 0
- -- end
- -- else
- -- break
- -- end
- -- end
-
local function compresslist(source)
for i=1,#source do
local t = type(source[i].sortkey)
@@ -2321,10 +2284,10 @@ do
ctx_btxsetrighttext(righttext[i] or "")
end
if before then
- ctx_btxsetbefore(before[i] or #before == 1 and before[1] or "")
+ ctx_btxsetbefore(before[i] or (#before == 1 and before[1]) or "")
end
if after then
- ctx_btxsetafter(after[i] or #after == 1 and after[1] or "")
+ ctx_btxsetafter(after[i] or (#after == 1 and after[1]) or "")
end
--
ctx_btxsetbacklink(currentcitation)
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index e0e0489ab..f376d3e7e 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -11,6 +11,10 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+
+% TODO: s! vs v! for default and neutral key/values
+% todo: too many refs in list
+
% todo: tagging
% todo: we cannot use 'default' as this wipes metadata names (maybe no longer do that)
% todo: \v!cite => \s!cite
@@ -182,10 +186,7 @@
\installcommandhandler \??btxregister {btxregister} \??btxregister
\installcommandhandler \??btxrendering {btxrendering} \??btxrendering
-% named: check all listvariant and citevariant
-
-\let\currentbtxcitevariant\empty
-\let\currentbtxlistvariant\empty
+\let\currentbtxcitealternative\empty
\let\currentbtxspecificationfallback\empty
@@ -257,11 +258,12 @@
% [default]
% [mybibs.bib]
+\let\startpublication\relax
+\let\stoppublication \relax
+
\unexpanded\def\startpublication
{\dodoubleempty\publ_set_publication}
-\let\stoppublication\relax
-
\def\publ_set_publication[#1][#2]%
{\begingroup
\catcode\commentasciicode\othercatcode
@@ -343,17 +345,39 @@
% \btxfield : current
% \btxspecificfield : dataset,tag,key
-\def\btxfield #1{\ctxcommand{btxfield("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxdetail #1{\ctxcommand{btxdetail("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxflush #1{\ctxcommand{btxflush("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxfieldname #1{\ctxcommand{btxfieldname("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxfieldtype #1{\ctxcommand{btxfieldtype("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxfoundname #1{\ctxcommand{btxfoundname("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxfoundtype #1{\ctxcommand{btxfoundtype("\currentbtxdataset","\currentbtxtag","#1")}}
+\ifdefined\clf_btxfield % {#1} will go
+
+ \def\btxfield #1{\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxdetail #1{\clf_btxdetail {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxflush #1{\clf_btxflush {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxdirect #1{\clf_btxdirect {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxfieldname #1{\clf_btxfieldname {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxfieldtype #1{\clf_btxfieldtype {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxfoundname #1{\clf_btxfoundname {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxfoundtype #1{\clf_btxfoundtype {\currentbtxdataset}{\currentbtxtag}{#1}}
+ % \def\btxauthorfield#1{\clf_btxauthorfield\currentbtxauthorindex{#1}}
+ \def\btxdoifelse #1{\clf_btxdoifelse {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxdoif #1{\clf_btxdoif {\currentbtxdataset}{\currentbtxtag}{#1}}
+ \def\btxdoifnot #1{\clf_btxdoifnot {\currentbtxdataset}{\currentbtxtag}{#1}}
+
+\else
+
+ \def\btxfield #1{\ctxcommand{btxfield("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxdetail #1{\ctxcommand{btxdetail("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxflush #1{\ctxcommand{btxflush("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxdirect #1{\ctxcommand{btxdirect("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxfieldname #1{\ctxcommand{btxfieldname("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxfieldtype #1{\ctxcommand{btxfieldtype("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxfoundname #1{\ctxcommand{btxfoundname("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxfoundtype #1{\ctxcommand{btxfoundtype("\currentbtxdataset","\currentbtxtag","#1")}}
+ % \def\btxauthorfield#1{\ctxcommand{btxauthorfield(\number\currentbtxauthorindex,"#1")}}
+ \def\btxdoifelse #1{\ctxcommand{btxdoifelse("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxdoif #1{\ctxcommand{btxdoif("\currentbtxdataset","\currentbtxtag","#1")}}
+ \def\btxdoifnot #1{\ctxcommand{btxdoifnot("\currentbtxdataset","\currentbtxtag","#1")}}
+
+\fi
+
\def\btxauthorfield#1{\ctxcommand{btxauthorfield(\number\currentbtxauthorindex,"#1")}}
-\def\btxdoifelse #1{\ctxcommand{btxdoifelse("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxdoif #1{\ctxcommand{btxdoif("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxdoifnot #1{\ctxcommand{btxdoifnot("\currentbtxdataset","\currentbtxtag","#1")}}
\let\btxsetup\fastsetup
@@ -500,9 +524,6 @@
\newtoks \everysetupbtxlistplacement % name will change
\newtoks \everysetupbtxciteplacement % name will change
-% \def\publ_list_processor % bibref -> btx (old method, keep as reference)
-% {\ctxcommand{btxaddtolist("\currentbtxrendering",\currentlistindex,"btxref")}}
-
\definelist % only used for selecting
[\s!btx]
@@ -604,9 +625,10 @@
\fi
\begingroup
\usebtxstyleandcolor\c!style\c!color
+ \ignorespaces
\fastbtxsetup\s!list\currentbtxcategory
- \endgroup
\removeunwantedspaces
+ \endgroup
\ifconditional\c_btx_list_pages
\btx_entry_inject_pages
\fi
@@ -821,7 +843,7 @@
\unexpanded\def\btx_reference_indeed
{\begingroup
- \let\currentbtxlistvariant\currentbtxnumbering
+ %let\currentbtxlistvariant\currentbtxnumbering
\setbtxparameterset\c!list\currentbtxnumbering
\ifx\currentbtxnumbering\empty
% nothing
@@ -869,19 +891,25 @@
{\ifx\currentbtxdataset\v!default\else\s!btxset="\currentbtxdataset",\fi%
\s!btxref="\currentbtxtag",%
\s!btxspc="\currentbtxspecification",%
- \ifx\currentbtxbefore\empty\else\s!btxbtx={\currentbtxbefore},\fi%
- \ifx\currentbtxafter \empty\else\s!btxatx={\currentbtxafter },\fi%
+ \ifx\currentbtxbefore\empty\else\s!btxbtx=\!!bs\currentbtxbefore\!!es,\fi%
+ \ifx\currentbtxafter \empty\else\s!btxatx=\!!bs\currentbtxafter \!!es,\fi%
\ifx\currentbtxbacklink\currentbtxbacktrace\s!btxint="\currentbtxbacklink"\else\s!btxbck="\currentbtxbacktrace"\fi}%
{\s!btx::\v!list::\number\c_btx_list_reference}%
{\currentbtxnumber}}
+\newconditional\c_btx_cite_reference_injected
+
\unexpanded\def\btx_cite_reference_inject
- {\dontleavehmode
- \iftrialtypesetting \else
- \ifx\currentbtxbacklink\empty
- % can be made empty when combining author / year
- \else
- \btx_cite_reference_inject_indeed
+ {\ifconditional\c_btx_cite_reference_injected
+ \else
+ \dontleavehmode
+ \iftrialtypesetting \else
+ \ifx\currentbtxbacklink\empty
+ % can be made empty when combining author / year
+ \else
+ \btx_cite_reference_inject_indeed
+ \settrue\c_btx_cite_reference_injected
+ \fi
\fi
\fi}
@@ -894,8 +922,8 @@
[\s!btx]%
[\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi%
\s!btxref=\currentbtxtag,%
- \ifx\currentbtxbefore\empty\else\s!btxbtx={\currentbtxbefore},\fi%
- \ifx\currentbtxafter \empty\else\s!btxatx={\currentbtxafter },\fi%
+ \ifx\currentbtxbefore\empty\else\s!btxbtx=\!!bs\currentbtxbefore\!!es,\fi%
+ \ifx\currentbtxafter \empty\else\s!btxatx=\!!bs\currentbtxafter \!!es,\fi%
\s!btxint=\number\currentbtxbacklink
\ifx\currentbtxciteuservariables\empty\else,\currentbtxciteuservariables\fi]}}
@@ -936,12 +964,13 @@
{\begingroup
\edef\currentbtxfield{#2}%
\setbtxparameterset\s!list\currentbtxfield
- \let\currentbtxlistvariant\currentbtxfield
+ %let\currentbtxlistvariant\currentbtxfield
\ctxcommand{btxauthor("\currentbtxdataset","\currentbtxtag","\currentbtxfield",{
combiner = "#1",
kind = "list",
etallimit = "\btxparameter\c!etallimit",
etaldisplay = "\btxparameter\c!etaldisplay",
+ symbol = "\btxparameter{\c!stopper:initials}",
})}%
\endgroup}
@@ -961,6 +990,7 @@
kind = "cite",
etallimit = "\btxparameter\c!etallimit",
etaldisplay = "\btxparameter\c!etaldisplay",
+ symbol = "\btxparameter{\c!stopper:initials}",
})}%
\endgroup}
@@ -1086,8 +1116,8 @@
\unexpanded\def\publ_cite_tags_indeed#1%
{\letinteractionparameter\c!style\empty
\setbtxparametersetroot\s!cite % we need to get the default
- \edef\currentbtxcitevariant{\btxparameter\c!alternative}%
- \setbtxparameterset\s!cite\currentbtxcitevariant
+ \edef\currentbtxcitealternative{\btxparameter\c!alternative}%
+ \setbtxparameterset\s!cite\currentbtxcitealternative
\edef\currentbtxcitetag{#1}%
\the\everysetupbtxciteplacement
\publ_cite_variant
@@ -1116,11 +1146,11 @@
\edef\p_alternative{\dummyparameter\c!alternative}%
\ifx\p_alternative\empty
\setbtxparametersetroot\s!cite
- \edef\currentbtxcitevariant{\btxparameter\c!alternative}%
+ \edef\currentbtxcitealternative{\btxparameter\c!alternative}%
\else
- \let\currentbtxcitevariant\p_alternative
+ \let\currentbtxcitealternative\p_alternative
\fi
- \setbtxparameterset\s!cite\currentbtxcitevariant
+ \setbtxparameterset\s!cite\currentbtxcitealternative
\setupcurrentbtx[#1]%
%
\edef\p_publ_cite_before {\dummyparameter\c!before}%
@@ -1134,9 +1164,9 @@
\def\publ_cite_tags_variants_indeed#1[#2]%
{\letinteractionparameter\c!style\empty
- \edef\currentbtxcitevariant{#1}%
+ \edef\currentbtxcitealternative{#1}%
\edef\currentbtxcitetag{#2}%
- \setbtxparameterset\s!cite\currentbtxcitevariant
+ \setbtxparameterset\s!cite\currentbtxcitealternative
\the\everysetupbtxciteplacement
\publ_cite_variant
\endgroup}
@@ -1151,22 +1181,18 @@
\unexpanded\def\publ_cite_handle_variant#1%
{\begingroup
- \edef\currentbtxcitevariant{#1}%
- \setbtxparameterset\s!cite\currentbtxcitevariant
+ \edef\currentbtxcitealternative{#1}%
+ \setbtxparameterset\s!cite\currentbtxcitealternative
\the\everysetupbtxciteplacement
\dosingleargument\publ_cite_handle_variant_indeed}
-\def\publ_cite_handle_variant_indeed[#1]%
- {\letbtxparameter\c!alternative\currentbtxcitevariant
- \usebtxstyleandcolor\c!style\c!color
- \uselanguageparameter\btxdatasetparameter % new
- \btxparameter\v!left
- \edef\currentbtxreference{#1}%
+\unexpanded\def\publ_cite_handle_variant_blob
+ {\btxparameter\v!left
\ctxcommand{btxhandlecite{%
dataset = "\currentbtxdataset",%
reference = \!!bs\currentbtxreference\!!es,%
markentry = \iftrialtypesetting false\else true\fi,%
- variant = "\currentbtxcitevariant",%
+ variant = "\currentbtxcitealternative",%
sorttype = "\btxparameter\c!sorttype",%
compress = "\btxparameter\c!compress",%
author = "\btxparameter\c!author",%
@@ -1175,8 +1201,15 @@
before = \!!bs\p_publ_cite_before\!!es,%
after = \!!bs\p_publ_cite_after\!!es,%
}}%
- \btxparameter\v!right
- \ctxcommand{flushmarked()}%
+ \ctxcommand{flushmarked()}% maybe: \iftrialtypesetting\else ... \fi
+ \btxparameter\v!right}
+
+\def\publ_cite_handle_variant_indeed[#1]%
+ {\letbtxparameter\c!alternative\currentbtxcitealternative
+ \edef\currentbtxreference{#1}%
+ \usebtxstyleandcolor\c!style\c!color
+ \uselanguageparameter\btxdatasetparameter % new
+ \btxparameter\c!command{\publ_cite_handle_variant_blob}%
\endgroup}
\unexpanded\def\btxcitation
@@ -1327,6 +1360,10 @@
\newtoks\everybtxciteentry
+\prependtoks
+ \setfalse\c_btx_cite_reference_injected
+\to \everybtxciteentry
+
\unexpanded\def\btxcitesetup#1%
{\the\everybtxciteentry
\everybtxciteentry\emptytoks % tricky maybe not when subcites
@@ -1341,8 +1378,8 @@
\unexpanded\def\btxstartsubcite#1%
{\begingroup
\btxcitereset % todo: limited set
- \def\currentbtxcitevariant{#1}%
- \setbtxparameterset\s!cite\currentbtxcitevariant
+ \def\currentbtxcitealternative{#1}%
+ \setbtxparameterset\s!cite\currentbtxcitealternative
\usebtxstyleandcolor\c!style\c!color
\btxparameter\c!left
\relax}
@@ -1354,8 +1391,8 @@
\unexpanded\def\btxstartciterendering[#1]%
{\begingroup
- \edef\currentbtxcitevariant{#1}%
- \setbtxparameterset\s!cite\currentbtxcitevariant
+ \edef\currentbtxcitealternative{#1}%
+ \setbtxparameterset\s!cite\currentbtxcitealternative
\usebtxstyleandcolor\c!style\c!color
\btxparameter\c!left
\relax}
@@ -1408,9 +1445,34 @@
{\dotripleargument\publ_save_dataset}
\unexpanded\def\publ_save_dataset[#1][#2][#3]%
+ {\ifthirdargument
+ \publ_save_dataset_indeed[#1][#2][#3]%
+ \else\ifsecondargument
+ \doifassignmentelse{#2}%
+ {\publ_save_dataset_indeed[\s!default][#1][#2]}%
+ {\publ_save_dataset_indeed[#1][#2][]}%
+ \else\iffirstargument
+ \doifassignmentelse{#1}%
+ {\publ_save_dataset_indeed[\s!default][\jobname-saved.bib][#1]}%
+ {\publ_save_dataset_indeed[\s!default][#1][]}%
+ % \else
+ % % bad news
+ \fi\fi\fi}
+
+\unexpanded\def\publ_save_dataset_indeed[#1][#2][#3]%
{\begingroup
- \getdummyparameters[\c!criterium=\v!all,\c!alternative=,#3]% % all or used
- \ctxcommand{btxsavedataset("#1","#2","\dummyparameter\c!alternative","\dummyparameter\c!criterium")}%
+ \getdummyparameters
+ [\c!criterium=\v!all,%
+ \c!type=,%
+ \c!dataset=#1,%
+ \c!file=#2,%
+ #3]% % all or used
+ \ctxcommand{btxsavedataset{
+ dataset = "\dummyparameter\c!dataset",
+ filename = "\dummyparameter\c!file",
+ filetype = "\dummyparameter\c!type",
+ criterium = "\dummyparameter\c!criterium"
+ }}%
\endgroup}
% \savebtxdataset[default][e:/tmp/foo.bib]
@@ -1419,28 +1481,17 @@
%D In-text entries:
-% \definebtxcitevariant
-% [entry]
-
\unexpanded\def\placecitation{\citation[entry]} % [#1]
\unexpanded\def\btxhandleciteentry
{\dontleavehmode
\begingroup
- \def\currentbtxcitevariant{entry}%
- \setbtxparameterset\s!cite\currentbtxcitevariant % needs checking
+ \def\currentbtxcitealternative{entry}%
+ \setbtxparameterset\s!cite\currentbtxcitealternative % needs checking
\btxcitereference
\btx_entry_inject
\endgroup}
-\startsetups \s!btx:\s!cite:entry
- \ifx\currentbtxfirst\empty
- \fastbtxsetup\s!cite\s!unknown
- \else
- \btxhandleciteentry
- \fi
-\stopsetups
-
%D Registers
% \setupbtxregister
@@ -1484,19 +1535,19 @@
\unexpanded\def\btxindexedauthor#1#2#3#4#5#6% alternative von last first junior
{\begingroup
- \def\currentbtxcitevariant{#1}%
- \ifx\currentbtxcitevariant\empty
- \edef\currentbtxcitevariant{invertedshort}%
+ \def\currentbtxcitealternative{#1}%
+ \ifx\currentbtxcitealternative\empty
+ \edef\currentbtxcitealternative{invertedshort}% maybe we need some default here too?
\fi
- \let\currentbtxlistvariant\currentbtxcitevariant % we inherit
+ %let\currentbtxlistvariant\currentbtxcitealternative % we inherit
\the\everysetupbtxciteplacement
\def\currentbtxvons {#2}%
\def\currentbtxsurnames {#3}%
\def\currentbtxinitials {#4}%
\def\currentbtxfirstnames {#5}%
\def\currentbtxjuniors {#6}%
- \setbtxparameterset\s!cite\currentbtxcitevariant
- \fastsetup{\s!btx:\s!cite:\s!author:\currentbtxcitevariant}%
+ \setbtxparameterset\s!cite\currentbtxcitealternative
+ \fastsetup{\s!btx:\s!cite:\s!author:\currentbtxcitealternative}%
\endgroup}
%D We hook some setters in the definition sets:
@@ -1562,15 +1613,33 @@
\c!separator={;\space},
\c!distance=1.5\emwidth]
-% Quite some interpunction and labels are the same of at least consistent witin
+% Quite some interpunction and labels are the same of at least consistent within
% a standard when citations and list entries are involved. We assume that each
-% standard defines its own set but it can fall back on the defaults.
+% standard defines its own set but it can fall back on these defaults.
\setupbtx
- [\c!alternative=\v!num, % default cite
- \c!interaction=\v!start,
+ [\c!interaction=\v!start,
+ \c!alternative=num, % default cite form
+ \c!inbetween=\space,
+ \c!range=\endash, % separator:range?
+ \c!compress=\v!no,
\c!etallimit=3,
- \c!etaldisplay=\btxparameter\c!etallimit]
+ \c!etaldisplay=\btxparameter\c!etallimit,
+ \c!otherstext={\space et al.},
+ \c!separator:firstnames={\space},
+ \c!separator:juniors={\space},
+ \c!separator:vons={\space},
+ \c!separator:initials={\space},
+ \c!stopper:initials={.},
+ %\c!surnamesep={,\space}, % is this used anywhere?
+ \c!separator:invertedinitials={,\space},
+ \c!separator:invertedfirstnames={,\space},
+ \c!separator:names:2={,\space}, % separates multiple names
+ \c!separator:names:3=\btxparameter{\c!separator:2}, % before last name in a list
+ \c!separator:names:4=\btxparameter{\c!separator:2}, % between only two names
+ \c!separator:2={;\space}, % aka pubsep - separates multiple objects
+ \c!separator:3=\btxparameter{separator:2}, % before last object in a list
+ \c!separator:4=\btxparameter{separator:2}] % between only two objects
% Do we want these in the format? Loading them delayed is somewhat messy.
@@ -1592,7 +1661,7 @@
\setupbtx
[\c!specification=\s!default,
\c!dataset=\v!default,
- \c!default=]
+ \c!default=\v!default]
\loadbtxdefinitionfile
[\s!default]
diff --git a/tex/context/base/publ-reg.lua b/tex/context/base/publ-reg.lua
index 531c4dcf0..0a0815eeb 100644
--- a/tex/context/base/publ-reg.lua
+++ b/tex/context/base/publ-reg.lua
@@ -47,29 +47,32 @@ function commands.setbtxregister(specification)
s = { }
registrations[register] = s
end
- local d = s[dataset]
- if not d then
- d = { }
- s[dataset] = d
- end
- --
- -- check all
- --
local processors = name ~= register and name or ""
if processor == "" then
processor = nil
elseif processor then
processor = "btx:r:" .. processor
end
- --
- d.active = specification.state ~= v_stop
- d.once = specification.method == v_once or false
- d.field = field
- d.processor = processor
- d.alternative = d.alternative or specification.alternative
- d.register = register
- d.dataset = dataset
- d.done = d.done or { }
+ local datasets = utilities.parsers.settings_to_array(dataset)
+ for i=1,#datasets do
+ local dataset = datasets[i]
+ local d = s[dataset]
+ if not d then
+ d = { }
+ s[dataset] = d
+ end
+ --
+ -- check all
+ --
+ d.active = specification.state ~= v_stop
+ d.once = specification.method == v_once or false
+ d.field = field
+ d.processor = processor
+ d.alternative = d.alternative or specification.alternative
+ d.register = register
+ d.dataset = dataset
+ d.done = d.done or { }
+ end
--
sequence = { }
for register, s in sortedhash(registrations) do
diff --git a/tex/context/base/s-inf-03.mkiv b/tex/context/base/s-inf-03.mkiv
index 48449d690..7699c46d4 100644
--- a/tex/context/base/s-inf-03.mkiv
+++ b/tex/context/base/s-inf-03.mkiv
@@ -159,16 +159,16 @@ local skipglobal = table.tohash {
"_G", "_M", "_ENV", "",
"context", "modules", "global", "arg", "utf", 1,
"_ptbs_", "_pcol_", "_plib_", "_clib_", "_tlib_",
- "kpse",
+ "kpse", "commands",
}
local skipkeys = table.tohash {
"_pcol_", "_plib_", "_clib_", "_tlib_", "_bpnf_", "_ptbs_",
- "_cldf_", "_cldn_",
+ "_cldf_", "_cldn_", "_cldo_",
"_clmb_", "_clme_", "_clmm_", "_clmn_", "_clma_", "_clmh_",
"_G", "_M", "_ENV", "",
+ -- "global", "shortcuts",
"_VERSION", "_COPYRIGHT", "_DESCRIPTION", "_NAME", "_PACKAGE", "__unload",
-
}
local sameglobal = {
@@ -196,6 +196,8 @@ local variant = 1 -- all parents
local variant = 2 -- parent name too
local variant = 3 -- no parents
+local done = { }
+
local function childtables(key,tab,handler,depth)
depth = depth or 1
local keys = sortedkeys(tab) -- no sorted_pairs
@@ -214,6 +216,10 @@ local function childtables(key,tab,handler,depth)
t = "data"
handler(s,t,depth)
else
+if done[v] then
+ -- logs.report("inf-03","key %a in %a already done",k,v)
+else
+ done[v] = true
handler(s,t,depth)
if variant == 3 then
childtables(false,v,handler,depth+1)
@@ -223,6 +229,7 @@ local function childtables(key,tab,handler,depth)
childtables(s,v,handler,depth+1)
end
end
+end
else
handler(s,t,depth)
end
@@ -245,6 +252,7 @@ end
local function show(title,subtitle,alias,builtin,t,lib,libcolor,glo,glocolor,mark,obsolete)
-- todo: table as argument
+-- print(title,subtitle,alias,builtin,t,lib,libcolor,glo,glocolor,mark,obsolete)
local keys = sortedkeys(t) -- no sorted_pairs
if #keys > 0 then
local fulltitle = title
@@ -341,6 +349,8 @@ end
show("global","",sameglobal.global,false,_G,builtin,"darkgreen",globals,"darkblue",false,obsolete)
+-- inspect(table.sortedkeys(context))
+
for k, v in table.sortedpairs(_G) do
if not skipglobal[k] and not obsolete[k] and type(v) == "table" and not marked(v) then
@@ -351,7 +361,8 @@ for k, v in table.sortedpairs(_G) do
elseif extralua[k] then show(k,"extra lua",sameglobal[k],extralua[k],v,builtin[k],"darkred", false,false,true)
elseif basictex[k] then show(k,"basic tex",sameglobal[k],basictex[k],v,builtin[k],"darkred", false,false,true)
elseif extratex[k] then show(k,"extra tex",sameglobal[k],extratex[k],v,builtin[k],"darkred", false,false,true)
- else show(k,"context", sameglobal[k],false, v,builtin[k],"darkyellow",false,false,true)
+ else
+ show(k,"context", sameglobal[k],false, v,builtin[k],"darkyellow",false,false,true)
end
end
end
diff --git a/tex/context/base/s-math-repertoire.mkiv b/tex/context/base/s-math-repertoire.mkiv
index eeda5f66c..08c58aea3 100644
--- a/tex/context/base/s-math-repertoire.mkiv
+++ b/tex/context/base/s-math-repertoire.mkiv
@@ -421,7 +421,7 @@
\continueifinputfile{s-math-repertoire.mkiv}
-\showmathcharacterssetbodyfonts{lucidaot,cambria,xits,modern,pagella,termes,bonum,schola}
+\showmathcharacterssetbodyfonts{lucidaot,cambria,xits,modern,pagella,termes,bonum,schola,dejavu}
\starttext
@@ -437,10 +437,11 @@
% \setupbodyfont[stix, 12pt]
% \setupbodyfont[xits, 12pt]
% \setupbodyfont[lucida, 12pt]
- \setupbodyfont[lucidaot, 12pt]
+ % \setupbodyfont[lucidaot, 12pt]
% \setupbodyfont[pagella, 12pt]
% \setupbodyfont[bonum, 12pt]
% \setupbodyfont[schola, 12pt]
+ \setupbodyfont[dejavu, 12pt]
} {
diff --git a/tex/context/base/scrn-pag.mkvi b/tex/context/base/scrn-pag.mkvi
index 5bbdadda8..749c98e7a 100644
--- a/tex/context/base/scrn-pag.mkvi
+++ b/tex/context/base/scrn-pag.mkvi
@@ -124,13 +124,24 @@
%
% \starttext \input ward \stoptext
-\def\scrn_canvas_synchronize_simple
+\let\scrn_canvas_synchronize_simple \relax
+\let\scrn_canvas_synchronize_complex\relax
+
+\appendtoks
+ \global\let\scrn_canvas_synchronize_simple \scrn_canvas_synchronize_simple_indeed
+ \global\let\scrn_canvas_synchronize_complex\scrn_canvas_synchronize_complex_indeed
+\to \everysetuplayout
+
+\def\scrn_canvas_synchronize_simple_indeed
{\ctxcommand{setupcanvas{
paperwidth = \number\printpaperwidth,
paperheight = \number\printpaperheight
- }}}
+ }}%
+ %\global\let\scrn_canvas_synchronize_simple \relax
+ \global\let\scrn_canvas_synchronize_complex\relax
+ }
-\def\scrn_canvas_synchronize_complex
+\def\scrn_canvas_synchronize_complex_indeed
{\scrn_canvas_calculate % otherwise we need to hook it into setuppage etc
\ctxcommand{setupcanvas{
mode = "\interactionscreenparameter\c!option",
@@ -142,12 +153,22 @@
height = \number\canvasheight,
paperwidth = \number\canvasmaxwidth,
paperheight = \number\canvasmaxheight
- }}}
+ }}%
+ %\global\let\scrn_canvas_synchronize_simple \relax
+ \global\let\scrn_canvas_synchronize_complex\relax
+ }
\appendtoks
- \doifcommonelse{\interactionscreenparameter\c!option}{\v!max,\v!fit}%
- {\global\settrue \c_scrn_canvas_tight_page}%
- {\global\setfalse\c_scrn_canvas_tight_page}%
+ \begingroup
+ \edef\p_option{\interactionscreenparameter\c!option}%
+ \ifx\p_option\v!max
+ \global\settrue \c_scrn_canvas_tight_page
+ \else\ifx\p_option\v!fit
+ \global\settrue \c_scrn_canvas_tight_page
+ \else
+ \global\setfalse\c_scrn_canvas_tight_page
+ \fi\fi
+ \endgroup
\to \everysetupinteractionscreen
\setupinteractionscreen
@@ -159,6 +180,11 @@
\c!topspace=\topspace,
\c!option=\v!auto]
+\appendtoks
+ \global\let\scrn_canvas_synchronize_simple \scrn_canvas_synchronize_simple
+ \global\let\scrn_canvas_synchronize_complex\scrn_canvas_synchronize_complex
+\to \everysetupinteractionscreen
+
%D Conditional page breaks:
\unexpanded\def\screen
@@ -177,7 +203,10 @@
{\dosingleempty\scrn_transitions_setup}
\def\scrn_transitions_setup[#list]%
- {\edef\scrn_transitions_list{#list}}
+ {\edef\scrn_transitions_list{#list}%
+ \ifx\scrn_transitions_list\v!reset
+ \let\scrn_transitions_list\empty
+ \fi}
\def\scrn_transitions_set
{\iflocation \ifx\scrn_transitions_list\empty \else
diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv
index d61c7651b..d635d1435 100644
--- a/tex/context/base/spac-ver.mkiv
+++ b/tex/context/base/spac-ver.mkiv
@@ -142,6 +142,20 @@
\spacing\currentrelativeinterlinespace
\fi}
+\unexpanded\def\spac_linespacing_setup_use
+ {\ifcsname\namedinterlinespacehash\m_spac_interlinespace\s!parent\endcsname
+ \let\currentinterlinespace\m_spac_interlinespace
+ \spac_linespacing_setup_specified_interline_space
+ % \else
+ % we only support named interlinespaces
+ \fi}
+
+\unexpanded\def\useinterlinespaceparameter#1% see footnotes
+ {\edef\m_spac_interlinespace{#1\c!interlinespace}%
+ \ifx\m_spac_interlinespace\empty \else
+ \spac_linespacing_setup_use
+ \fi}
+
\newtoks\everysetupglobalinterlinespace
\newtoks\everysetuplocalinterlinespace
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index fc9fe0003..d42a70729 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 0a2a851dc..1905df03e 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua
index 11d9991d6..45c282256 100644
--- a/tex/context/base/status-mkiv.lua
+++ b/tex/context/base/status-mkiv.lua
@@ -320,7 +320,6 @@ return {
},
{
category = "mkiv",
- comment = "maybe this becomes a runtime module",
filename = "toks-ini",
loading = "always",
status = "okay",
@@ -4758,7 +4757,14 @@ return {
{
category = "lua",
filename = "toks-ini",
- status = "todo",
+ loading = "toks-ini",
+ status = "okay",
+ },
+ {
+ category = "lua",
+ filename = "toks-scn",
+ loading = "toks-ini",
+ status = "okay",
},
{
category = "lua",
diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua
index f63832035..1f7f01e4f 100644
--- a/tex/context/base/strc-doc.lua
+++ b/tex/context/base/strc-doc.lua
@@ -1011,18 +1011,3 @@ commands.popsectionblock = sections.popblock
commands.registersection = sections.register
commands.setsectionentry = sections.setentry
commands.reportstructure = sections.reportstructure
---
-
--- local byway = "^" .. v_by -- ugly but downward compatible
-
--- function commands.way(way)
--- context((gsub(way,byway,"")))
--- end
-
-local pattern = P(v_by)^-1 * C(P(1)^1)
-
-function commands.way(way)
- if way ~= "" then
- context(lpegmatch(pattern,way))
- end
-end
diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi
index 3de4766ca..982dc2fbe 100644
--- a/tex/context/base/strc-not.mkvi
+++ b/tex/context/base/strc-not.mkvi
@@ -1182,6 +1182,7 @@
\insert\currentnoteinsertionnumber\bgroup
\the\everyinsidenoteinsert\relax
\usesetupsparameter\noteparameter % experimental
+ \useinterlinespaceparameter\noteparameter
\doifelse{\noteparameter\c!paragraph}\v!yes
{\nointerlineskip
\startvboxtohboxseparator
@@ -1354,11 +1355,14 @@
% idea: tag with attr and then just flush them again
\def\strc_notes_flush_global
- {\doifelse{\noteparameter\c!paragraph}\v!yes
+ {\begingroup
+ \useinterlinespaceparameter\noteparameter
+ \doifelse{\noteparameter\c!paragraph}\v!yes
{\vbox\starthboxestohbox
\iftrialtypesetting\unvcopy\else\unvbox\fi\currentnoteinsertionnumber
\stophboxestohbox}
- {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}}
+ {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}%
+ \endgroup}
%D Supporting end notes is surprisingly easy. Even better, we
%D can combine this feature with solving the common \TEX\
diff --git a/tex/context/base/strc-num.lua b/tex/context/base/strc-num.lua
index e1fc60030..808d23fde 100644
--- a/tex/context/base/strc-num.lua
+++ b/tex/context/base/strc-num.lua
@@ -589,6 +589,15 @@ function commands.doifnotcounter (name) commands.doifnot (counterdata[name]) end
function commands.incrementedcounter(...) context(counters.add(...)) end
+local pattern = lpeg.P(variables.by)^-1 * lpeg.C(lpeg.P(1)^1)
+local lpegmatch = lpeg.match
+
+function commands.way(way)
+ if way and way ~= "" then
+ context(lpegmatch(pattern,way))
+ end
+end
+
-- the noreset is somewhat messy ... always false messes up e.g. itemize but true the pagenumbers
--
-- if this fails i'll clean up this still somewhat experimental mechanism (but i need use cases)
diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv
index eedf86a66..f08a65516 100644
--- a/tex/context/base/strc-reg.mkiv
+++ b/tex/context/base/strc-reg.mkiv
@@ -314,7 +314,7 @@
\setnextinternalreference
\xdef\currentregisternumber{\ctxcommand{storeregister{
metadata = { name = "\currentregister" },
- entries = { { \!!bs#2\!!es }, { \!!bs#3\!!es } },
+ entries = { \!!bs#2\!!es, \!!bs#3\!!es },
processors = { \!!bs#4\!!es, \!!bs#5\!!es },
}
}}%
diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv
index 26609443b..5cfedac7c 100644
--- a/tex/context/base/supp-box.mkiv
+++ b/tex/context/base/supp-box.mkiv
@@ -2803,6 +2803,10 @@
\setbox\nextbox\hbox{#2}%
\normalexpanded{\endgroup\edef\noexpand#1{\ctxcommand{boxtostring(\number\nextbox)}}}}
+%D Even more dirty:
+
+\let\hyphenatedhbox\hbox
+
\protect \endinput
% a bit of test code:
diff --git a/tex/context/base/syst-aux.lua b/tex/context/base/syst-aux.lua
index 69c9f8168..fba27a303 100644
--- a/tex/context/base/syst-aux.lua
+++ b/tex/context/base/syst-aux.lua
@@ -11,18 +11,23 @@ if not modules then modules = { } end modules ['syst-aux'] = {
-- utfmatch(str,"(.?)(.*)$")
-- utf.sub(str,1,1)
-local commands, context = commands, context
-
local tonumber = tonumber
-local settings_to_array = utilities.parsers.settings_to_array
local format = string.format
local utfsub = utf.sub
-local P, S, R, C, Cc, Cs, Carg, lpegmatch, utf8character = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg, lpeg.match, lpeg.patterns.utf8character
+local P, S, R, C, Cc, Cs, Carg, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg, lpeg.match
local todimen = number.todimen
-local setvalue = context.setvalue
+local commands = commands
+local context = context
+
+local setcatcode = tex.setcatcode
+
+local utf8character = lpeg.patterns.utf8character
+local settings_to_array = utilities.parsers.settings_to_array
+
+local setvalue = context.setvalue
-local pattern = C(utf8character^-1) * C(P(1)^0)
+local pattern = C(utf8character^-1) * C(P(1)^0)
function commands.getfirstcharacter(str)
local first, rest = lpegmatch(pattern,str)
@@ -99,8 +104,15 @@ local sentinel = spaces * (nohash^1 / "\\%0")
local sargument = (single * digit)^1
local dargument = (double * digit)^1
-local pattern = Cs(
- ( P("global") / "\\global" )^0
+local usespaces = nil
+local texpreamble = nil
+
+local pattern = Cs( -- ^-1
+ ( P("spaces") / function() usespaces = true return "" end )^0
+ * spaces
+ * ( P("nospaces") / function() usespaces = false return "" end )^0
+ * spaces
+ * ( P("global") / "\\global" )^0
* spaces
* ( P("unexpanded") / "\\unexpanded" )^0
* spaces
@@ -119,10 +131,27 @@ local pattern = Cs(
)
)
-function commands.thetexdefinition(str)
--- print(str)
--- print(lpegmatch(pattern,str))
- context(lpegmatch(pattern,str))
+local ctx_dostarttexdefinition = context.dostarttexdefinition
+
+function commands.texdefinition_1(str)
+ usespaces = nil
+ texpreamble = lpegmatch(pattern,str)
+ if usespaces == true then
+ setcatcode(32,10) -- space
+ setcatcode(13, 5) -- endofline
+ elseif usespaces == false then
+ setcatcode(32, 9) -- ignore
+ setcatcode(13, 9) -- ignore
+ else
+ -- this is default
+ -- setcatcode(32,10) -- space
+ -- setcatcode(13, 9) -- ignore
+ end
+ ctx_dostarttexdefinition()
+end
+
+function commands.texdefinition_2()
+ context(texpreamble)
end
local upper, lower, strip = utf.upper, utf.lower, string.strip
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 38afd034f..9546026e9 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -74,13 +74,20 @@
% %def\expunded#1{\normalexpanded\expandafter{#1}}
% \def\expunded#1{\expandafter\empty#1} % used within an edef anyway
-
%D As we don't have namespace definers yet, we use a special one:
-\newcount\c_syst_helpers_n_of_namespaces \c_syst_helpers_n_of_namespaces\pluseight % 1-8 reserved for catcodes
+\ifdefined\c_syst_helpers_n_of_namespaces
+
+ % lets plug in a better error message
+
+\else
+
+ \newcount\c_syst_helpers_n_of_namespaces \c_syst_helpers_n_of_namespaces\pluseight % 1-8 reserved for catcodes
+
+ \def\v_interfaces_prefix_template_system{\number \c_syst_helpers_n_of_namespaces>>}
+ %def\v_interfaces_prefix_template_system{\characters\c_syst_helpers_n_of_namespaces>>} % no \characters yet
-\def\v_interfaces_prefix_template_system{\number \c_syst_helpers_n_of_namespaces>>}
-%def\v_interfaces_prefix_template_system{\characters\c_syst_helpers_n_of_namespaces>>} % no \characters yet
+\fi
\unexpanded\def\installsystemnamespace#1% maybe move this to syst-ini
{\ifcsname ??#1\endcsname
@@ -3258,6 +3265,25 @@
% [here #oeps: \the\scratchcounter]
% \stoptexdefinition
+% \bgroup \obeylines
+%
+% \global\let\stoptexdefinition\relax
+%
+% \unexpanded\gdef\starttexdefinition%
+% {\bgroup%
+% \obeylines%
+% \syst_helpers_start_tex_definition_one}
+%
+% \gdef\syst_helpers_start_tex_definition_one#1
+% {\catcode\endoflineasciicode\ignorecatcode%
+% \syst_helpers_start_tex_definition_two{#1}}
+%
+% \gdef\syst_helpers_start_tex_definition_two#1#2\stoptexdefinition%
+% {\egroup%
+% \ctxcommand{thetexdefinition("#1")}{#2}}
+%
+% \egroup
+
\bgroup \obeylines
\global\let\stoptexdefinition\relax
@@ -3265,15 +3291,15 @@
\unexpanded\gdef\starttexdefinition%
{\bgroup%
\obeylines%
- \syst_helpers_start_tex_definition_one}
+ \syst_helpers_start_tex_definition}
-\gdef\syst_helpers_start_tex_definition_one#1
+\gdef\syst_helpers_start_tex_definition#1
{\catcode\endoflineasciicode\ignorecatcode%
- \syst_helpers_start_tex_definition_two{#1}}
+ \ctxcommand{texdefinition_1("#1")}}
-\gdef\syst_helpers_start_tex_definition_two#1#2\stoptexdefinition%
+\gdef\dostarttexdefinition#1\stoptexdefinition%
{\egroup%
- \ctxcommand{thetexdefinition("#1")}{#2}}
+ \ctxcommand{texdefinition_2()}{#1}}
\egroup
diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv
index 879f3ed53..5ff80531a 100644
--- a/tex/context/base/syst-ini.mkiv
+++ b/tex/context/base/syst-ini.mkiv
@@ -1115,4 +1115,21 @@
%D
%D So let's see what \TEX\ can do now that we've opened up the basic machinery.
+%D Now we define a few helpers that we need in a very early stage. We hav eno message system
+%D yet but redundant definitions are fatal anyway.
+
+\newcount\c_syst_helpers_n_of_namespaces \c_syst_helpers_n_of_namespaces\pluseight % 1-8 reserved for catcodes
+
+\def\v_interfaces_prefix_template_system{\number \c_syst_helpers_n_of_namespaces>>}
+%def\v_interfaces_prefix_template_system{\characters\c_syst_helpers_n_of_namespaces>>} % no \characters yet
+
+\normalprotected\def\installsystemnamespace#1%
+ {\ifcsname ??#1\endcsname
+ \immediate\write16{fatal error: duplicate system namespace '#1'}%
+ \expandafter\normalend
+ \else
+ \global\advance\c_syst_helpers_n_of_namespaces\plusone
+ \expandafter\edef\csname ??#1\endcsname{\v_interfaces_prefix_template_system}%
+ \fi}
+
\protect \endinput
diff --git a/tex/context/base/syst-lua.lua b/tex/context/base/syst-lua.lua
index c50c5f1ca..37353c74e 100644
--- a/tex/context/base/syst-lua.lua
+++ b/tex/context/base/syst-lua.lua
@@ -14,6 +14,9 @@ commands = commands or { }
local commands = commands
local context = context
+local csprint = context.sprint
+
+local prtcatcodes = tex.prtcatcodes
function commands.writestatus(...) logs.status(...) end -- overloaded later
@@ -30,24 +33,30 @@ local ctx_gobbleoneargument = context.gobbleoneargument -- context.constru
function commands.doifelse(b)
if b then
ctx_firstoftwoarguments()
+-- csprint(prtcatcodes,[[\ui_ft]]) -- ctx_firstoftwoarguments
else
ctx_secondoftwoarguments()
+-- csprint(prtcatcodes,[[\ui_st]]) -- ctx_secondoftwoarguments
end
end
function commands.doif(b)
if b then
ctx_firstofoneargument()
+-- context.__flushdirect(prtcatcodes,[[\ui_fo]]) -- ctx_firstofonearguments
else
ctx_gobbleoneargument()
+-- context.__flushdirect(prtcatcodes,[[\ui_go]]) -- ctx_gobbleonearguments
end
end
function commands.doifnot(b)
if b then
ctx_gobbleoneargument()
+-- csprint(prtcatcodes,[[\ui_go]]) -- ctx_gobbleonearguments
else
ctx_firstofoneargument()
+-- csprint(prtcatcodes,[[\ui_fo]]) -- ctx_firstofonearguments
end
end
diff --git a/tex/context/base/toks-ini.lua b/tex/context/base/toks-ini.lua
index 82c801b88..9fcbd4345 100644
--- a/tex/context/base/toks-ini.lua
+++ b/tex/context/base/toks-ini.lua
@@ -61,6 +61,8 @@ if newtoken then
local scan_glue = newtoken.scan_glue
local scan_keyword = newtoken.scan_keyword
local scan_token = newtoken.scan_token
+ local scan_word = newtoken.scan_word
+ local scan_number = newtoken.scan_number
local get_next = newtoken.get_next
@@ -102,52 +104,69 @@ if newtoken then
local t = { } -- small optimization, a shared variable that is not reset
- local function scan_word()
- local n = 0
- while true do
- local c = scan_code()
- if c then
- n = n + 1
- t[n] = utfchar(c)
- elseif scan_code(space_bits) then
- if n > 0 then
+ if scan_word then
+
+ scan_number = function(base)
+ local s = scan_word()
+ if not s then
+ return nil
+ elseif base then
+ return tonumber(s,base)
+ else
+ return tonumber(s)
+ end
+ end
+
+ else
+
+ scan_word = function()
+ local n = 0
+ while true do
+ local c = scan_code()
+ if c then
+ n = n + 1
+ t[n] = utfchar(c)
+ elseif scan_code(space_bits) then
+ if n > 0 then
+ break
+ end
+ elseif n > 0 then
break
+ else
+ return
end
- elseif n > 0 then
- break
- else
- return
end
+ return concat(t,"",1,n)
end
- return concat(t,"",1,n)
- end
- -- so we gobble the space (like scan_int) (number has to be space or non-char terminated
- -- as we accept 0xabcd and such so there is no clear separator for a keyword
-
- local function scan_number(base)
- local n = 0
- while true do
- local c = scan_code()
- if c then
- n = n + 1
- t[n] = char(c)
- elseif scan_code(space_bits) then
- if n > 0 then
+ -- so we gobble the space (like scan_int) (number has to be space or non-char terminated
+ -- as we accept 0xabcd and such so there is no clear separator for a keyword
+
+ scan_number = function(base)
+ local n = 0
+ while true do
+ local c = scan_code()
+ if c then
+ n = n + 1
+ t[n] = char(c)
+ elseif scan_code(space_bits) then
+ if n > 0 then
+ break
+ end
+ elseif n > 0 then
break
+ else
+ return
end
- elseif n > 0 then
- break
+ end
+ local s = concat(t,"",1,n)
+ if base then
+ return tonumber(s,base)
else
- return
+ return tonumber(s)
end
end
- local s = concat(t,"",1,n)
- if base then
- return tonumber(s,base)
- else
- return tonumber(s)
- end
+
end
-- -- the next one cannot handle \iftrue true\else false\fi
@@ -193,10 +212,16 @@ if newtoken then
tokens.getters = { -- these don't expand
token = get_next,
+ count = tex.getcount,
+ dimen = tex.getdimen,
+ box = tex.getbox,
}
tokens.setters = {
macro = set_macro,
+ count = tex.setcount,
+ dimen = tex.setdimen,
+ box = tex.setbox,
}
end
diff --git a/tex/context/base/toks-ini.mkiv b/tex/context/base/toks-ini.mkiv
index c23b84e06..49625a939 100644
--- a/tex/context/base/toks-ini.mkiv
+++ b/tex/context/base/toks-ini.mkiv
@@ -14,6 +14,8 @@
\writestatus{loading}{ConTeXt Token Support / Initialization}
\registerctxluafile{toks-ini}{1.001}
+\registerctxluafile{toks-scn}{1.001}
+\registerctxluafile{cldf-scn}{1.001}
\unprotect
diff --git a/tex/context/base/toks-scn.lua b/tex/context/base/toks-scn.lua
new file mode 100644
index 000000000..3da962dad
--- /dev/null
+++ b/tex/context/base/toks-scn.lua
@@ -0,0 +1,378 @@
+if not modules then modules = { } end modules ['toks-scn'] = {
+ version = 1.001,
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- Writing this kind of code (and completing the newtoken code base) is fun. I did
+-- so with the brilliant film music from The Girl with the Dragon Tattoo running in a
+-- loop in the background (three cd's by Trent Reznor and Atticus Ross). An alien
+-- feeling helps with alien code.
+
+-- todo: more \let's at the tex end
+
+local type, next, tostring, tonumber = type, next, tostring, tonumber
+
+local formatters = string.formatters
+local concat = table.concat
+local loadstring = loadstring
+
+local scanners = tokens.scanners
+local tokenbits = tokens.bits
+
+if not scanners then return end -- for now
+
+local scanstring = scanners.string
+local scaninteger = scanners.integer
+local scannumber = scanners.number
+local scankeyword = scanners.keyword
+local scanword = scanners.word
+local scancode = scanners.code
+local scanboolean = scanners.boolean
+local scandimen = scanners.dimen
+
+if not scanstring then return end -- for now
+
+local todimen = number.todimen
+
+local lpegmatch = lpeg.match
+local p_unquoted = lpeg.patterns.unquoted
+
+local trace_compile = false trackers.register("tokens.compile", function(v) trace_compile = v end)
+local report_compile = logs.reporter("tokens","compile")
+local report_scan = logs.reporter("tokens","scan")
+
+local open = tokenbits.open
+local close = tokenbits.close
+
+local function scanopen()
+ while true do
+ local c = scancode(open)
+ if c == 123 then
+ return true
+ -- elseif c ~= 32 then
+ elseif not c then
+ return
+ end
+ end
+end
+
+local function scanclose()
+ while true do
+ local c = scancode(close)
+ if c == 125 then
+ return true
+ -- elseif c ~= 32 then
+ elseif not c then
+ return
+ end
+ end
+end
+
+scanners.scanopen = scanopen
+scanners.scanclose = scanclose
+
+local shortcuts = {
+ tokens = tokens,
+ bits = tokenbits,
+ open = open,
+ close = close,
+ scanners = scanners,
+ scanstring = scanstring,
+ scaninteger = scaninteger,
+ scannumber = scannumber,
+ scankeyword = scankeyword,
+ scanword = scanword,
+ scancode = scancode,
+ scanboolean = scanboolean,
+ scandimen = scandimen,
+ scandimension = scandimen,
+ scanopen = scanopen,
+ scanclose = scanclose,
+ todimen = todimen,
+ tonumber = tonumber,
+ tostring = tostring,
+ inspect = inspect,
+ report = report_scan,
+}
+
+tokens.shortcuts = shortcuts
+
+local load = load
+local dump = string.dump
+
+local function loadstripped(code)
+ return load(code,nil,nil,shortcuts)
+ -- return load(dump(load(code),true),nil,nil,shortcuts)
+end
+
+tokens.converters = {
+ tonumber = "tonumber",
+ todimen = "todimen",
+ toglue = "todimen",
+ tostring = "tostring",
+}
+
+local f_if = formatters[ " if scankeyword('%s') then data['%s'] = scan%s()"]
+local f_elseif = formatters[" elseif scankeyword('%s') then data['%s'] = scan%s()"]
+local f_local = formatters["local scan%s = scanners.%s"]
+local f_scan = formatters["scan%s()"]
+local f_shortcut = formatters["local %s = scanners.converters.%s"]
+
+local f_if_c = formatters[ " if scankeyword('%s') then data['%s'] = %s(scan%s())"]
+local f_elseif_c = formatters[" elseif scankeyword('%s') then data['%s'] = %s(scan%s())"]
+local f_scan_c = formatters["%s(scan%s())"]
+
+local f_any = formatters[" else local key = scanword() if key then data[key] = scan%s() else break end end"]
+local f_any_c = formatters[" else local key = scanword() if key then data[key] = %s(scan%s()) else break end end"]
+local s_done = " else break end"
+
+local f_table = formatters["%\nt\nreturn function()\n local data = { }\n%s\n return %s\nend\n"]
+local f_sequence = formatters["%\nt\n%\nt\n%\nt\nreturn function()\n return %s\nend\n"]
+local f_simple = formatters["%\nt\nreturn function()\n return %s\nend\n"]
+local f_string = formatters["%q"]
+local f_action_f = formatters["action%s(%s)"]
+local f_action_s = formatters["local action%s = tokens._action[%s]"]
+local f_nested = formatters["local function scan%s()\n local data = { }\n%s\n return data\nend\n"]
+
+-- local f_check = formatters[ [[
+-- local wrapped = false
+-- while true do
+-- local c = scancode(open)
+-- if c == 123 then
+-- wrapped = true
+-- break
+-- elseif c ~= 32 then
+-- break
+-- end
+-- end
+-- while true do
+-- ]] .. "%\nt\n" .. [[
+-- %s
+-- end
+-- if wrapped then
+-- while true do
+-- local c = scancode(close)
+-- if c == 125 then
+-- break
+-- elseif c ~= 32 then
+-- break
+-- end
+-- end
+-- end
+-- ]] ]
+
+local f_check = formatters[ [[
+ local wrapped = scanopen()
+ while true do
+ ]] .. "%\nt\n" .. [[
+ %s
+ end
+ if wrapped then
+ scanclose()
+ end
+]] ]
+
+function tokens.compile(specification)
+ local f = { }
+ local n = 0
+ local c = { }
+ local t = specification.arguments or specification
+ local a = specification.actions or nil
+ if type(a) == "function" then
+ a = { a }
+ end
+ local code
+ local function compile(t,nested)
+ local done = s_done
+ local r = { }
+ local m = 0
+ for i=1,#t do
+ local ti = t[i]
+ local t1 = ti[1]
+ local t2 = ti[2] or "string"
+ if type(t2) == "table" then
+ n = n + 1
+ f[n] = compile(t2,n)
+ t2 = n
+ end
+ local t3 = ti[3]
+ if type(t3) == "function" then
+ -- todo: also create shortcut
+ elseif t3 then
+ c[t3] = f_shortcut(t3,t3)
+ if t1 == "*" then
+ done = f_any_c(t3,t2)
+ else
+ m = m + 1
+ r[m] = (m > 1 and f_elseif_c or f_if_c)(t1,t1,t3,t2)
+ end
+ else
+ if t1 == "*" then
+ done = f_any(t2)
+ else
+ m = m + 1
+ r[m] = (m > 1 and f_elseif or f_if )(t1,t1,t2)
+ end
+ end
+ end
+ local c = f_check(r,done)
+ if nested then
+ return f_nested(nested,c)
+ else
+ return c
+ end
+ end
+ local tt = type(t)
+ if tt == "string" then
+ if a then
+ code = f_scan(t)
+ tokens._action = a
+ for i=1,#a do
+ code = f_action_f(i,code)
+ f[#f+1] = f_action_s(i,i)
+ end
+ code = f_simple(f,code)
+ else
+ return scanners[t]
+ end
+ elseif tt ~= "table" then
+ return
+ elseif #t == 1 then
+ local ti = t[1]
+ if type(ti) == "table" then
+ ti = compile(ti)
+ code = "data"
+ if a then
+ tokens._action = a
+ for i=1,#a do
+ code = f_action_f(i,code)
+ f[#f+1] = f_action_s(i,i)
+ end
+ end
+ code = f_table(f,ti,code)
+ elseif a then
+ code = f_scan(ti)
+ tokens._action = a
+ for i=1,#a do
+ code = f_action_f(i,code)
+ f[#f+1] = f_action_s(i,i)
+ end
+ code = f_simple(f,code)
+ else
+ return scanners[ti]
+ end
+ else
+ local r = { }
+ local p = { }
+ local m = 0
+ for i=1,#t do
+ local ti = t[i]
+ local tt = type(ti)
+ if tt == "table" then
+ if ti[1] == "_constant_" then
+ local v = ti[2]
+ if type(v) == "string" then
+ r[i] = f_string(v)
+ else
+ r[i] = tostring(v)
+ end
+ else
+ m = m + 1
+ p[m] = compile(ti,100+m)
+ r[i] = f_scan(100+m)
+ end
+ elseif tt == "number" then
+ r[i] = tostring(ti)
+ elseif tt == "boolean" then
+ r[i] = tostring(ti)
+ else
+ local s = lpegmatch(p_unquoted,ti)
+ if s and ti ~= s then
+ r[i] = ti -- a string, given as "'foo'" or '"foo"'
+ elseif scanners[ti] then
+ r[i] = f_scan(ti)
+ else
+ report_compile("unknown scanner %a",ti)
+ r[i] = ti
+ end
+ end
+ end
+ code = concat(r,",")
+ if a then
+ tokens._action = a
+ for i=1,#a do
+ code = f_action_f(i,code)
+ f[#f+1] = f_action_s(i,i)
+ end
+ end
+ code = f_sequence(c,f,p,code)
+ end
+ if not code then
+ return
+ end
+ if trace_compile then
+ report_compile("code: %s",code)
+ end
+ local code, message = loadstripped(code)
+ if code then
+ code = code() -- sets action
+ else
+ report_compile("error in code: %s",code)
+ report_compile("error message: %s",message)
+ end
+ if a then
+ tokens._action = nil
+ end
+ if code then
+ return code
+ end
+end
+
+-- local fetch = tokens.compile {
+-- "string",
+-- "string",
+-- {
+-- { "data", "string" },
+-- { "tab", "string" },
+-- { "method", "string" },
+-- { "foo", {
+-- { "method", "integer" },
+-- { "compact", "number" },
+-- { "nature" },
+-- { "*" }, -- any key
+-- } },
+-- { "compact", "string", "tonumber" },
+-- { "nature", "boolean" },
+-- { "escape", "string" },
+-- { "escape" },
+-- }
+-- "boolean",
+-- }
+--
+-- os.exit()
+
+function tokens.scantable(t,data)
+ if not data then
+ data = { }
+ end
+ local wrapped = scanopen()
+ while true do
+ local key = scanword()
+ if key then
+ local get = t[key]
+ if get then
+ data[key] = get()
+ else
+ -- catch all we can get
+ end
+ else
+ break
+ end
+ end
+ if wrapped then
+ scanclose()
+ end
+ return data
+end
diff --git a/tex/context/base/type-imp-dejavu.mkiv b/tex/context/base/type-imp-dejavu.mkiv
index de1f7752c..41cf1f701 100644
--- a/tex/context/base/type-imp-dejavu.mkiv
+++ b/tex/context/base/type-imp-dejavu.mkiv
@@ -15,33 +15,6 @@
\starttypescriptcollection[dejavu]
- \starttypescript [\s!mono] [dejavu-condensed] [\s!name]
- \setups[\s!font:\s!fallback:\s!mono]
- % \definefontsynonym [\s!Mono] [\s!name:dejavusansmonocondensed] [\s!features=\s!none]
- % \definefontsynonym [\s!MonoBold] [\s!name:dejavusansmonoboldcondensed] [\s!features=\s!none]
- % \definefontsynonym [\s!MonoItalic] [\s!name:dejavusansmonoobliquecondensed] [\s!features=\s!none]
- % \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldobliquecondensed] [\s!features=\s!none]
- \definefontsynonym [\s!Mono] [\s!name:dejavusansmono] [\s!features=dejavu-condensed-mono]
- \definefontsynonym [\s!MonoBold] [\s!name:dejavusansmonobold] [\s!features=dejavu-condensed-mono]
- \definefontsynonym [\s!MonoItalic] [\s!name:dejavusansmonooblique] [\s!features=dejavu-condensed-mono]
- \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=dejavu-condensed-mono]
- \stoptypescript
-
- % \starttypescript [\s!mono] [dejavu-condensed] [\s!name]
- % \setups[\s!font:\s!fallback:\s!mono]
- % \definefontsynonym [\s!Mono] [\s!name:dejavusansmono] [\s!features=\s!none]
- % \definefontsynonym [\s!MonoBold] [\s!name:dejavusansmonobold] [\s!features=\s!none]
- % \definefontsynonym [\s!MonoItalic] [\s!name:dejavusansmonooblique] [\s!features=\s!none]
- % \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=\s!none]
- % \stoptypescript
-
- \starttypescript[dejavu-condensed]
- \definetypeface [dejavu-condensed] [\s!rm] [\s!serif] [dejavu-condensed] [\s!default]
- \definetypeface [dejavu-condensed] [\s!ss] [\s!sans] [dejavu-condensed] [\s!default]
- \definetypeface [dejavu-condensed] [\s!tt] [\s!mono] [dejavu-condensed] [\s!default]
- \definetypeface [dejavu-condensed] [\s!mm] [\s!math] [xits] [\s!default] [\s!rscale=1.2]
- \stoptypescript
-
\starttypescript [\s!serif] [dejavu] [\s!name]
\setups[\s!font:\s!fallback:\s!serif]
\definefontsynonym [\s!Serif] [\s!name:dejavuserif] [\s!features=\s!default]
@@ -66,11 +39,17 @@
\definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=\s!none]
\stoptypescript
+ \starttypescript [\s!math][dejavu][\s!name]
+ %\loadfontgoodies[dejavu]
+ \definefontsynonym[\s!MathRoman][file:dejavu-math.otf][\s!features=\s!math\mathsizesuffix]
+ \stoptypescript
+
\starttypescript[dejavu]
\definetypeface [dejavu] [\s!rm] [\s!serif] [dejavu] [\s!default]
\definetypeface [dejavu] [\s!ss] [\s!sans] [dejavu] [\s!default]
\definetypeface [dejavu] [\s!tt] [\s!mono] [dejavu] [\s!default]
- \definetypeface [dejavu] [\s!mm] [\s!math] [xits] [\s!default] [\s!rscale=1.2]
+% \definetypeface [dejavu] [\s!mm] [\s!math] [xits] [\s!default] [\s!rscale=1.2]
+ \definetypeface [dejavu] [\s!mm] [\s!math] [dejavu] [\s!default]
\stoptypescript
\starttypescript[dejavubidi]
@@ -96,4 +75,32 @@
\definefontsynonym [\s!SansBoldItalic] [\s!name:dejavusanscondensedboldoblique] [\s!features=\s!default]
\stoptypescript
+ \starttypescript [\s!mono] [dejavu-condensed] [\s!name]
+ \setups[\s!font:\s!fallback:\s!mono]
+ % \definefontsynonym [\s!Mono] [\s!name:dejavusansmonocondensed] [\s!features=\s!none]
+ % \definefontsynonym [\s!MonoBold] [\s!name:dejavusansmonoboldcondensed] [\s!features=\s!none]
+ % \definefontsynonym [\s!MonoItalic] [\s!name:dejavusansmonoobliquecondensed] [\s!features=\s!none]
+ % \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldobliquecondensed] [\s!features=\s!none]
+ \definefontsynonym [\s!Mono] [\s!name:dejavusansmono] [\s!features=dejavu-condensed-mono]
+ \definefontsynonym [\s!MonoBold] [\s!name:dejavusansmonobold] [\s!features=dejavu-condensed-mono]
+ \definefontsynonym [\s!MonoItalic] [\s!name:dejavusansmonooblique] [\s!features=dejavu-condensed-mono]
+ \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=dejavu-condensed-mono]
+ \stoptypescript
+
+ % \starttypescript [\s!mono] [dejavu-condensed] [\s!name]
+ % \setups[\s!font:\s!fallback:\s!mono]
+ % \definefontsynonym [\s!Mono] [\s!name:dejavusansmono] [\s!features=\s!none]
+ % \definefontsynonym [\s!MonoBold] [\s!name:dejavusansmonobold] [\s!features=\s!none]
+ % \definefontsynonym [\s!MonoItalic] [\s!name:dejavusansmonooblique] [\s!features=\s!none]
+ % \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=\s!none]
+ % \stoptypescript
+
+ \starttypescript[dejavu-condensed]
+ \definetypeface [dejavu-condensed] [\s!rm] [\s!serif] [dejavu-condensed] [\s!default]
+ \definetypeface [dejavu-condensed] [\s!ss] [\s!sans] [dejavu-condensed] [\s!default]
+ \definetypeface [dejavu-condensed] [\s!tt] [\s!mono] [dejavu-condensed] [\s!default]
+% \definetypeface [dejavu-condensed] [\s!mm] [\s!math] [xits] [\s!default] [\s!rscale=1.2]
+ \definetypeface [dejavu-condensed] [\s!mm] [\s!math] [dejavu] [\s!default]
+ \stoptypescript
+
\stoptypescriptcollection
diff --git a/tex/context/base/typo-del.mkiv b/tex/context/base/typo-del.mkiv
index 2b4e6e6aa..4c3c5ab3d 100644
--- a/tex/context/base/typo-del.mkiv
+++ b/tex/context/base/typo-del.mkiv
@@ -394,7 +394,7 @@
\blank[\p_delimited_spaceafter]%
\fi
\useindentnextparameter\delimitedtextparameter
- \dorechecknextindentation}% AM: This was missing!
+ \aftergroup\dorechecknextindentation}% AM: This was missing!
\def\typo_delimited_start_txt
{\let\typo_delimited_stop\typo_delimited_stop_txt
diff --git a/tex/context/base/typo-itc.lua b/tex/context/base/typo-itc.lua
index 5e1ff3fbc..1de481a49 100644
--- a/tex/context/base/typo-itc.lua
+++ b/tex/context/base/typo-itc.lua
@@ -228,6 +228,12 @@ function italics.handler(head)
replaceinserted = nil
postinserted = nil
elseif id == disc_code then
+ previnserted = nil
+ previtalic = 0
+ replaceinserted = nil
+ replaceitalic = 0
+ postinserted = nil
+ postitalic = 0
replace = getfield(current,"replace")
if replace then
local current = find_tail(replace)
@@ -259,18 +265,21 @@ function italics.handler(head)
replace = current
end
end
- else
- replaceitalic = 0
+-- else
+-- replaceitalic = 0
end
- else
- replaceitalic = 0
+-- else
+-- replaceitalic = 0
end
- else
- replaceitalic = 0
+-- else
+-- replaceitalic = 0
end
- replaceinserted = nil
+-- replaceinserted = nil
+-- else
+-- replaceitalic = 0
+-- replaceinserted = nil
end
- local post = getfield(current,"post")
+ post = getfield(current,"post")
if post then
local current = find_tail(post)
if getid(current) ~= glyph_code then
@@ -286,7 +295,7 @@ function italics.handler(head)
local cd = data[char]
if not cd then
-- this really can happen
- postitalic = 0
+-- postitalic = 0
else
postitalic = cd.italic or cd.italic_correction
if not postitalic then
@@ -301,16 +310,19 @@ function italics.handler(head)
post = current
end
end
- else
- postitalic = 0
+-- else
+-- postitalic = 0
end
- else
- postitalic = 0
+-- else
+-- postitalic = 0
end
- else
- postitalic = 0
+-- else
+-- postitalic = 0
end
- postinserted = nil
+-- postinserted = nil
+-- else
+-- postitalic = 0
+-- postinserted = nil
end
elseif id == kern_code then -- how about fontkern ?
previnserted = nil
@@ -350,23 +362,37 @@ function italics.handler(head)
end
elseif id == math_code then
current = end_of_math(current)
+ previnserted = nil
+ previtalic = 0
+ replaceinserted = nil
+ replaceitalic = 0
+ postinserted = nil
+ postitalic = 0
else
if previtalic ~= 0 then
if trace_italics then
report_italics("inserting %p between %s italic %C and whatever",previtalic,"glyph",prevchar)
end
insert_node_after(prevhead,prev,new_correction_kern(previtalic))
- previnserted = nil
- previtalic = 0
- done = true
+ previnserted = nil
+ previtalic = 0
+ replaceinserted = nil
+ replaceitalic = 0
+ postinserted = nil
+ postitalic = 0
+ done = true
else
if replaceitalic ~= 0 then
if trace_italics then
report_italics("inserting %p between %s italic %C and whatever",replaceritalic,"replace",replacechar)
end
insert_node_after(replacehead,replace,new_correction_kern(replaceitalic))
- replaceitalic = 0
+ previnserted = nil
+ previtalic = 0
replaceinserted = nil
+ replaceitalic = 0
+ postinserted = nil
+ postitalic = 0
done = true
end
if postitalic ~= 0 then
@@ -374,9 +400,13 @@ function italics.handler(head)
report_italics("inserting %p between %s italic %C and whatever",postitalic,"post",postchar)
end
insert_node_after(posthead,post,new_correction_kern(postitalic))
- postinserted = nil
- postitalic = 0
- done = true
+ previnserted = nil
+ previtalic = 0
+ replaceinserted = nil
+ replaceitalic = 0
+ postinserted = nil
+ postitalic = 0
+ done = true
end
end
end
diff --git a/tex/context/base/util-seq.lua b/tex/context/base/util-seq.lua
index 4dd9ddc33..08fc4e95c 100644
--- a/tex/context/base/util-seq.lua
+++ b/tex/context/base/util-seq.lua
@@ -17,13 +17,15 @@ use locals to refer to them when compiling the chain.</p>
-- todo: protect groups (as in tasks)
-local format, gsub, concat, gmatch = string.format, string.gsub, table.concat, string.gmatch
+local gsub, concat, gmatch = string.gsub, table.concat, string.gmatch
local type, load = type, load
utilities = utilities or { }
local tables = utilities.tables
local allocate = utilities.storage.allocate
+local formatters = string.formatters
+
local sequencers = { }
utilities.sequencers = sequencers
@@ -217,20 +219,23 @@ local function construct(t)
for i=1,#actions do
local action = actions[i]
if not askip[action] then
+ local localized
if type(action) == "function" then
local name = localize(tostring(action))
functions[name] = action
- action = format("utilities.sequencers.functions.%s",name)
+ action = formatters["utilities.sequencers.functions.%s"](name)
+ localized = localize(name) -- shorter than action
+ else
+ localized = localize(action)
end
- local localized = localize(action)
n = n + 1
- variables[n] = format("local %s = %s",localized,action)
+ variables[n] = formatters["local %s = %s"](localized,action)
if not returnvalues then
- calls[n] = format("%s(%s)",localized,arguments)
+ calls[n] = formatters["%s(%s)"](localized,arguments)
elseif n == 1 then
- calls[n] = format("local %s = %s(%s)",returnvalues,localized,arguments)
+ calls[n] = formatters["local %s = %s(%s)"](returnvalues,localized,arguments)
else
- calls[n] = format("%s = %s(%s)",returnvalues,localized,arguments)
+ calls[n] = formatters["%s = %s(%s)"](returnvalues,localized,arguments)
end
end
end
@@ -243,9 +248,9 @@ local function construct(t)
variables = concat(variables,"\n")
calls = concat(calls,"\n")
if results then
- t.compiled = format("%s\nreturn function(%s)\n%s\nreturn %s\nend",variables,arguments,calls,results)
+ t.compiled = formatters["%s\nreturn function(%s)\n%s\nreturn %s\nend"](variables,arguments,calls,results)
else
- t.compiled = format("%s\nreturn function(%s)\n%s\nend",variables,arguments,calls)
+ t.compiled = formatters["%s\nreturn function(%s)\n%s\nend"](variables,arguments,calls)
end
end
-- print(t.compiled)
@@ -271,6 +276,7 @@ compile = function(t,compiler,n) -- already referred to in sequencers.new
if compiled == "" then
runner = false
else
+-- inspect(compiled)
runner = compiled and load(compiled)() -- we can use loadstripped here
end
t.runner = runner
@@ -327,12 +333,12 @@ function sequencers.nodeprocessor(t,nofarguments) -- todo: handle 'kind' in plug
if not askip[action] then
local localized = localize(action)
n = n + 1
- vars[n] = format("local %s = %s",localized,action)
+ vars[n] = formatters["local %s = %s"](localized,action)
-- only difference with tostring is kind and rets (why no return)
if kind[action] == "nohead" then
- calls[n] = format(" ok = %s(head%s) done = done or ok",localized,args)
+ calls[n] = formatters[" ok = %s(head%s) done = done or ok"](localized,args)
else
- calls[n] = format(" head, ok = %s(head%s) done = done or ok",localized,args)
+ calls[n] = formatters[" head, ok = %s(head%s) done = done or ok"](localized,args)
end
-- local s = " print('" .. tostring(group) .. " " .. tostring(action) .. " : ' .. tostring(head)) "
-- calls[n] = s .. calls[n] .. s
@@ -340,6 +346,6 @@ function sequencers.nodeprocessor(t,nofarguments) -- todo: handle 'kind' in plug
end
end
end
- local processor = #calls > 0 and format(template_yes,concat(vars,"\n"),args,concat(calls,"\n")) or template_nop
+ local processor = #calls > 0 and formatters[template_yes](concat(vars,"\n"),args,concat(calls,"\n")) or template_nop
return processor
end
diff --git a/tex/context/base/x-set-11.mkiv b/tex/context/base/x-set-11.mkiv
index c0575e625..53e172102 100644
--- a/tex/context/base/x-set-11.mkiv
+++ b/tex/context/base/x-set-11.mkiv
@@ -57,7 +57,7 @@
2: -- wordt verwerkt
3: -- is niet gedefinieerd
4: -- wordt nogmaals verwerkt
- optional: optioneel
+ optional: opt
displaymath: formule
index: ingang
math: formule
@@ -95,7 +95,7 @@
2: -- is processed
3: -- is undefined
4: -- is processed again
- optional: optional
+ optional: opt
displaymath: formula
index: entry
math: formula
@@ -133,7 +133,7 @@
2: -- wird verarbeitet
3: -- ist undefiniert
4: -- ist mehrmals verarbeitet
- optional: optioneel
+ optional: opt
displaymath: formula
index: entry
math: formula
@@ -171,7 +171,7 @@
2: -- je zpracovano
3: -- je nedefinovano
4: -- je zpracovano znovu
- optional: optioneel
+ optional: opt
displaymath: formula
index: entry
math: formula
@@ -209,7 +209,7 @@
2: -- is processed
3: -- is undefined
4: -- is processed again
- optional: optioneel
+ optional: opt
displaymath: formula
index: entry
math: formula
@@ -247,7 +247,7 @@
2: este procesat --
3: -- este nedefinit
4: -- este procesat din nou
- optional: optioneel
+ optional: opt
displaymath: formula
index: entry
math: formula
@@ -285,7 +285,7 @@
2: -- est traité
3: -- n'est pas défini
4: -- est traité de nouveau
- optional: optionel
+ optional: opt
displaymath: formule
index: entrée
math: formule
diff --git a/tex/context/base/x-xtag.mkiv b/tex/context/base/x-xtag.mkiv
index 09490cc8f..ab95c567e 100644
--- a/tex/context/base/x-xtag.mkiv
+++ b/tex/context/base/x-xtag.mkiv
@@ -14,7 +14,7 @@
%D Here we load the \MKII\ (mostly) streaming \XML\ parser. We
%D define a couple of catcode regimes first.
-\ifdefined\XMLbanner \endinput \fi
+\endinput
\writestatus{xtag}{this module is obsolete, use the mkiv-xml features or use mkii instead}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index b6621525a..0c307c7bc 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 : 03/10/15 12:09:17
+-- merge date : 03/25/15 22:13:54
do -- begin closure to overcome local limits and interference
@@ -660,24 +660,48 @@ function lpeg.append(list,pp,delayed,checked)
end
return p
end
+local p_false=P(false)
+local p_true=P(true)
local function make(t,hash)
- local p=P(false)
+ local p=p_false
local keys=sortedkeys(t)
+ local function making(t,w)
+ local p=p_false
+ local keys=sortedkeys(t)
+ for i=1,#keys do
+ local k=keys[i]
+ local v=t[k]
+ if w then
+ if v==true then
+ p=p+P(k)*p_true
+ else
+ p=p+P(k)*(making(v,w)+p_true)
+ end
+ else
+ if v==true then
+ p=p+P(k)
+ else
+ p=p+P(k)*making(v,w)
+ end
+ end
+ end
+ return p
+ end
for i=1,#keys do
local k=keys[i]
local v=t[k]
local h=hash[v]
if h then
- if next(v) then
- p=p+P(k)*(make(v,hash)+P(true))
+ if v==true then
+ p=p+P(k)*p_true
else
- p=p+P(k)*P(true)
+ p=p+P(k)*(making(v,true)+p_true)
end
else
- if next(v) then
- p=p+P(k)*make(v,hash)
- else
+ if v==true then
p=p+P(k)
+ else
+ p=p+P(k)*making(v,false)
end
end
end
@@ -685,34 +709,55 @@ local function make(t,hash)
end
function lpeg.utfchartabletopattern(list)
local tree={}
- local hash={}
+ local hash
local n=#list
if n==0 then
+ hash=list
for s in next,list do
local t=tree
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=tc
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
end
else
+ hash={}
for i=1,n do
local t=tree
local s=list[i]
+ local p,pk
for c in gmatch(s,".") do
- local tc=t[c]
- if not tc then
- tc={}
- t[c]=tc
+ if t==true then
+ t={ [c]=true }
+ p[pk]=t
+ p=t
+ t=true
+ else
+ local tc=t[c]
+ if not tc then
+ tc=true
+ t[c]=true
+ end
+ p=t
+ t=tc
end
- t=tc
+ pk=c
end
- hash[t]=s
+ hash[s]=true
end
end
return make(tree,hash)
@@ -5280,6 +5325,7 @@ local report_fonts=logs.reporter("fonts","loading")
local fonts=fonts or {}
local mappings=fonts.mappings or {}
fonts.mappings=mappings
+local allocate=utilities.storage.allocate
local function loadlumtable(filename)
local lumname=file.replacesuffix(file.basename(filename),"lum")
local lumfile=resolvers.findfile(lumname,"map") or ""
@@ -5381,7 +5427,7 @@ mappings.fromunicode16=fromunicode16
local ligseparator=P("_")
local varseparator=P(".")
local namesplitter=Ct(C((1-ligseparator-varseparator)^1)*(ligseparator*C((1-ligseparator-varseparator)^1))^0)
-local overloads={
+local overloads=allocate {
IJ={ name="I_J",unicode={ 0x49,0x4A },mess=0x0132 },
ij={ name="i_j",unicode={ 0x69,0x6A },mess=0x0133 },
ff={ name="f_f",unicode={ 0x66,0x66 },mess=0xFB00 },