From b32b619990c38ea7e53081ce0430ca4fcccfe911 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 5 May 2014 22:31:00 +0200 Subject: beta 2014.05.05 22:31 --- .../lexers/data/scite-context-data-context.lua | 2 +- .../context/lexers/scite-context-lexer-tex.lua | 4 +- .../context/scite-context-data-context.properties | 25 ++++--- doc/context/scripts/mkii/mptopdf.man | 4 +- doc/context/scripts/mkii/mptopdf.xml | 2 +- metapost/context/base/mp-chem.mpiv | 81 +++++++++++++-------- metapost/context/base/mp-grap.mpiv | 42 ++++++++++- metapost/context/fonts/bidi-symbols.tex | 1 + scripts/context/lua/mtx-mk-help.lua | 2 +- tex/context/base/buff-ini.lua | 10 +-- tex/context/base/buff-ini.mkiv | 8 +- tex/context/base/buff-ver.mkiv | 2 +- tex/context/base/chem-str.lua | 39 +++++----- tex/context/base/chem-str.mkiv | 14 ++-- tex/context/base/cldf-prs.lua | 42 ++++++++--- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4061 -> 4056 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/core-con.lua | 60 ++++++++++++--- tex/context/base/core-con.mkiv | 4 +- tex/context/base/font-run.mkiv | 2 +- tex/context/base/math-map.lua | 2 + tex/context/base/mtx-context-listing.tex | 17 ++++- tex/context/base/mult-ini.lua | 12 ++- tex/context/base/mult-low.lua | 1 + tex/context/base/node-ref.lua | 5 +- tex/context/base/pack-rul.lua | 44 +++++++++++ tex/context/base/status-files.pdf | Bin 24625 -> 24657 bytes tex/context/base/status-lua.pdf | Bin 242466 -> 242871 bytes tex/context/base/strc-blk.mkiv | 3 +- tex/context/base/tabl-tbl.mkiv | 4 +- tex/context/base/tabl-xnt.mkvi | 2 +- tex/context/base/tabl-xtb.lua | 25 ++++++- tex/context/base/tabl-xtb.mkvi | 8 +- tex/context/base/util-sci.lua | 78 ++++++++++++-------- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 36 files changed, 391 insertions(+), 160 deletions(-) diff --git a/context/data/scite/context/lexers/data/scite-context-data-context.lua b/context/data/scite/context/lexers/data/scite-context-data-context.lua index 6c0293fbd..721a2e123 100644 --- a/context/data/scite/context/lexers/data/scite-context-data-context.lua +++ b/context/data/scite/context/lexers/data/scite-context-data-context.lua @@ -1,4 +1,4 @@ return { - ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "etexversion", "pdftexversion", "xetexversion", "xetexrevision", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vcentergroupcode", "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "vadjustgroupcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "charifcode", "catifcode", "numifcode", "dimifcode", "oddifcode", "vmodeifcode", "hmodeifcode", "mmodeifcode", "innerifcode", "voidifcode", "hboxifcode", "vboxifcode", "xifcode", "eofifcode", "trueifcode", "falseifcode", "caseifcode", "definedifcode", "csnameifcode", "fontcharifcode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathsupdisplay", "mathsupnormal", "mathsupcramped", "mathsubnormal", "mathsubcombined", "mathaxisheight", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "setupdocument", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordcode", "mathopcode", "mathbincode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctcode", "mathalphacode", "mathinnercode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathboxcode", "mathchoicecode", "mathaccentcode", "mathradicalcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "continueifinputfile", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "breakablethinspace", "nobreakspace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj" }, + ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "etexversion", "pdftexversion", "xetexversion", "xetexrevision", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vcentergroupcode", "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "vadjustgroupcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "charifcode", "catifcode", "numifcode", "dimifcode", "oddifcode", "vmodeifcode", "hmodeifcode", "mmodeifcode", "innerifcode", "voidifcode", "hboxifcode", "vboxifcode", "xifcode", "eofifcode", "trueifcode", "falseifcode", "caseifcode", "definedifcode", "csnameifcode", "fontcharifcode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathsupdisplay", "mathsupnormal", "mathsupcramped", "mathsubnormal", "mathsubcombined", "mathaxisheight", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "setupdocument", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordcode", "mathopcode", "mathbincode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctcode", "mathalphacode", "mathinnercode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathboxcode", "mathchoicecode", "mathaccentcode", "mathradicalcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "continueifinputfile", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "breakablethinspace", "nobreakspace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj" }, ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "startcontextdefinitioncode", "stopcontextdefinitioncode", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "doifelsecommandhandler", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "then", "begcsname", "strippedcsname", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthsargumenttrue", "sixthargumentfalse", "sixtsargumenttrue", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "dontcomplain", "forgetall", "donetrue", "donefalse", "htdp", "unvoidbox", "hfilll", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", "ruledmbox", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", "scratchmuskip", "globalscratchmuskip", "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", "normalbaselineskip", "normallineskip", "normallineskiplimit", "availablehsize", "localhsize", "setlocalhsize", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchunicode", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "doif", "doifnot", "doifelse", "doifinset", "doifnotinset", "doifinsetelse", "doifnextcharelse", "doifnextoptionalelse", "doifnextoptionalcselse", "doiffastoptionalcheckelse", "doifnextbgroupelse", "doifnextbgroupcselse", "doifnextparenthesiselse", "doifundefinedelse", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifdimensionelse", "doifnumberelse", "doifnumber", "doifnotnumber", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "doifassignmentelse", "docheckassignment", "tracingall", "tracingnone", "loggingall", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "everyendpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "obeyspaces", "obeylines", "obeyedspace", "obeyedline", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "wait", "writestatus", "define", "defineexpandable", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "measured", "installcorenamespace", "getvalue", "getuvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "udef", "ugdef", "uedef", "uxdef", "checked", "unique", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "dowith", "newconstant", "setnewconstant", "setconstant", "setconstantvalue", "newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue", "newmacro", "setnewmacro", "newfraction", "newsignal", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "permitspacesbetweengroups", "dontpermitspacesbetweengroups", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse", "startnointerference", "stopnointerference", "twodigits", "threedigits", "leftorright", "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "begstrut", "endstrut", "lineheight", "ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing", "ordopenspacing", "ordclosespacing", "ordpunctspacing", "ordinnerspacing", "opordspacing", "opopspacing", "opbinspacing", "oprelspacing", "opopenspacing", "opclosespacing", "oppunctspacing", "opinnerspacing", "binordspacing", "binopspacing", "binbinspacing", "binrelspacing", "binopenspacing", "binclosespacing", "binpunctspacing", "bininnerspacing", "relordspacing", "relopspacing", "relbinspacing", "relrelspacing", "relopenspacing", "relclosespacing", "relpunctspacing", "relinnerspacing", "openordspacing", "openopspacing", "openbinspacing", "openrelspacing", "openopenspacing", "openclosespacing", "openpunctspacing", "openinnerspacing", "closeordspacing", "closeopspacing", "closebinspacing", "closerelspacing", "closeopenspacing", "closeclosespacing", "closepunctspacing", "closeinnerspacing", "punctordspacing", "punctopspacing", "punctbinspacing", "punctrelspacing", "punctopenspacing", "punctclosespacing", "punctpunctspacing", "punctinnerspacing", "innerordspacing", "inneropspacing", "innerbinspacing", "innerrelspacing", "inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "uncramped", "cramped", "triggermathstyle", "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette", "mathstylehbox", "mathstylevbox", "mathstylevcenter", "mathstylevcenteredhbox", "mathstylevcenteredvbox", "mathtext", "setmathsmalltextbox", "setmathtextbox", "triggerdisplaystyle", "triggertextstyle", "triggerscriptstyle", "triggerscriptscriptstyle", "triggeruncrampedstyle", "triggercrampedstyle", "triggersmallstyle", "triggeruncrampedsmallstyle", "triggercrampedsmallstyle", "triggerbigstyle", "triggeruncrampedbigstyle", "triggercrampedbigstyle", "luaexpr", "expdoifelse", "expdoif", "expdoifnot", "expdoifcommonelse", "expdoifinsetelse", "ctxdirectlua", "ctxlatelua", "ctxsprint", "ctxwrite", "ctxcommand", "ctxdirectcommand", "ctxlatecommand", "ctxreport", "ctxlua", "luacode", "lateluacode", "directluacode", "registerctxluafile", "ctxloadluafile", "luaversion", "luamajorversion", "luaminorversion", "ctxluacode", "luaconditional", "luaexpanded", "startluaparameterset", "stopluaparameterset", "luaparameterset", "definenamedlua", "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction", "stopctxfunction", "ctxfunction", "startctxfunctiondefinition", "stopctxfunctiondefinition", "carryoverpar", "assumelongusagecs", "Umathbotaccent", "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", "lefttoright", "righttoleft", "synchronizelayoutdirection", "synchronizedisplaydirection", "synchronizeinlinedirection", "lesshyphens", "morehyphens", "nohyphens", "dohyphens", "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath" }, } \ 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 d67be2cd8..0099b968a 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-tex.lua @@ -528,7 +528,7 @@ local group = { contextlexer._foldpattern = P("\\" ) * (P("start") + P("stop")) + S("{}") -- separate entry else interference -contextlexer._foldsymbols = { -- these need to be style references +contextlexer._foldsymbols = { -- these need to be style references .. todo: multiple styles _patterns = { "\\start", "\\stop", -- regular environments -- "\\begin", "\\end", -- (moveable) blocks @@ -539,6 +539,8 @@ contextlexer._foldsymbols = { -- these need to be style references ["data"] = environment, ["user"] = environment, ["embedded"] = environment, + ["helper"] = environment, + ["plain"] = environment, ["grouping"] = group, } diff --git a/context/data/scite/context/scite-context-data-context.properties b/context/data/scite/context/scite-context-data-context.properties index 3e53862f7..3cb991efa 100644 --- a/context/data/scite/context/scite-context-data-context.properties +++ b/context/data/scite/context/scite-context-data-context.properties @@ -51,18 +51,19 @@ product startproject stopproject project starttext \ stoptext startnotext stopnotext startdocument stopdocument \ documentvariable setupdocument startmodule stopmodule usemodule \ usetexmodule useluamodule setupmodule currentmoduleparameter moduleparameter \ -startTEXpage stopTEXpage enablemode disablemode preventmode \ -globalenablemode globaldisablemode globalpreventmode pushmode popmode \ -typescriptone typescripttwo typescriptthree mathsizesuffix mathordcode \ -mathopcode mathbincode mathrelcode mathopencode mathclosecode \ -mathpunctcode mathalphacode mathinnercode mathnothingcode mathlimopcode \ -mathnolopcode mathboxcode mathchoicecode mathaccentcode mathradicalcode \ -constantnumber constantnumberargument constantdimen constantdimenargument constantemptyargument \ -continueifinputfile luastringsep !!bs !!es lefttorightmark \ -righttoleftmark breakablethinspace nobreakspace narrownobreakspace zerowidthnobreakspace \ -ideographicspace ideographichalffillspace twoperemspace threeperemspace fourperemspace \ -fiveperemspace sixperemspace figurespace punctuationspace hairspace \ -zerowidthspace zerowidthnonjoiner zerowidthjoiner zwnj zwj +everystarttext startTEXpage stopTEXpage enablemode disablemode \ +preventmode globalenablemode globaldisablemode globalpreventmode pushmode \ +popmode typescriptone typescripttwo typescriptthree mathsizesuffix \ +mathordcode mathopcode mathbincode mathrelcode mathopencode \ +mathclosecode mathpunctcode mathalphacode mathinnercode mathnothingcode \ +mathlimopcode mathnolopcode mathboxcode mathchoicecode mathaccentcode \ +mathradicalcode constantnumber constantnumberargument constantdimen constantdimenargument \ +constantemptyargument continueifinputfile luastringsep !!bs !!es \ +lefttorightmark righttoleftmark breakablethinspace nobreakspace narrownobreakspace \ +zerowidthnobreakspace ideographicspace ideographichalffillspace twoperemspace threeperemspace \ +fourperemspace fiveperemspace sixperemspace figurespace punctuationspace \ +hairspace zerowidthspace zerowidthnonjoiner zerowidthjoiner zwnj \ +zwj keywordclass.context.helpers=\ startsetups stopsetups startxmlsetups stopxmlsetups \ diff --git a/doc/context/scripts/mkii/mptopdf.man b/doc/context/scripts/mkii/mptopdf.man index 87cb566eb..e064ba895 100644 --- a/doc/context/scripts/mkii/mptopdf.man +++ b/doc/context/scripts/mkii/mptopdf.man @@ -1,4 +1,4 @@ -.TH "mptopdf" "1" "01-01-2014" "version 1.4.1" "convert MetaPost to PDF" +.TH "mptopdf" "1" "01-01-2014" "version 1.4.1" "convert MetaPost figures to PDF" .SH NAME .B mptopdf .SH SYNOPSIS @@ -8,7 +8,7 @@ .I FILENAMES .B ] .SH DESCRIPTION -.B convert MetaPost to PDF +.B convert MetaPost figures to PDF .SH OPTIONS .TP .B --metafun diff --git a/doc/context/scripts/mkii/mptopdf.xml b/doc/context/scripts/mkii/mptopdf.xml index a3b06a231..28e67bcb3 100644 --- a/doc/context/scripts/mkii/mptopdf.xml +++ b/doc/context/scripts/mkii/mptopdf.xml @@ -2,7 +2,7 @@ mptopdf - convert MetaPost to PDF + convert MetaPost figures to PDF 1.4.1 diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv index 2addb0a73..a316a1a30 100644 --- a/metapost/context/base/mp-chem.mpiv +++ b/metapost/context/base/mp-chem.mpiv @@ -24,7 +24,7 @@ numeric chem_text_min, chem_text_max, chem_rotation, chem_adjacent, chem_stack_n, chem_substituent, chem_substituent.lft, chem_substituent.rt, - chem_setting_offset, chem_text_offset, chem_picture_offset, + chem_setting_offset, chem_text_offset, chem_center_offset, chem_dbl_offset, chem_bb_angle, chem_axis_rulethickness, chem_setting_l, chem_setting_r, chem_setting_t, chem_setting_b, @@ -72,19 +72,18 @@ chem_axis_rulethickness := 1pt ; chem_emwidth := 10pt ; % EmWidth or \the\emwidth does not work... chem_b_length := 3 chem_emwidth ; chem_text_offset := -.3chem_emwidth ; % -.71chem_emwidth ; % 1/sqrt(2) -chem_center_offset := .5 chem_emwidth ; -chem_picture_offset := chem_emwidth ; +chem_center_offset := .5chem_emwidth ; chem_dbl_offset := .05 ; chem_bb_angle := angle(1,2chem_dbl_offset) ; chem_text_min := 0.75 ; chem_text_max := 1.25 ; -chem_dot_factor := 4 ; % *linewidth +chem_dot_factor := 2 ; % *linewidth chem_sb_pair := (0.25,0.75) ; %chem_sb_dash := dashpattern(off 0.25 on 0.5 off 0.25) ; chem_sb_pair.m := (0.25,1 ) ; %chem_sb_dash.m := dashpattern(off 0.25 on 0.75) ; chem_sb_pair.p := (0 ,0.75) ; %chem_sb_dash.p := dashpattern(on 0.75 off 0.25) ; -chem_sb_pair.b := (0, 1 ) ; %chem_sb_dash.b := dashpattern(on 1) ; +chem_sb_pair.b := (0 ,1 ) ; %chem_sb_dash.b := dashpattern(on 1) ; -chem_bd_wedge := false ; % true is incorrect, but quite common... +chem_bd_wedge := true ; % according to IUPAC 2005 def chem_reset = chem_rotation := 0 ; @@ -149,7 +148,7 @@ vardef chem_init_some (suffix $) (expr e) = chem_num2 := i ; fi endfor) - scaled (2*(abs(point chem_num2+.5 of chem_b_path[$]) - chem_dbl_offset)) + scaled (2*(abs(point chem_num2+.5 of chem_b_path[$]) - 2chem_dbl_offset)) fi ; chem_r_path[$] := @@ -307,11 +306,15 @@ chem_init_all ; % WHY does this not work unless defined and then called? % \startchemical -def chem_start_structure(expr i, l, r, t, b, rotation, unit, factor, offset, axis, rulethickness, axiscolor) = +def chem_start_structure(expr i, l, r, t, b, rotation, unit, bond, scale, offset, axis, rulethickness, axiscolor) = save chem_setting_l, chem_setting_r, chem_setting_t, chem_setting_b ; - chem_emwidth := unit ; - chem_b_length := factor * unit ; + chem_emwidth := unit ; % dynamically set for each structure. + chem_text_offset := -.3chem_emwidth ; % -.71chem_emwidth ; % 1/sqrt(2) + chem_center_offset := .5chem_emwidth ; + chem_b_length := chem_emwidth * bond * scale ; + % scale (normally 1) scales the structure but not the text. + if numeric l : chem_setting_l := -l ; fi @@ -798,28 +801,39 @@ vardef chem_eb@# (suffix $) (expr f, t, r, c) = % EB enddef ; vardef chem_ad@# (suffix $) (expr f, t, r, c) = % AD - if not chem_star[$] : - chem_t := identity chem_transformed($) ; - for i=f upto t : - chem_drawarrow( - ((subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path[$]) - paralleled 2chem_dbl_offset) transformed chem_t, - r,c,) ; - endfor - fi + chem_t := identity chem_transformed($) ; + for i=f upto t : + chem_drawarrow( + ( + (subpath + if chem_star[$] : + chem_sb_pair@# of chem_r_fragment($,i) + ) paralleled 5chem_dbl_offset + else : + (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path[$] + ) paralleled 2chem_dbl_offset + fi + ) transformed chem_t, + r,c,) ; + endfor enddef ; vardef chem_au@# (suffix $) (expr f, t, r, c) = % AU - if not chem_star[$] : - chem_t := identity chem_transformed($) ; - for i=f upto t : - chem_drawarrow( - reverse( - (subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path[$]) - paralleled 2chem_dbl_offset) transformed chem_t, - r,c,) ; - endfor - fi + chem_t := identity chem_transformed($) ; + for i=f upto t : + chem_drawarrow( + ((reverse + subpath + if chem_star[$] : + chem_sb_pair@# of chem_r_fragment($,i) + ) paralleled -5chem_dbl_offset + else : + (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path[$] + ) paralleled -2chem_dbl_offset + fi + ) transformed chem_t, + r,c,) ; + endfor enddef ; vardef chem_es@# (suffix $) (expr f, t, r, c) = % ES @@ -1004,6 +1018,15 @@ enddef ; vardef chem_hb@# (suffix $) (expr f, t, r, c) = % HB if chem_star[$] : chem_rh@#($,f,t,r,c) + else : + chem_t := identity chem_transformed($) ; + for i=f upto t : + chem_draw( + (subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path[$]) + transformed chem_t, + chem_dot_factor*r,c,dashed withdots scaled ((.5chem_b_length/3)/5bp)) ; + % not symmetric - needs to be tweaked... + endfor fi enddef ; diff --git a/metapost/context/base/mp-grap.mpiv b/metapost/context/base/mp-grap.mpiv index 6d69c0b1e..6d2924c52 100644 --- a/metapost/context/base/mp-grap.mpiv +++ b/metapost/context/base/mp-grap.mpiv @@ -64,9 +64,9 @@ fi % are of the form X_., Y_., or Z_., or they start % with `graph_' -% Depends on : +% Used to depend on : -input string.mp +% input string.mp % Private version of a few marith macros, fixed for double math... @@ -467,16 +467,50 @@ enddef ; % initial "%", and return true if at least one token is found. The tokens % are stored in @#1, @#2, .. with "" in the last @#[] entry. +% String manipulation routines for MetaPost +% It is harmless to input this file more than once. + +vardef isdigit primary d = + ("0"<=d)and(d<="9") +enddef ; + +% Number of initial characters of string s where `c ' is true + +vardef graph_cspan(expr s)(text c) = + 0 + for i=1 upto length s: + exitunless c substring (i-1,i) of s; + + 1 + endfor +enddef ; + +% String s is composed of items separated by white space. Lop off the first +% item and the surrounding white space and return just the item. + +vardef graph_loptok suffix s = + save t, k; + k = graph_cspan(s," ">=); + if k > 0 : + s := substring(k,infinity) of s ; + fi + k := graph_cspan(s," "<); + string t; + t = substring (0,k) of s; + s := substring (k,infinity) of s; + s := substring (graph_cspan(s," ">=),infinity) of s; + t +enddef ; + vardef graph_read_line@#(expr f) = save n_, s_ ; string s_; s_ = readfrom f ; string @#[] ; if s_<>EOF : @#0 := s_ ; - @#1 := loptok s_ ; + @#1 := graph_loptok s_ ; n_ = if @#1="%" : 0 else : 1 fi ; forever : - @#[incr n_] := loptok s_ ; + @#[incr n_] := graph_loptok s_ ; exitif @#[n_]="" ; endfor @#1<>"" diff --git a/metapost/context/fonts/bidi-symbols.tex b/metapost/context/fonts/bidi-symbols.tex index 24f883b3d..ba659ccb7 100644 --- a/metapost/context/fonts/bidi-symbols.tex +++ b/metapost/context/fonts/bidi-symbols.tex @@ -30,3 +30,4 @@ \getbuffer \blank \stoptext + diff --git a/scripts/context/lua/mtx-mk-help.lua b/scripts/context/lua/mtx-mk-help.lua index 794bbca37..083dbc3ec 100644 --- a/scripts/context/lua/mtx-mk-help.lua +++ b/scripts/context/lua/mtx-mk-help.lua @@ -403,7 +403,7 @@ local helpinfo = [[ mptopdf - convert MetaPost to PDF + convert MetaPost figures to PDF 1.4.1 diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index 84532f072..c4046d649 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -194,7 +194,7 @@ local continue = false -- An \n is unlikely to show up as \r is the endlinechar but \n is more generic -- for us. --- This fits the way we fetch verbatim: the indentatio before the sentinel +-- This fits the way we fetch verbatim: the indentation before the sentinel -- determines the stripping. -- str = [[ @@ -238,7 +238,7 @@ local whatever = (P(1)-eol)^0 * eol^1 local strippers = { } -local function undent(str) -- new version, needs testing +local function undent(str) -- new version, needs testing: todo: not always needed, like in xtables local margin = lpegmatch(getmargin,str) if type(margin) ~= "string" then return str @@ -255,7 +255,7 @@ local function undent(str) -- new version, needs testing return lpegmatch(stripper,str) or str end -function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes) -- maybe move \\ to call +function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes,doundent) -- maybe move \\ to call local dn = getcontent(name) if dn == "" then nesting = 0 @@ -291,8 +291,8 @@ function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes) -- maybe if last == "\n" or last == "\r" then -- \n is unlikely as \r is the endlinechar dn = sub(dn,1,-2) end - if autoundent then - dn = undent(dn) + if doundent or (autoundent and doundent == nil) then + dn = undent(dn) end end assign(name,dn,catcodes) diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv index 4ea3042b6..6582e3587 100644 --- a/tex/context/base/buff-ini.mkiv +++ b/tex/context/base/buff-ini.mkiv @@ -39,8 +39,8 @@ \def\buff_start[#1][#2]% {\buff_start_indeed{}{#1}{\e!start\v!buffer}{\e!stop\v!buffer}} -\def\buff_start_indeed#1#2#3#4% \donothing needed ! - {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}}} +\def\buff_start_indeed#1#2#3#4#5% \donothing needed ! #5=undent) + {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}} \unexpanded\def\grabbufferdata % was: \dostartbuffer {\begingroup % (4) @@ -64,7 +64,7 @@ \let\buff_finish\relax \let\buff_gobble\relax -\unexpanded\def\buff_pickup#1#2#3#4#5% name, startsequence, stopsequence, before, after +\unexpanded\def\buff_pickup#1#2#3#4#5#6% name, startsequence, stopsequence, before, after, undent {\begingroup % (1) #4% \begingroup % (2) @@ -77,7 +77,7 @@ #5}% \def\buff_gobble##1#3% is detokenize needed? TEST %{\ctxcommand{grabbuffer("#1","#2","#3",\!!bs\detokenize{##1}\!!es)} % space ? - {\ctxcommand{grabbuffer("#1","#2","#3",\!!bs>##1\!!es,\catcodetableofbuffer)}% space ? + {\ctxcommand{grabbuffer("#1","#2","#3",\!!bs>##1\!!es,\catcodetableofbuffer,\ifnum#6=\plusone true\else false\fi)}% space ? \buff_gobble \buff_finish}% \buff_gobble} diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index 17dfd9d69..8b9bd1764 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -471,7 +471,7 @@ \normalexpanded{\buff_verbatim_type_block{\e!start\currenttyping}{\e!stop\currenttyping}}} \unexpanded\def\buff_verbatim_type_block#1#2% - {\buff_pickup{_typing_}{#1}{#2}{}{\buff_verbatim_type_block_verbatim_indeed{#1}{#2}}} % was dowithbuffer + {\buff_pickup{_typing_}{#1}{#2}{}{\buff_verbatim_type_block_verbatim_indeed{#1}{#2}}\plusone} % was dowithbuffer \def\buff_verbatim_type_block_verbatim_indeed#1#2% {\buff_verbatim_initialize_typing_two diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 347363345..cd7a2db06 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -147,6 +147,8 @@ local one_keys = { es = "line", ed = "line", et = "line", + au = "line", + ad = "line", cz = "text", rot = "transform", dir = "transform", @@ -156,6 +158,7 @@ local one_keys = { local ring_keys = { db = "line", + hb = "line", br = "line", lr = "line", rr = "line", @@ -316,7 +319,7 @@ local pattern = -- print(lpegmatch(pattern,"RZ13=x")) -- 1 RZ false false table x local f_initialize = 'if unknown context_chem : input mp-chem.mpiv ; fi ;' -local f_start_structure = formatters['chem_start_structure(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'] +local f_start_structure = formatters['chem_start_structure(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'] local f_set_trace_bounds = formatters['chem_trace_boundingbox := %l ;'] local f_stop_structure = 'chem_stop_structure;' local f_start_component = 'chem_start_component;' @@ -536,6 +539,8 @@ local function process(level,spec,text,n,rulethickness,rulecolor,offset,default_ if not t then txt, t = fetch(txt) end if t then t = molecule(processor_tostring(t)) +-- local p, t = processors.split(t) +-- m = m + 1 ; metacode[m] = f_text(operation,p or align,variant,si,t) m = m + 1 ; metacode[m] = f_text(operation,align,variant,si,t) end end @@ -605,7 +610,7 @@ end -- -- rulethickness in points -local function checked(d,factor,unit,scale) +local function checked(d,bondlength,unit,scale) if d == v_none then return 0 end @@ -613,9 +618,9 @@ local function checked(d,factor,unit,scale) if not n then -- assume dimen elseif n >= 10 or n <= -10 then - return factor * unit * n / 1000 + return bondlength * unit * n / 1000 else - return factor * unit * n + return bondlength * unit * n end local n = todimen(d) if n then @@ -625,7 +630,7 @@ local function checked(d,factor,unit,scale) end end -local function calculated(height,bottom,top,factor,unit,scale) +local function calculated(height,bottom,top,bondlength,unit,scale) local scaled = 0 if height == v_none then -- this always wins @@ -634,24 +639,24 @@ local function calculated(height,bottom,top,factor,unit,scale) top = "0pt" elseif height == v_fit then height = "true" - bottom = bottom == v_fit and "true" or topoints(checked(bottom,factor,unit,scale)) - top = top == v_fit and "true" or topoints(checked(top, factor,unit,scale)) + bottom = bottom == v_fit and "true" or topoints(checked(bottom,bondlength,unit,scale)) + top = top == v_fit and "true" or topoints(checked(top, bondlength,unit,scale)) else - height = checked(height,factor,unit,scale) + height = checked(height,bondlength,unit,scale) if bottom == v_fit then if top == v_fit then bottom = height / 2 top = bottom else - top = checked(top,factor,unit,scale) + top = checked(top,bondlength,unit,scale) bottom = height - top end elseif top == v_fit then - bottom = checked(bottom,factor,unit,scale) + bottom = checked(bottom,bondlength,unit,scale) top = height - bottom else - bottom = checked(bottom,factor,unit,scale) - top = checked(top, factor,unit,scale) + bottom = checked(bottom,bondlength,unit,scale) + top = checked(top, bondlength,unit,scale) local ratio = height / (bottom+top) bottom = bottom * ratio top = top * ratio @@ -669,7 +674,7 @@ function chemistry.start(settings) local width = settings.width or v_fit local height = settings.height or v_fit local unit = settings.unit or 655360 - local factor = settings.factor or 3 + local bondlength = settings.factor or 3 local rulethickness = settings.rulethickness or 65536 local rulecolor = settings.rulecolor or "" local axiscolor = settings.framecolor or "" @@ -683,7 +688,7 @@ function chemistry.start(settings) -- align = settings.symalign or "auto" if trace_structure then - report_chemistry("unit %p, factor %s, symalign %s",unit,factor,align) + report_chemistry("unit %p, bondlength %s, symalign %s",unit,bondlength,align) end if align ~= "" then align = "." .. align @@ -713,8 +718,8 @@ function chemistry.start(settings) local sp_width = 0 local sp_height = 0 -- - width, left, right, sp_width = calculated(width, left, right,factor,unit,scale) - height, bottom, top, sp_height = calculated(height,bottom,top, factor,unit,scale) + width, left, right, sp_width = calculated(width, left, right,bondlength,unit,scale) + height, bottom, top, sp_height = calculated(height,bottom,top, bondlength,unit,scale) -- if width ~= "true" and height ~= "true" and texgetcount("@@trialtypesetting") ~= 0 then if trace_structure then @@ -736,7 +741,7 @@ function chemistry.start(settings) metacode[#metacode+1] = f_start_structure( chemistry.structures, left, right, top, bottom, - rotation, topoints(unit), factor, topoints(offset), + rotation, topoints(unit), bondlength, scale, topoints(offset), tostring(settings.axis == v_on), topoints(rulethickness), tostring(axiscolor) ) metacode[#metacode+1] = f_set_trace_bounds(trace_boundingbox) ; diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv index d9ec1842b..6aec16f9e 100644 --- a/tex/context/base/chem-str.mkiv +++ b/tex/context/base/chem-str.mkiv @@ -705,14 +705,14 @@ \setupchemical [\c!frame=, - \c!width=\v!fit, % or unitless number, multiplies scale*EmWidth - \c!height=\v!fit, % or unitless number, multiplies scale*EmWidth - \c!left=\v!fit, % or unitless number, multiplies scale*EmWidth - \c!right=\v!fit, % or unitless number, multiplies scale*EmWidth - \c!top=\v!fit, % or unitless number, multiplies scale*EmWidth - \c!bottom=\v!fit, % or unitless number, multiplies scale*EmWidth + \c!width=\v!fit, % or unitless number, multiplies scale*unit + \c!height=\v!fit, % or unitless number, multiplies scale*unit + \c!left=\v!fit, % or unitless number, multiplies scale*unit + \c!right=\v!fit, % or unitless number, multiplies scale*unit + \c!top=\v!fit, % or unitless number, multiplies scale*unit + \c!bottom=\v!fit, % or unitless number, multiplies scale*unit \c!bodyfont=, - \c!scale=\v!normal, % small, normal or medium, big, or unitless number (multiplies EmWidth) + \c!scale=\v!normal, % small, normal or medium, big, or unitless number (multiplies unit) \c!size=\v!medium, \c!textsize=\v!big, % how is textsize used?? \c!axis=\v!off, diff --git a/tex/context/base/cldf-prs.lua b/tex/context/base/cldf-prs.lua index 160d30b19..1554b5e57 100644 --- a/tex/context/base/cldf-prs.lua +++ b/tex/context/base/cldf-prs.lua @@ -15,17 +15,18 @@ local format = string.format local cpatterns = patterns.context or { } patterns.context = cpatterns +local utf8char = patterns.utf8char +local cardinal = patterns.cardinal + +local leftbrace = P("{") +local rightbrace = P("}") local backslash = P("\\") -local csname = backslash * P(1) * (1-backslash)^0 +local csname = backslash * P(1) * (1-backslash-leftbrace)^0 * P(" ")^0 local sign = P("+") / "\\textplus " + P("-") / "\\textminus " -local leftbrace = P("{") -local rightbrace = P("}") local nested = P { leftbrace * (V(1) + (1-rightbrace))^0 * rightbrace } local subscript = P("_") local superscript = P("^") -local utf8char = patterns.utf8char -local cardinal = patterns.cardinal -- local scripts = P { "start", -- start = V("csname") + V("lowfirst") + V("highfirst"), @@ -35,22 +36,41 @@ local cardinal = patterns.cardinal -- highfirst = superscript * ( Cc("\\hilo{%s}{%s}") * V("content") * subscript + Cc("\\high{%s}") ) * V("content") / format, -- } -local scripts = P { "start", - start = V("csname") + V("lowfirst") + V("highfirst"), +-- local scripts = P { "start", +-- start = (V("csname") + V("lowfirst") + V("highfirst"))^1, +-- csname = csname, +-- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)), +-- lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"), +-- highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"), +-- } + +local scripted = Cs { "start", + start = (V("csname") + V("nested") + V("lowfirst") + V("highfirst") + V("utf8char"))^1, + rest = V("csname") + V("nested") + V("lowfirst") + V("highfirst"), csname = csname, - content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)), + utf8char = utf8char, + -- nested = leftbrace * (V("rest") + (V("utf8char")-rightbrace))^0 * rightbrace, + nested = leftbrace * (V("start") -rightbrace)^0 * rightbrace, + content = Cs(V("nested") + sign^-1 * (cardinal + V("utf8char"))), + content = V("nested") + sign^-1 * (cardinal + V("utf8char")), lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"), highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"), } -local scripted = Cs((csname + scripts + utf8char)^0) -cpatterns.scripts = scripts +-- local scripted = Cs((scripts)) + +-- cpatterns.scripts = scripts cpatterns.csname = csname cpatterns.scripted = scripted cpatterns.nested = nested --- inspect(scripted) -- print(lpegmatch(scripted,"10^-3_x")) +-- print(lpegmatch(scripted,"\\L {C_5}")) +-- print(lpegmatch(scripted,"\\SL{}")) +-- print(lpegmatch(scripted,"\\SL{C_5}")) +-- print(lpegmatch(scripted,"\\SL{C_5}")) +-- print(lpegmatch(scripted,"{C_5}")) +-- print(lpegmatch(scripted,"{\\C_5}")) -- print(lpegmatch(scripted,"10^-a")) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index e3df6f7bf..cf9aa9a87 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.04.28 23:24} +\newcontextversion{2014.05.05 22:31} %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 6450c43f1..b544f56fe 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index e1ade2ba1..9ef439e45 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.04.28 23:24} +\edef\contextversion{2014.05.05 22:31} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua index 73ca3e304..3ccfb3e23 100644 --- a/tex/context/base/core-con.lua +++ b/tex/context/base/core-con.lua @@ -18,6 +18,7 @@ local floor, date, time, concat = math.floor, os.date, os.time, table.concat local lower, rep, match = string.lower, string.rep, string.match local utfchar, utfbyte = utf.char, utf.byte local tonumber, tostring = tonumber, tostring +local P, C, Cs, lpegmatch = lpeg.P, lpeg.C, lpeg.Cs, lpeg.match local context = context local commands = commands @@ -124,13 +125,26 @@ local counters = allocate { languages.counters = counters -counters['ar'] = counters['arabic'] -counters['gr'] = counters['greek'] -counters['g'] = counters['greek'] -counters['sl'] = counters['slovenian'] -counters['kr'] = counters['korean'] -counters['kr-p'] = counters['korean-parent'] -counters['kr-c'] = counters['korean-circle'] +counters['ar'] = counters['arabic'] +counters['gr'] = counters['greek'] +counters['g'] = counters['greek'] +counters['sl'] = counters['slovenian'] +counters['kr'] = counters['korean'] +counters['kr-p'] = counters['korean-parent'] +counters['kr-c'] = counters['korean-circle'] + +counters['thainumerals'] = counters['thai'] +counters['devanagarinumerals'] = counters['devanagari'] +counters['gurmurkhinumerals'] = counters['gurmurkhi'] +counters['gujaratinumerals'] = counters['gujarati'] +counters['tibetannumerals'] = counters['tibetan'] +counters['greeknumerals'] = counters['greek'] +counters['arabicnumerals'] = counters['arabic'] +counters['persiannumerals'] = counters['persian'] +counters['arabicexnumerals'] = counters['persian'] +counters['koreannumerals'] = counters['korean'] +counters['koreanparentnumerals'] = counters['korean-parent'] +counters['koreancirclenumerals'] = counters['korean-circle'] local fallback = utfbyte('0') @@ -207,6 +221,11 @@ function converters.Character (n) return chr (n,upper_offset) end function converters.characters(n) return chrs(n,lower_offset) end function converters.Characters(n) return chrs(n,upper_offset) end +converters['a'] = converters.characters +converters['A'] = converters.Characters +converters['AK'] = converters.Characters +converters['KA'] = converters.Characters + function commands.alphabetic(n,c) context(do_alphabetic(n,counters[c],lowercharacter)) end function commands.Alphabetic(n,c) context(do_alphabetic(n,counters[c],uppercharacter)) end function commands.character (n) context(chr (n,lower_offset)) end @@ -271,6 +290,13 @@ converters.toroman = toroman converters.Romannumerals = toroman converters.romannumerals = function(n) return lower(toroman(n)) end +converters['i'] = converters.romannumerals +converters['I'] = converters.Romannumerals +converters['r'] = converters.romannumerals +converters['R'] = converters.Romannumerals +converters['KR'] = converters.Romannumerals +converters['RK'] = converters.Romannumerals + function commands.romannumerals(n) context(lower(toroman(n))) end function commands.Romannumerals(n) context( toroman(n)) end @@ -472,6 +498,10 @@ function converters.chinesenumerals (n) return tochinese(n,"normal") end function converters.chinesecapnumerals(n) return tochinese(n,"cap" ) end function converters.chineseallnumerals(n) return tochinese(n,"all" ) end +converters['cn'] = converters.chinesenumerals +converters['cn-c'] = converters.chinesecapnumerals +converters['cn-a'] = converters.chineseallnumerals + function commands.chinesenumerals (n) context(tochinese(n,"normal")) end function commands.chinesecapnumerals(n) context(tochinese(n,"cap" )) end function commands.chineseallnumerals(n) context(tochinese(n,"all" )) end @@ -701,8 +731,6 @@ end -- verbose numbers --- verbose numbers - local data = allocate() local verbose = { data = data } converters.verbose = verbose @@ -948,6 +976,20 @@ function commands.verbose(n,language) context(t and t.translate(n) or n) end +-- These are just helpers but not really for the tex end. Do we have to +-- use translate here? + +local whitespace = lpeg.patterns.whitespace +local word = (1-whitespace) / characters.upper * (1-whitespace)^1 +local spacing = whitespace^1 +local pattern_one = Cs(word * P(1)^1) +local pattern_all = Cs((word + spacing)^1) + +function converters.word (s) return s end +function converters.words(s) return s end +function converters.Word (s) return lpegmatch(pattern_one,s) end +function converters.Words(s) return lpegmatch(pattern_all,s) end + -- -- local v_day = variables.day diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv index a43473ced..47c7c88d5 100644 --- a/tex/context/base/core-con.mkiv +++ b/tex/context/base/core-con.mkiv @@ -686,8 +686,8 @@ \defineconversion [kr-c] [\koreancirclenumerals] \defineconversion [chinesenumerals] [\chinesenumerals] -\defineconversion [chinesecapnumeralscn] [\chinesecapnumerals] -\defineconversion [chineseallnumeralscn] [\chineseallnumerals] +\defineconversion [chinesecapnumerals] [\chinesecapnumerals] +\defineconversion [chineseallnumerals] [\chineseallnumerals] \defineconversion [cn] [\chinesenumerals] \defineconversion [cn-c] [\chinesecapnumerals] diff --git a/tex/context/base/font-run.mkiv b/tex/context/base/font-run.mkiv index 66f1acc91..cb40adedd 100644 --- a/tex/context/base/font-run.mkiv +++ b/tex/context/base/font-run.mkiv @@ -311,7 +311,7 @@ \ifdefined\databox \else \newbox\databox \fi -\unexpanded\gdef\testminimalbaseline#1% +\unexpanded\gdef\testminimalbaseline#1% to be used in a tabulate {\setbox\databox\ruledhbox{#1}% \scratchdimen\ht\databox \advance\scratchdimen\dp\databox diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua index 8d301ac33..2ebcdfc86 100644 --- a/tex/context/base/math-map.lua +++ b/tex/context/base/math-map.lua @@ -445,6 +445,8 @@ mathematics.alphabets = alphabets local boldmap = { } +-- ["blackboard"] = { ["bf"] = { ["digits"] = { + local function remap(tf,bf) for _, alphabet in next, alphabets do local tfdata = alphabet[tf] diff --git a/tex/context/base/mtx-context-listing.tex b/tex/context/base/mtx-context-listing.tex index d69db9934..2a333c789 100644 --- a/tex/context/base/mtx-context-listing.tex +++ b/tex/context/base/mtx-context-listing.tex @@ -20,7 +20,8 @@ % --sort : sort filenames first % --topspace=dimension : distance above first line % --backspace=dimension : distance before left margin -% --pretty : pretty print comform suffix (temporarily disabled) +% --pretty : pretty print comform suffix +% --scite : pretty print comform suffix using scite lexer % --bodyfont=list : additional bodyfont settings % --paperformat=spec : paper*print or paperxprint % @@ -70,11 +71,16 @@ } local pattern = document.arguments.pattern + local scite = document.arguments.scite if pattern then document.files = dir.glob(pattern) end + if scite then + context.usemodule { "scite" } + end + if #document.files > 0 then if document.arguments.sort then table.sort(document.files) @@ -94,19 +100,24 @@ { function() context.detokenize(pattern and filename or file.basename(filename)) return true end }, { function() context.pagenumber() return true end } ) - if pretty then + if scite then + context.scitefile { filename } -- here { } + elseif pretty then if type(pretty) ~= "string" or pretty == "" then context.setuptyping { option = "color" } else context.setuptyping { option = types[pretty] or pretty } end + context.typefile(filename) + else + context.typefile(filename) end - context.typefile(filename) end end else context("no files given") end + \stopluacode \stoptext diff --git a/tex/context/base/mult-ini.lua b/tex/context/base/mult-ini.lua index 08f1639d0..62e983abc 100644 --- a/tex/context/base/mult-ini.lua +++ b/tex/context/base/mult-ini.lua @@ -265,9 +265,15 @@ function interfaces.cachesetup(t) end end -function interfaces.is_command(str) - return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false -- there will be a proper function for this -end +-- if token.lookup then +-- interfaces.is_command = token.lookup +-- else + + function interfaces.is_command(str) + return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false -- there will be a proper function for this + end + +-- end function interfaces.interfacedcommand(name) local command = complete.commands[name] diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 86095edab..f41104986 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -98,6 +98,7 @@ return { "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext","startdocument", "stopdocument", "documentvariable", "setupdocument", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule","setupmodule","currentmoduleparameter","moduleparameter", + "everystarttext", -- "startTEXpage", "stopTEXpage", -- "startMPpage", "stopMPpage", -- already catched by nested lexer diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua index c55db4ea3..78ef409bc 100644 --- a/tex/context/base/node-ref.lua +++ b/tex/context/base/node-ref.lua @@ -416,17 +416,20 @@ function references.get(n) -- not public so functionality can change return sn and sn[1] end -local function makereference(width,height,depth,reference) +local function makereference(width,height,depth,reference) -- height and depth are of parent local sr = stack[reference] if sr then if trace_references then report_reference("resolving attribute %a",reference) end local resolved, ht, dp, set, n = sr[1], sr[2], sr[3], sr[4], sr[5] +-- logs.report("temp","child: ht=%p dp=%p, parent: ht=%p dp=%p",ht,dp,height,depth) if ht then if height < ht then height = ht end if depth < dp then depth = dp end end +-- logs.report("temp","used: ht=%p dp=%p",height,depth) +-- step = 0 local annot = nodeinjections.reference(width,height,depth,set) if annot then annot = tonut(annot) diff --git a/tex/context/base/pack-rul.lua b/tex/context/base/pack-rul.lua index 5796da800..0c29eb5f1 100644 --- a/tex/context/base/pack-rul.lua +++ b/tex/context/base/pack-rul.lua @@ -14,6 +14,8 @@ if not modules then modules = { } end modules ['pack-rul'] = { -- challenge: adapt glue_set -- setfield(h,"glue_set", getfield(h,"glue_set") * getfield(h,"width")/maxwidth -- interesting ... doesn't matter much +local type = type + local hlist_code = nodes.nodecodes.hlist local vlist_code = nodes.nodecodes.vlist local box_code = nodes.listcodes.box @@ -29,6 +31,7 @@ local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev local getlist = nuts.getlist +local getid = nuts.getid local getsubtype = nuts.getsubtype local getbox = nuts.getbox @@ -152,3 +155,44 @@ function commands.doanalyzeframedbox(n) texsetdimen("global","framedfirstheight",firstheight or 0) texsetdimen("global","framedlastdepth",lastdepth or 0) end + + +function nodes.maxboxwidth(box) + local boxwidth = getfield(box,"width") + if boxwidth == 0 then + return 0 + end + local list = getlist(box) + if not list then + return 0 + end + if getid(box) == hlist_code then + return boxwidth + end + local lastlinelength = 0 + local maxwidth = 0 + local function check(n,repack) + local l = getlist(n) + if l then + if repack then + local subtype = getsubtype(n) + if subtype == box_code or subtype == line_code then + lastlinelength = node_dimensions(l,getfield(n,"dir")) + else + lastlinelength = getfield(n,"width") + end + else + lastlinelength = getfield(n,"width") + end + if lastlinelength > maxwidth then + maxwidth = lastlinelength + end + end + end + for h in traverse_id(hlist_code,list) do -- no dir etc needed + check(h,true) + end + for v in traverse_id(vlist_code,list) do -- no dir etc needed + check(v,false) + end +end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index f7a228bfc..a4381c06d 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 547c0e785..ad8475aed 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-blk.mkiv b/tex/context/base/strc-blk.mkiv index 1dd144aa9..bceb66beb 100644 --- a/tex/context/base/strc-blk.mkiv +++ b/tex/context/base/strc-blk.mkiv @@ -41,7 +41,8 @@ \unexpanded\def\strc_blocks_begin[#1][#2]% {\normalexpanded{\buff_pickup{@block@}{\e!begin#1}{\e!end#1}} {}% before - {\ctxcommand{savestructureblock("#1","#2","@block@")}}}% after + {\ctxcommand{savestructureblock("#1","#2","@block@")}}% + \plusone}% after \let\strc_blocks_setup\relax diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index 1aeaa2e56..d4d22af97 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -2067,9 +2067,9 @@ \donetrue \fi\fi \ifdone - \c_tabl_tabulate_repeathead\executeifdefined{\??tabulateheader\tabulationparameter\c!header}\zerocount + \global\c_tabl_tabulate_repeathead\executeifdefined{\??tabulateheader\tabulationparameter\c!header}\zerocount \else - \c_tabl_tabulate_repeathead\zerocount + \global\c_tabl_tabulate_repeathead\zerocount \fi % \the\t_tabl_tabulate_initializers_first % collect more here diff --git a/tex/context/base/tabl-xnt.mkvi b/tex/context/base/tabl-xnt.mkvi index ffa1f501e..fd2de5a13 100644 --- a/tex/context/base/tabl-xnt.mkvi +++ b/tex/context/base/tabl-xnt.mkvi @@ -130,6 +130,6 @@ {\bgroup \tabl_x_prepare{#settings}% \edef\tabl_x_current_buffer{\tabl_x_default_buffer}% - \buff_pickup\tabl_x_current_buffer{bTABLE}{eTABLE}\relax\tabl_x_process} + \buff_pickup\tabl_x_current_buffer{bTABLE}{eTABLE}\relax\tabl_x_process\zerocount} \protect \endinput diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua index d9daefe69..5728b80e9 100644 --- a/tex/context/base/tabl-xtb.lua +++ b/tex/context/base/tabl-xtb.lua @@ -66,6 +66,7 @@ local setfield = nuts.setfield local copy_node_list = nuts.copy_list local hpack_node_list = nuts.hpack local flush_node_list = nuts.flush_list +local takebox = nuts.takebox local nodepool = nuts.pool @@ -81,6 +82,7 @@ local v_height = variables.height local v_repeat = variables["repeat"] local v_max = variables.max local v_fixed = variables.fixed +local v_auto = variables.auto local xtables = { } typesetters.xtables = xtables @@ -257,13 +259,26 @@ function xtables.set_reflow_width() elseif dimensionstate == 3 then fixedrows[r] = height -- width fixedcolumns[c] = width -- height - else -- probably something frozen, like an image -- we could parse the list + elseif data.options[v_auto] then -- new per 5/5/2014 + data.autowidths[c] = true + else + -- no dimensions are set in the cell if width <= data.criterium_h and height >= data.criterium_v then + -- somewhat tricky branch if width > fixedcolumns[c] then -- how about a span here? - fixedcolumns[c] = width + -- maybe an image, so let's fix + fixedcolumns[c] = width + end + else + -- safeguard as it could be text that can be recalculated + -- and the previous branch could have happened in a previous + -- row and then forces a wrong one-liner in a multiliner + if width > fixedcolumns[c] then + data.autowidths[c] = true -- new per 5/5/2014 end end end + -- drc.dimensionstate = dimensionstate -- local nx, ny = drc.nx, drc.ny @@ -309,6 +324,7 @@ function xtables.initialize_reflow_height() end texsetdimen("d_tabl_x_width",w) local dimensionstate = drc.dimensionstate or 0 +-- print(r,c,w,data.autowidths[c]) if dimensionstate == 1 or dimensionstate == 3 then -- width was fixed so height is known texsetcount("c_tabl_x_skip_mode",1) @@ -385,7 +401,8 @@ function xtables.set_construct() -- end local drc = row[c] -- this will change as soon as in luatex we can reset a box list without freeing - drc.list = copy_node_list(getbox("b_tabl_x")) +-- drc.list = copy_node_list(getbox("b_tabl_x")) +drc.list = takebox("b_tabl_x") -- c = c + drc.nx - 1 -- data.currentcolumn = c end @@ -395,7 +412,7 @@ local function showwidths(where,widths,autowidths) for i=1,#widths do result[#result+1] = format("%12s%s",points(widths[i]),autowidths[i] and "*" or " ") end - return report_xtable("%s : %s",where,concat(result," ")) + return report_xtable("%s widths: %s",where,concat(result," ")) end function xtables.reflow_width() diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi index cca56dbee..06fb472cd 100644 --- a/tex/context/base/tabl-xtb.mkvi +++ b/tex/context/base/tabl-xtb.mkvi @@ -159,7 +159,7 @@ {\bgroup \tabl_x_prepare{#settings}% \edef\tabl_x_current_buffer{\tabl_x_default_buffer}% - \buff_pickup{\tabl_x_current_buffer}{startxtable}{stopxtable}\relax\tabl_x_process} + \buff_pickup{\tabl_x_current_buffer}{startxtable}{stopxtable}\relax\tabl_x_process\zerocount} \unexpanded\def\processxtablebuffer {\dosingleempty\tabl_x_process_buffer_directly} @@ -175,7 +175,7 @@ {\bgroup \let\tabl_x_start_table\tabl_x_process_buffer \edef\tabl_x_current_buffer{#name}% - \tabl_x_get_buffer % pickup settings + \tabl_x_get_buffer % settings \tabl_x_process} \unexpanded\def\tabl_x_start_ignore[#settings]% @@ -223,7 +223,7 @@ \tabl_x_check_textwidth \forgetall \edef\tabl_x_current_buffer{\tabl_x_default_buffer}% - \normalexpanded{\buff_pickup{\tabl_x_current_buffer}{\e!start\currentxtable}{\e!stop\currentxtable}\relax\tabl_x_process}} + \normalexpanded{\buff_pickup{\tabl_x_current_buffer}{\e!start\currentxtable}{\e!stop\currentxtable}\relax\tabl_x_process\zerocount}} \unexpanded\def\tabl_x_stop_named {} @@ -569,7 +569,7 @@ {\dostarttagged\t!tablecell\empty % can't we just tag the box \setbox\b_tabl_x\hbox\bgroup \letxtableparameter\c!width \d_tabl_x_width % overloads given width - \letxtableparameter\c!height\d_tabl_x_height % overloads given height + \letxtableparameter\c!height\d_tabl_x_height % overloads given height (commenting it ... nice option) \ctxcommand{x_table_init_construct()}% \inheritedxtableframed\bgroup \tabl_x_begin_of_cell diff --git a/tex/context/base/util-sci.lua b/tex/context/base/util-sci.lua index 98b05fe75..c3e24cd9d 100644 --- a/tex/context/base/util-sci.lua +++ b/tex/context/base/util-sci.lua @@ -54,7 +54,7 @@ local f_fore_none = formatters['.%s { display: inline ; font-weight: normal ; c local f_none_bold = formatters['.%s { display: inline ; font-weight: bold ; }'] local f_none_none = formatters['.%s { display: inline ; font-weight: normal ; }'] local f_div_class = formatters['
%s
'] -local f_linenumber = formatters['\n
%s
'] +local f_linenumber = formatters['
%s
\n'] local f_div_number = formatters['.linenumber { display: inline-block ; font-weight: normal ; width: %sem ; margin-right: 2em ; padding-right: .25em ; text-align: right ; background-color: #C7C7C7 ; }'] local replacer_regular = lpeg.replacer { @@ -63,13 +63,18 @@ local replacer_regular = lpeg.replacer { ["&"] = "&", } -local linenumber = 0 +local linenumber = 0 +local linenumbers = { } local replacer_numbered = lpeg.replacer { ["<"] = "<", [">"] = ">", ["&"] = "&", - [lpeg.patterns.newline] = function() linenumber = linenumber + 1 return f_linenumber(linenumber) end, + [lpeg.patterns.newline] = function() + linenumber = linenumber + 1 + linenumbers[linenumber] = f_linenumber(linenumber) + return "\n" + end, } local css = nil @@ -114,24 +119,19 @@ end local function exportstyled(lexer,text,numbered) local result = lexer.lex(lexer,text,0) - local start = 1 + local start = 1 local whites = exportwhites() - local buffer, b = { "
" }, 1
-    linenumber = 1
+    local buffer = { }
+    local b      = 0
+    linenumber   = 0
+    linenumbers  = { }
     local replacer = numbered and replacer_numbered or replacer_regular
-    if numbered then
-        b = b + 1
-        buffer[b] = f_linenumber(1)
-    end
     local n = #result
     for i=1,n,2 do
         local ii = i + 1
         local style = result[i]
         local position = result[ii]
         local txt = sub(text,start,position-1)
-        if ii == n then
-            txt = gsub(txt,"[%s]+$","")
-        end
         txt = lpegmatch(replacer,txt)
         b = b + 1
         if whites[style] then
@@ -141,9 +141,8 @@ local function exportstyled(lexer,text,numbered)
         end
         start = position
     end
-    buffer[b+1] = "
" buffer = concat(buffer) - return buffer + return buffer, concat(linenumbers) end local function exportcsslinenumber() @@ -154,28 +153,44 @@ local htmlfile = utilities.templates.replacer([[ - context util-sci web page: text + %title% -%lexedcontent% + + + + + +
%linenumbers%
%lexedcontent%
]]) -function scite.tohtml(data,lexname,numbered) +function scite.tohtml(data,lexname,numbered,title) + local source, lines = exportstyled(loadedlexers[lexname],data or "",numbered) return htmlfile { - lexedcontent = exportstyled(loadedlexers[lexname],data or "",numbered), -- before numberstyles + lexedcontent = source, -- before numberstyles lexingstyles = exportcsslexing(), numberstyles = exportcsslinenumber(), + title = title or "context source file", + linenumbers = lines, } end -function scite.filetohtml(filename,lexname,targetname,numbered) - io.savedata(targetname or "util-sci.html",scite.tohtml(io.loaddata(filename),lexname or file.suffix(filename),numbered)) +local function maketargetname(name) + if name then + return file.removesuffix(name) .. "-" .. file.suffix(name) .. ".html" + else + return "util-sci.html" + end +end + +function scite.filetohtml(filename,lexname,targetname,numbered,title) + io.savedata(targetname or "util-sci.html",scite.tohtml(io.loaddata(filename),lexname or file.suffix(filename),numbered,title or filename)) end function scite.css() @@ -192,7 +207,7 @@ local htmlfile = utilities.templates.replacer([[ - context util-sci web page: text + %title%