diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-01-05 19:27:29 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-01-05 19:27:29 +0100 |
commit | b3a298788d63d224d2be014804307741443924e7 (patch) | |
tree | f60ac5ebf251d6c4efee05459955b80e9dc80c99 | |
parent | 34de95238191e2892c8719966fe3c0df65179dda (diff) | |
download | context-b3a298788d63d224d2be014804307741443924e7.tar.gz |
beta 2011.11.21 18:27
23 files changed, 326 insertions, 184 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-xml.lua b/context/data/scite/lexers/scite-context-lexer-xml.lua index 33eeaa210..3c7e30ce7 100644 --- a/context/data/scite/lexers/scite-context-lexer-xml.lua +++ b/context/data/scite/lexers/scite-context-lexer-xml.lua @@ -48,6 +48,15 @@ local openinstruction = P("<?") local closeinstruction = P("?>") local opencdata = P("<![CDATA[") local closecdata = P("]]>") +local opendoctype = P("<!DOCTYPE") -- could grab the whole doctype +local closedoctype = P("]>") + P(">") + +-- <!DOCTYPE Something PUBLIC "... ..." "..." [ ... ] > +-- <!DOCTYPE Something PUBLIC "... ..." "..." > +-- <!DOCTYPE Something SYSTEM "... ..." [ ... ] > +-- <!DOCTYPE Something SYSTEM "... ..." > +-- <!DOCTYPE Something [ ... ] > +-- <!DOCTYPE Something > local entity = ampersand * (1-semicolon)^1 * semicolon @@ -125,14 +134,95 @@ local p_dstring = -- * token("comment",(1-closecdata)^0) -- different from context -- * token("command",closecdata) -local commentlexer = lexer.load("scite-context-lexer-xml-comment") -local cdatalexer = lexer.load("scite-context-lexer-xml-cdata") +-- maybe cdata just text (then we don't need the extra lexer as we only have one comment then) + +-- <!DOCTYPE Something PUBLIC "... ..." "..." [ ... ] > +-- <!DOCTYPE Something PUBLIC "... ..." "..." > +-- <!DOCTYPE Something SYSTEM "... ..." [ ... ] > +-- <!DOCTYPE Something SYSTEM "... ..." > +-- <!DOCTYPE Something [ ... ] > +-- <!DOCTYPE Something > + +-- <!ENTITY xxxx SYSTEM "yyyy" NDATA zzzz> +-- <!ENTITY xxxx PUBLIC "yyyy" > +-- <!ENTITY xxxx "yyyy" > + +local p_docstr = p_dstring + p_sstring + +local p_docent = token("command",P("<!ENTITY")) + * p_optionalwhitespace + * token("keyword",name) + * p_optionalwhitespace + * ( + ( + token("constant",P("SYSTEM")) + * p_optionalwhitespace + * p_docstr + * p_optionalwhitespace + * token("constant",P("NDATA")) + * p_optionalwhitespace + * token("keyword",name) + ) + ( + token("constant",P("PUBLIC")) + * p_optionalwhitespace + * p_docstr + ) + ( + p_docstr + ) + ) + * p_optionalwhitespace + * token("command",P(">")) + +local p_docele = token("command",P("<!ELEMENT")) + * p_optionalwhitespace + * token("keyword",name) + * p_optionalwhitespace + * token("command",P("(")) + * ( + p_spacing + + token("constant",P("#CDATA") + P("#PCDATA") + P("ANY")) + + token("text",P(",")) + + token("comment",(1-S(",)"))^1) + )^1 + * token("command",P(")")) + * p_optionalwhitespace + * token("command",P(">")) + +local p_docset = token("command",P("[")) + * p_optionalwhitespace + * ((p_optionalwhitespace * (p_docent + p_docele))^1 + token("comment",(1-P("]"))^0)) + * p_optionalwhitespace + * token("command",P("]")) + +local p_doctype = token("command",P("<!DOCTYPE")) + * p_optionalwhitespace + * token("keyword",name) + * p_optionalwhitespace + * ( + ( + token("constant",P("PUBLIC")) + * p_optionalwhitespace + * p_docstr + * p_optionalwhitespace + * p_docstr + * p_optionalwhitespace + ) + ( + token("constant",P("SYSTEM")) + * p_optionalwhitespace + * p_docstr + * p_optionalwhitespace + ) + )^-1 + * p_docset^-1 + * p_optionalwhitespace + * token("command",P(">")) + +local commentlexer = lexer.load("scite-context-lexer-xml-comment") -- indirect (some issue with the lexer framework) +local cdatalexer = lexer.load("scite-context-lexer-xml-cdata") -- indirect (some issue with the lexer framework) lexer.embed_lexer(examplelexer, commentlexer, token("command",opencomment), token("command",closecomment)) lexer.embed_lexer(examplelexer, cdatalexer, token("command",opencdata), token("command",closecdata)) --- maybe cdata just text (then we don't need the extra lexer as we only have one comment then) - local p_name = token("plain",name) * ( @@ -197,6 +287,7 @@ _rules = { -- { "text", p_text }, -- { "comment", p_comment }, -- { "cdata", p_cdata }, + { "doctype", p_doctype }, { "instruction", p_instruction }, { "close", p_close }, { "open", p_open }, diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index a8f9b11aa..0334b3b26 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.11.17 15:19} +\newcontextversion{2011.11.21 18:27} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index db5fa9b84..d66803e3e 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{2011.11.17 15:19} +\newcontextversion{2011.11.21 18:27} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex ef2dfe1bd..6c5e32cec 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 3603c06cb..9a62129e0 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 9b1693c4d..6c88149d3 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.11.17 15:19} +\edef\contextversion{2011.11.21 18:27} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index cab2befb6..c3589ad80 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.11.17 15:19} +\edef\contextversion{2011.11.21 18:27} %D For those who want to use this: diff --git a/tex/context/base/lang-url.lua b/tex/context/base/lang-url.lua index 9643f8e0b..09a4e5d90 100644 --- a/tex/context/base/lang-url.lua +++ b/tex/context/base/lang-url.lua @@ -72,7 +72,9 @@ hyphenatedurl.lefthyphenmin = 2 hyphenatedurl.righthyphenmin = 3 hyphenatedurl.discretionary = nil -local function action(hyphenatedurl, str, left, right, disc) +-- more fun is to write nodes + +local function action(hyphenatedurl,str,left,right,disc) local n = 0 local b = math.max( left or hyphenatedurl.lefthyphenmin, 2) local e = math.min(#str-(right or hyphenatedurl.righthyphenmin)+2,#str) @@ -80,6 +82,9 @@ local function action(hyphenatedurl, str, left, right, disc) for s in utfcharacters(str) do n = n + 1 s = mapping[s] or s + if n > 1 then + context.s() -- can be option + end if s == d then context.d(utfbyte(s)) else @@ -97,7 +102,7 @@ end -- hyphenatedurl.action = function(_,...) action(...) end -- sort of obsolete -table.setmetatablecall(hyphenatedurl,action) +table.setmetatablecall(hyphenatedurl,action) -- watch out: a caller -- todo, no interface in mkiv yet diff --git a/tex/context/base/lang-url.mkiv b/tex/context/base/lang-url.mkiv index d34b33bd5..23178a2a2 100644 --- a/tex/context/base/lang-url.mkiv +++ b/tex/context/base/lang-url.mkiv @@ -57,14 +57,28 @@ \def\hyphenatedurlseparator{} % \periodcentered -\def\dohyphenatedurlafter #1{\char#1\discretionary{}{\hyphenatedurlseparator}{}}% -\def\dohyphenatedurlbefore#1{\discretionary{\hyphenatedurlseparator}{}{}\char#1\relax}% -\def\dohyphenatedurlnormal#1{\char#1\relax}% -\def\dohyphenatedurldisc #1{\discretionary{}{}{}} - -\def\sethyphenatedurlnormal #1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,0)}} -\def\sethyphenatedurlbefore #1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,1)}} -\def\sethyphenatedurlafter #1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,2)}} +\def\dohyphenatedurlspace {\nobreak\hskip\zeropoint plus\onepoint\nobreak} +\def\dohyphenatedurlafter #1{\char#1\discretionary{}{\hyphenatedurlseparator}{}} +\def\dohyphenatedurlbefore #1{\discretionary{\hyphenatedurlseparator}{}{}\char#1\relax} +\def\dohyphenatedurlnormal #1{\char#1\relax} +\def\dohyphenatedurldisc #1{\discretionary{}{}{}} + +\def\dohyphenatedurlspace_trace {\nobreak\begingroup\darkyellow\ruledhskip\zeropoint plus\onepoint\endgroup\nobreak} +\def\dohyphenatedurlafter_trace #1{\char#1\hsmash{\darkblue\vl}\discretionary{}{\hyphenatedurlseparator}{}} +\def\dohyphenatedurlbefore_trace#1{\discretionary{\hyphenatedurlseparator}{}{}\hsmash{\darkred\vl}\char#1\relax} +\def\dohyphenatedurlnormal_trace#1{\char#1\relax} +\def\dohyphenatedurldisc_trace #1{\discretionary{\hsmash{\darkgreen\vl}}{\hsmash{\darkgreen\vl}}{\hsmash{\darkgreen\vl}}} + +\def\showhyphenatedurlbreaks + {\let\dohyphenatedurlspace \dohyphenatedurlspace_trace + \let\dohyphenatedurlafter \dohyphenatedurlafter_trace + \let\dohyphenatedurlbefore\dohyphenatedurlbefore_trace + \let\dohyphenatedurlnormal\dohyphenatedurlnormal_trace + \let\dohyphenatedurldisc \dohyphenatedurldisc_trace} + +\def\sethyphenatedurlnormal#1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,0)}} +\def\sethyphenatedurlbefore#1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,1)}} +\def\sethyphenatedurlafter #1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,2)}} \def\hyphenatedurldiscretionary{} @@ -77,6 +91,8 @@ {\dontleavehmode \begingroup \the\everyhyphenatedurl + \language\zerocount + \let\s\dohyphenatedurlspace \let\n\dohyphenatedurlnormal \let\b\dohyphenatedurlbefore \let\a\dohyphenatedurlafter diff --git a/tex/context/base/m-chart.lua b/tex/context/base/m-chart.lua index 0000d28e5..32de8a5ba 100644 --- a/tex/context/base/m-chart.lua +++ b/tex/context/base/m-chart.lua @@ -323,14 +323,18 @@ local function inject(includedata,data,hash) local settings = includedata.settings for i=1,#subdata do local si = subdata[i] - local t = { - x = si.x + xoffset, - y = si.y + yoffset, - settings = settings, - } - setmetatableindex(t,si) - data[#data+1] = t - hash[si.name or #data] = t + if si.include then + inject(si,data,hash) + else + local t = { + x = si.x + xoffset, + y = si.y + yoffset, + settings = settings, + } + setmetatableindex(t,si) + data[#data+1] = t + hash[si.name or #data] = t + end end end diff --git a/tex/context/base/m-mathcrap.mkiv b/tex/context/base/m-mathcrap.mkiv index 3edef3c72..25efd2d5d 100644 --- a/tex/context/base/m-mathcrap.mkiv +++ b/tex/context/base/m-mathcrap.mkiv @@ -36,9 +36,9 @@ \fi \installanddefineactivecharacter "2070 {\mathunicodesupercrap 0} -\installanddefineactivecharacter "00B9 {\mathunicodesupercrap 1}₀ -\installanddefineactivecharacter "00B2 {\mathunicodesupercrap 2}₀ -\installanddefineactivecharacter "00B3 {\mathunicodesupercrap 3}₀ +\installanddefineactivecharacter "00B9 {\mathunicodesupercrap 1} +\installanddefineactivecharacter "00B2 {\mathunicodesupercrap 2} +\installanddefineactivecharacter "00B3 {\mathunicodesupercrap 3} \installanddefineactivecharacter "2074 {\mathunicodesupercrap 4} \installanddefineactivecharacter "2075 {\mathunicodesupercrap 5} \installanddefineactivecharacter "2076 {\mathunicodesupercrap 6} diff --git a/tex/context/base/pack-fen.mkiv b/tex/context/base/pack-fen.mkiv index ad25e130e..63c5659e4 100644 --- a/tex/context/base/pack-fen.mkiv +++ b/tex/context/base/pack-fen.mkiv @@ -13,7 +13,17 @@ \writestatus{loading}{ConTeXt Packaging Macros / Fences for Ruled Content} -% we can move the main fences here too +%D \startbuffer +%D \useMPlibrary[meta-imp-hooks.mkiv] +%D +%D \framed[frame=off,bottomframe=righthook]{Bottom right hook} +%D \stopbuffer +%D +%D \typebuffer +%D +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection \unprotect @@ -34,8 +44,12 @@ \expandafter\let\csname b\@@frame@@\v!off#1\expandafter\endcsname\csname b\@@frame@@\v!on#1\endcsname} \def\setinstalledframedimensions - {\edef\overlayheight{\the\dimexpr\frameddimenht+\frameddimendp}% - \edef\overlaywidth {\the\frameddimenwd}} + {\edef\overlaywidth {\the\frameddimenwd\space}% + \edef\overlayheight{\the\dimexpr\frameddimenht+\frameddimendp\relax\space}% + \edef\overlaydepth {\the\frameddimendp\space}% + \edef\overlaycolor {\framedparameter\c!backgroundcolor}% + \edef\overlaylinecolor{\framedparameter\c!framecolor}% + \edef\overlaylinewidth{\the\ruledlinewidth}} \newbox\specialframebox diff --git a/tex/context/base/page-run.mkiv b/tex/context/base/page-run.mkiv index 9d14ff523..da3a05986 100644 --- a/tex/context/base/page-run.mkiv +++ b/tex/context/base/page-run.mkiv @@ -73,45 +73,67 @@ % maybe we will have page-run.lua \startluacode +local format, concat = string.format, table.concat + local function todimen(name,unit,fmt) return number.todimen(tex.dimen[name],unit,fmt) end -local function showdimension(name) - context.NC() - context.tex(interfaces.interfacedcommand(name)) - context.NC() - context(todimen(name,"pt","%0.4fpt")) - context.NC() - context(todimen(name,"cm","%0.4fcm")) - context.NC() - context(todimen(name,"bp","%0.4fbp")) - context.NC() - context(todimen(name,"dd","%0.4fdd")) - context.NC() - context.NR() -end +function commands.showlayoutvariables(options) -local function showmacro(name) - context.NC() - context.tex(interfaces.interfacedcommand(name)) - context.NC() - context.getvalue(name) - context.NC() - context.NR() -end + if options == "" then + options = "pt,cm" + end -local function reportdimension(name) - commands.writestatus("layout",string.format("%-24s %12s %12s %12s %12s", - interfaces.interfacedcommand(name), - todimen(name,"pt","%0.4fpt"), - todimen(name,"cm","%0.4fcm"), - todimen(name,"bp","%0.4fbp"), - todimen(name,"dd","%0.4fdd") - )) -end + local options = utilities.parsers.settings_to_hash(options) + + local dimensions = { "pt", "bp", "cm", "mm", "dd", "cc", "pc", "nd", "nc", "sp", "in" } + + local n = 0 + for i=1,#dimensions do + if options[dimensions[i]] then + n = n + 1 + end + end -function commands.showlayoutvariables() + if n == 0 then + options.pt = true + n = 1 + end + + local function showdimension(name) + context.NC() + context.tex(interfaces.interfacedcommand(name)) + context.NC() + for i=1,#dimensions do + local d = dimensions[i] + if options[d] then + context("%s%s",todimen(name,d,"%0.4f"),d) + context.NC() + end + end + context.NR() + end + + local function showmacro(name) + context.NC() + context.tex(interfaces.interfacedcommand(name)) + context.NC() + context.getvalue(name) + context.NC() + context.NR() + end + + local function reportdimension(name) + local result = { } + for i=1,#dimensions do + local d = dimensions[i] + if options[d] then + result[#result+1] = format("%12s%s",todimen(name,d,"%0.4f"),d) + end + end + commands.writestatus("layout",format("%-24s %s",interfaces.interfacedcommand(name),concat(result," "))) + end if tex.count.textlevel == 0 then @@ -148,7 +170,7 @@ function commands.showlayoutvariables() else - context.starttabulate { "|l|Tr|Tr|Tr|Tr|" } + context.starttabulate { "|l|" .. string.rep("Tr|",n) } showdimension("paperheight") showdimension("paperwidth") @@ -191,11 +213,11 @@ function commands.showlayoutvariables() end -function commands.showlayout() +function commands.showlayout(options) if tex.count.textlevel == 0 then - commands.showlayoutvariables() + commands.showlayoutvariables(options) else @@ -204,7 +226,7 @@ function commands.showlayout() context.showframe() context.setuplayout { marking = interfaces.variables.on } for i=1,4 do - commands.showlayoutvariables() + commands.showlayoutvariables(options) context.page() end context.egroup() @@ -247,16 +269,17 @@ end \setupbackgrounds [\c!state=\v!repeat]} -\gdef\showframe - {\dodoubleempty\doshowframe} +\gdef\doshowsetups[#1]% + {\ctxcommand{showlayoutvariables("#1")}} -\gdef\showsetups - {\ctxcommand{showlayoutvariables()}} +\gdef\doshowlayout[#1]% + {\ctxcommand{showlayout("#1")}} -\gdef\showlayout % interfereert lelijk met een \typefile er na - {\ctxcommand{showlayout()}} +\unexpanded\gdef\showframe {\dodoubleempty\doshowframe} +\unexpanded\gdef\showsetups{\dodoubleempty\doshowsetups} +\unexpanded\gdef\showlayout{\dodoubleempty\doshowlayout} -\gdef\showmargins +\unexpanded\gdef\showmargins {\starttabulate \NC asynchrone \NC \doifoddpageelse {odd} {even} \NC \NR \NC synchrone \NC \doifrightpageelse {right} {left} \NC \NR diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex c0e065411..99d867160 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 61e3e61e4..6953be39c 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index f6e1753b6..ed5215dce 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -710,6 +710,9 @@ \globallet\currentfloatattribute \empty \globallet\currentfloatsynchronize\relax \else + \ifnofloatnumber \else + \doincrementsubstructurecounter[\@@thestructurecounter\currentfloat][1]% + \fi \dostructurecountercomponent {float}% \setupcurrentfloatcaption diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv index d9adee964..97c2e7581 100644 --- a/tex/context/base/strc-mat.mkiv +++ b/tex/context/base/strc-mat.mkiv @@ -15,7 +15,9 @@ \registerctxluafile{strc-mat}{1.001} -% we have potential for captions +% -- we have potential for captions +% -- this module will use the commandhandler +% -- key/value pairs will be added (I have no time now) \unprotect @@ -29,6 +31,7 @@ \c!location=\v!right, \c!left=(, \c!right=), + \c!expansion=\v!yes, % maybe automatically %\c!numberstyle=, %\c!numbercolor=, %\c!numbercommand=, @@ -48,34 +51,28 @@ \definestructurecounter [\v!formula] -% \setupstructurecounter -% [\v!formula] -% [\c!numberconversionset=\v!formula] - \presetstructurecountersetup\setupformulas\sharedstructurecounterparameter + \appendtoks -% \dostructurecountersetup\currentformula\formulaparameter -% \docheckstructurecountersetup\currentformula \dostructurecountersetup\v!formula\formulaparameter -% \docheckstructurecountersetup\v!formula + \docheckstructurecountersetup\v!formula % yes or no \to \everysetupformulas \setupformulas [\c!numberconversionset=\v!formula] % why forgotten \def\storecurrentformulanumber#1#2#3#4#5% ref, todo:str, \sync % todo: title etc (like float) - {\dostructurecountercomponent + {\settrue\handleformulanumber + \dostructurecountercomponent {formula}% \getformulaparameters \formulaparameter \detokenizedformulaparameter \relax \relax \relax -% [\c!name=\currentformula,\s!counter=\currentformula,% [\c!name=\v!formula,\s!counter=\v!formula,% \s!hascaption=\v!yes,\s!hastitle=\v!yes,\s!hasnumber=\v!yes,%\s!haslevel=#6,% - \s!hasnumber=\v!no,% \c!reference=#1,\c!title=\namedformulaentry,\c!bookmark=]% [#2]% - \glet\namedformulaentry\relax + \glet\namedformulaentry\empty % \relax \globallet#3\laststructurecounternumber \globallet#4\laststructurecountersynchronize \globallet#5\laststructurecounterattribute} @@ -108,7 +105,7 @@ \glet\donestedformulanumber\donestedformulanumberindeed} \def\handleformulasnumbering % formulas - {\docheckformulareference\formulasnumbermode\currentformularesference} + {\docheckformulareference\formulasnumbermode\currentformulareference} \def\handlesubformulasnumbering % sub formulas {\docheckformulareference\subformulasnumbermode\currentsubformulasreference @@ -131,20 +128,6 @@ {\dosetformulaattributes\c!numberstyle\c!numbercolor \strut \formulaparameter\c!left -% \bgroup % somehow needed for tags -% \dostarttagged\t!formulalabel\empty -% \labeltexts\v!formula -% {\ignorespaces -% \dostoptagged -% \dostarttagged\t!formulanumber\empty -% \doplacecurrentformulanumber -% \dostoptagged -% \dostarttagged\t!formulalabel\empty -% \unskip}% -% \dostoptagged -% \egroup -% \taggedlabeltexts\v!formula\v!formula -% {\ignorespaces\doplacecurrentformulanumber\removeunwantedspaces}% \namedtaggedlabeltexts \t!formulalabel \v!formula \t!formulanumber\v!formula @@ -175,8 +158,18 @@ % currently we do the number, some day we will do the (sub) formula +\let\doshowformulareferencestate\relax + +% \def\doshowformulareferencestate +% {\writestatus{\v!formula}% +% {place: \number\placeformulanumbermode,\space +% formula: \number\formulasnumbermode,\space +% subformula: \number\subformulasnumbermode,\space +% nested: \number\nestedformulanumbermode]}} + \def\dohandlecurrentformulareferences - {\ifnum\placeformulanumbermode=\plusthree + {\doshowformulareferencestate + \ifnum\placeformulanumbermode=\plusthree \storecurrentformulanumber \currentplaceformulareference \empty @@ -292,10 +285,32 @@ \appendtoks \global\setfalse\insideplaceformula \global\setfalse\insideplacesubformula -% \global\setfalse\insideformulas -% \global\setfalse\insidesubformulas \to \everyresetformulas +\appendtoks + \placeformulanumbermode \zerocount + \formulasnumbermode \zerocount + \subformulasnumbermode \zerocount + \nestedformulanumbermode \zerocount + \glet\currentformulasreference \empty + \glet\currentformulareference \empty + \glet\currentsubformulareference \empty + \glet\currentnestedformulareference\empty + \glet\currentformulassuffix \empty + \glet\currentformulasuffix \empty + \glet\currentsubformulasuffix \empty + \glet\currentnestedformulasuffix \empty +\to \everyresetformulas + +\let\currentformulasreference \empty +\let\currentformulareference \empty +\let\currentsubformulareference \empty +\let\currentnestedformulareference\empty +\let\currentformulassuffix \empty +\let\currentformulasuffix \empty +\let\currentsubformulasuffix \empty +\let\currentnestedformulasuffix \empty + \newif\ifinformula %D We need a hook into the plain math alignment macros @@ -366,7 +381,7 @@ %D \macros %D {setupsubformulas, startsubformulas} -\def\subformulaparameter#1{\ifcname\??fn#1\endcsname\cname\??fn#1\endcsname\fi} +\def\subformulaparameter#1{\ifcsname\??fn#1\endcsname\csname\??fn#1\endcsname\fi} \unexpanded\def\setupsubformulas {\dodoubleargument\getparameters[\??fn]} @@ -428,20 +443,6 @@ \def\afterdisplayspace {\doifnot{\formulaparameter\c!spaceafter }\v!none{\blank[\formulaparameter\c!spaceafter ]}} -% \def\setpredisplaysize -% {\predisplaysize\lastlinewidth\relax -% \ifdim\predisplaysize<\maxdimen -% \ifdim\predisplaysize>\zeropoint -% \advance\predisplaysize \predisplaysizethreshhold -% \fi -% \advance\predisplaysize \displayindent % needed ? -% \ifdim\predisplaysize>\hsize -% \predisplaysize\hsize -% \fi -% \else -% \predisplaysize\zeropoint -% \fi} - \def\setdisplaydimensions {\displayindent\leftdisplayskip \advance\displayindent\leftdisplaymargin @@ -675,7 +676,7 @@ \def\forceformulanumberflag {+} \def\docheckformulareference#1#2% - {#1\unless\ifx\namedformulaentry\relax % new 29/8/2010 + {#1\unless\ifx\namedformulaentry\empty % \relax % new 29/8/2010 \plusthree \else\ifx#2\empty \zerocount @@ -687,7 +688,7 @@ \plusthree \fi\fi\fi\fi} -\def\formulanumber{\doformulanumber} % for the moment +\unexpanded\def\formulanumber{\doformulanumber} % for the moment \def\doformulanumber {\dosingleempty\dodoformulanumber} @@ -715,11 +716,11 @@ \let\currentplaceformulasuffix\empty \doifnextbgroupelse\moreplaceformula\redoplaceformula} % [ref]{} -\long\def\moreplaceformula#1% +\def\moreplaceformula#1% {\def\currentplaceformulasuffix{#1}% \redoplaceformula} -\long\def\redoplaceformula +\def\redoplaceformula {\doifnextcharelse$\dispplaceformula\dodoplaceformula} % [ref]$$ [ref]\start \def\dodoplaceformula @@ -734,17 +735,6 @@ % to be checked -\def\doformulanumber - {\dosingleempty\dodoformulanumber} - -\def\dodoformulanumber[#1]% - {\def\currentformulareference{#1}% - \dosinglegroupempty\dododoformulanumber} - -\def\redoformulanumber#1% - {\def\currentformulasuffix{#1}% - \dododoformulanumber} - \glet\doplaceformulanumber \relax \glet\donestedformulanumber\gobbletwoarguments @@ -783,7 +773,7 @@ \setformulalistentry{#2}% \next} -\glet\namedformulaentry\relax % this will become a key/value so that we can do bookmarks +\glet\namedformulaentry\empty % \relax % this will become a key/value so that we can do bookmarks \def\setformulalistentry#1% {\gdef\namedformulaentry{#1}} diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index 6ff70ae36..e5d8d2bae 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -478,11 +478,11 @@ \let\currentcounter\currentname \fi % - \doif{#3\c!title}\v!none{\setfalse\hasstructurecountercaption\setfalse\hasstructurecounternumber}% will become obsolete - % - \ifx\hasstructurecounternumber\v!yes % here due to previous test but best in callers - \doincrementsubstructurecounter[\currentcounter][\hasstructurecounterlevel]% - \fi +% \doif{#3\c!title}\v!none{\setfalse\hasstructurecountercaption\setfalse\hasstructurecounternumber}% will become obsolete +% % +% \ifx\hasstructurecounternumber\v!yes % here due to previous test but best in callers +% \doincrementsubstructurecounter[\currentcounter][\hasstructurecounterlevel]% +% \fi % \ifx\hasstructurecountercaption\v!yes \xdef\currentstructurecomponentname {#3\c!name}% diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index f39754e94..615832485 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -386,24 +386,40 @@ end local pushcatcodes, popcatcodes, txtcatcodes = context.pushcatcodes, context.popcatcodes, tex.txtcatcodes -function references.urls.get(name,method,space) -- method: none, before, after, both, space: yes/no +function references.urls.get(name) local u = urls[name] if u then local url, file = u[1], u[2] - pushcatcodes(txtcatcodes) if file and file ~= "" then - context("%s/%s",url,file) + return format("%s/%s",url,file) else - context(url) + return url end + end +end + +function commands.geturl(name) + local url = references.urls.get(name) + if url and url ~= "" then + pushcatcodes(txtcatcodes) + context(url) popcatcodes() end end +-- function commands.gethyphenatedurl(name,...) +-- local url = references.urls.get(name) +-- if url and url ~= "" then +-- hyphenatedurl(url,...) +-- end +-- end + function commands.doifurldefinedelse(name) commands.doifelse(urls[name]) end +commands.useurl= references.urls.define + -- files references.files = references.files or { } @@ -428,6 +444,8 @@ function commands.doiffiledefinedelse(name) commands.doifelse(files[name]) end +commands.usefile= references.files.define + -- helpers function references.checkedfile(whatever) -- return whatever if not resolved @@ -529,7 +547,7 @@ function references.from(name) else local f = files[name] if f then - local description, file = f[1], f[2] + local file, description = f[1], f[2] if description ~= "" then context.dofromfiledescription(description) else diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index 581c1333e..e285a1a8d 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -1323,10 +1323,10 @@ \let\useexternaldocument\usefile \def\do_use_url[#label][#url][#file][#description]% - {\ctxlua{structures.references.urls.define("#label",\!!bs\detokenize{#url}\!!es,\!!bs\detokenize{#file}\!!es,\!!bs\detokenize{#description}\!!es)}} + {\ctxcommand{useurl("#label",\!!bs\detokenize{#url}\!!es,\!!bs\detokenize{#file}\!!es,\!!bs\detokenize{#description}\!!es)}} \def\do_use_file[#label][#file][#description]% - {\ctxlua{structures.references.files.define("#label",\!!bs\detokenize{#file}\!!es,\!!bs\detokenize{#description}\!!es)}} + {\ctxcommand{usefile("#label",\!!bs\detokenize{#file}\!!es,\!!bs\detokenize{#description}\!!es)}} \def\doifurldefinedelse #label{\ctxcommand{doifurldefinedelse ("#label")}} \def\doiffiledefinedelse#label{\ctxcommand{doiffiledefinedelse("#label")}} @@ -1356,11 +1356,9 @@ \begingroup \dosetfontattribute\??ur\c!style \dosetcolorattribute\??ur\c!color - \hyphenatedurl{\ctxlua{structures.references.urls.get("#label","\@@uralternative","\@@urspace")}}% + \hyphenatedurl{\ctxcommand{geturl("#label")}}% \endgroup} -% # fails - %D This macro is hooked into a support macro, and thereby %D \URL's break ok, according to the setting of a switch, %D @@ -1375,30 +1373,13 @@ %D Such an \URL\ is, depending on the settings, hyphenated as: %D %D \getbuffer -%D -%D \startlinecorrection -%D \hbox to \hsize -%D {\hss\en -%D \setupreferencing[urlalternative=both]% -%D \vbox{\hsize.25cm\hbox{\bf both}\prewordbreak\url[test]}% -%D \hss -%D \setupreferencing[urlalternative=before]% -%D \vbox{\hsize.25cm\hbox{\bf before}\prewordbreak\url[test]}% -%D \hss -%D \setupreferencing[urlalternative=after]% -%D \vbox{\hsize.25cm\hbox{\bf after}\prewordbreak\url[test]}% -%D \hss} -%D \stoplinecorrection -%D -%D By setting \type{urlspace=yes} one can get slightly better -%D spacing when using very long \URL's. -%D + %D When defining the external source of information, one can %D also specify a suitable name (the last argument). This name %D can be called upon with: %D %D \showsetup{from} - +%D %D We keep this for compatibility reasons, hence the hackery. \unexpanded\def\reference_from @@ -1597,15 +1578,11 @@ \c!export=\v!no] \setupurl - [\c!alternative=\v!both, - \c!space=\v!no, - \c!style=\v!type, + [\c!style=\v!type, \c!color=] \setupprograms [\c!directory=, - \c!alternative=\v!both, - \c!space=\v!no, \c!style=\v!type, \c!color=] diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 0438480df..74887a3bb 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -1979,13 +1979,13 @@ %D us to do some checking, we reimplemented the non||empty %D ones. -\def\dosingleargument {\let\expectedarguments\plusone \dosingleempty } -\def\dodoubleargument {\let\expectedarguments\plustwo \dodoubleempty } -\def\dotripleargument {\let\expectedarguments\plusthree \dotripleempty } -\def\doquadrupleargument {\let\expectedarguments\plusfour \doquadrupleempty } -\def\doquintupleargument {\let\expectedarguments\plusfive \doquintupleempty } -\def\dosixtupleargument {\let\expectedarguments\plussix \dosixtupleempty } -\def\doseventupleargument{\let\expectedarguments\plusseven \doseventupleempty} +\unexpanded\def\dosingleargument {\let\expectedarguments\plusone \dosingleempty } +\unexpanded\def\dodoubleargument {\let\expectedarguments\plustwo \dodoubleempty } +\unexpanded\def\dotripleargument {\let\expectedarguments\plusthree \dotripleempty } +\unexpanded\def\doquadrupleargument {\let\expectedarguments\plusfour \doquadrupleempty } +\unexpanded\def\doquintupleargument {\let\expectedarguments\plusfive \doquintupleempty } +\unexpanded\def\dosixtupleargument {\let\expectedarguments\plussix \dosixtupleempty } +\unexpanded\def\doseventupleargument{\let\expectedarguments\plusseven \doseventupleempty} %D \macros %D {iffirstagument,ifsecondargument,ifthirdargument, diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi index a848642a3..870ece75b 100644 --- a/tex/context/base/tabl-xtb.mkvi +++ b/tex/context/base/tabl-xtb.mkvi @@ -540,7 +540,8 @@ %D \startbuffer %D \setupxtable[suffix][align=middle,foregroundcolor=red] %D \setupxtable[blabla][foregroundstyle=slanted] -%D \setupxtable[bold] [foregroundstyle=bold] +%D \setupxtable[crap] [foregroundcolor=blue] +%D \setupxtable[bold] [crap][foregroundstyle=bold] %D %D \startxtable[frame=off] %D \startxtablehead diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b9d60a030..80066b3b9 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 : 11/17/11 15:19:19 +-- merge date : 11/21/11 18:27:10 do -- begin closure to overcome local limits and interference |