diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-11-11 00:15:03 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-11-11 00:15:03 +0100 |
commit | 09dd6fdf23ca0bdd27007f0420bc30d841eb5ab0 (patch) | |
tree | 77087dddf7319cf4f657b0639515c56bf5d6b84b /tex | |
parent | f853930e63e059af883ee86b9fe5549cfaa75d43 (diff) | |
download | context-09dd6fdf23ca0bdd27007f0420bc30d841eb5ab0.tar.gz |
2014-11-10 23:15:00
Diffstat (limited to 'tex')
27 files changed, 559 insertions, 425 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 740d43d23..7bd25304b 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.11.10 10:51} +\newcontextversion{2014.11.10 23:13} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. @@ -64,6 +64,7 @@ \def\savedparnumber {\number\c_typo_par_saved} \def\currentparnumber{\number\c_typo_par_current} \def\nofparlines {\number\c_typo_par_lines} +\let\savedparstate \empty \unexpanded\def\shownofparlines {\dontleavehmode\hbox\bgroup diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex bc7049dee..056f96946 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 4eb7ec264..efa0a7383 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.11.10 10:51} +\edef\contextversion{2014.11.10 23:13} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index 28ef5d462..2d3cd252f 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -583,6 +583,12 @@ local function register(askedname,specification) specification = { askedname = askedname, comment = "invalid specification" } elseif forbiddenname(specification.fullname) then specification = { askedname = askedname, comment = "forbidden name" } + elseif specification.internal then + -- no filecheck needed + specification.found = true + if trace_figures then + report_inclusion("format %a internally supported by engine",specification.format) + end else local format = specification.format if format then @@ -729,7 +735,7 @@ local function register(askedname,specification) report_inclusion("format %a natively supported by backend",format) end else - -- specification.found = false -- needs checking + specification.found = true -- else no foo.1 mps conversion if trace_figures then report_inclusion("format %a supported by output file format",format) end @@ -820,7 +826,7 @@ local function locate(request) -- name, format, cache end end -- we could use the hashed data instead - local askedpath= file.is_rootbased_path(askedname) + local askedpath = file.is_rootbased_path(askedname) local askedbase = file.basename(askedname) if askedformat ~= "" then askedformat = lower(askedformat) @@ -841,7 +847,7 @@ local function locate(request) -- name, format, cache end end if format then - local foundname, quitscanning, forcedformat = figures.exists(askedname,format,resolve_too) -- not askedformat + local foundname, quitscanning, forcedformat, internal = figures.exists(askedname,format,resolve_too) -- not askedformat if foundname then return register(askedname, { askedname = askedname, @@ -851,6 +857,7 @@ local function locate(request) -- name, format, cache -- foundname = foundname, -- no conversion = askedconversion, resolution = askedresolution, + internal = internal, }) elseif quitscanning then return register(askedname) @@ -1291,6 +1298,8 @@ includers.mov = includers.nongeneric internalschemes.mprun = true +-- mprun.foo.1 mprun.6 mprun:foo.2 + local function internal(askedname) local spec, mprun, mpnum = match(lower(askedname),"mprun([:%.]?)(.-)%.(%d+)") if spec ~= "" then @@ -1303,7 +1312,7 @@ end function existers.mps(askedname) local mprun, mpnum = internal(askedname) if mpnum then - return askedname + return askedname, true, "mps", true else return existers.generic(askedname) end @@ -1324,7 +1333,7 @@ includers.mps = includers.nongeneric function existers.tex(askedname) askedname = resolvers.findfile(askedname) - return askedname ~= "" and askedname or false + return askedname ~= "" and askedname or false, true, "tex", true end function checkers.tex(data) @@ -1338,7 +1347,7 @@ includers.tex = includers.nongeneric function existers.buffer(askedname) local name = file.nameonly(askedname) local okay = buffers.exists(name) - return okay and name, true -- always quit scanning + return okay and name, true, "buffer", true -- always quit scanning end function checkers.buffer(data) @@ -1365,7 +1374,10 @@ includers.auto = includers.generic -- -- -- cld -- -- -- -existers.cld = existers.tex +function existers.cld(askedname) + askedname = resolvers.findfile(askedname) + return askedname ~= "" and askedname or false, true, "cld", true +end function checkers.cld(data) return checkers_nongeneric(data,function() context.docheckfigurecld(data.used.fullname) end) diff --git a/tex/context/base/lpdf-epd.lua b/tex/context/base/lpdf-epd.lua index 1d1d62cb6..d5cb15839 100644 --- a/tex/context/base/lpdf-epd.lua +++ b/tex/context/base/lpdf-epd.lua @@ -343,7 +343,7 @@ end -- the hex aspect. local u_pattern = lpeg.patterns.utfbom_16_be * lpeg.patterns.utf16_to_utf8_be -local b_pattern = lpeg.patterns.hextobytes +----- b_pattern = lpeg.patterns.hextobytes local function get_string(v) -- the toutf function only converts a utf16 string and leves the original @@ -357,10 +357,11 @@ local function get_string(v) if u then return u -- , "unicode" end - local b = lpegmatch(b_pattern,s) - if b then - return b, "rawtext" - end + -- this is too tricky and fails on e.g. reload of url www.pragma-ade.com) + -- local b = lpegmatch(b_pattern,s) + -- if b then + -- return b, "rawtext" + -- end return s, "rawtext" end diff --git a/tex/context/base/math-fbk.lua b/tex/context/base/math-fbk.lua index 71d743731..271fe3e59 100644 --- a/tex/context/base/math-fbk.lua +++ b/tex/context/base/math-fbk.lua @@ -467,7 +467,9 @@ virtualcharacters[0xFE302] = function(data) return smashed(data,0x0302,0xFE302) virtualcharacters[0xFE303] = function(data) return smashed(data,0x0303,0xFE303) end -- another crazy hack .. doesn't work as we define scrscr first .. we now have smaller --- primes so we have smaller primes for the moment, big ones will become an option +-- primes so we have smaller primes for the moment, big ones will become an option .. +-- these primes in fonts are a real mess .. kind of a dead end, so don't wonder about +-- the values below -- todo: check tounicodes @@ -477,9 +479,6 @@ local function smashed(data,unicode,optional) local xheight = data.target.parameters.xheight local height = 1.2 * xheight local shift = oldchar.height - height --- if unicode == 0x2032 then --- print(string.formatters["%U %0.4p %0.4p %0.4p %0.4p"](unicode,oldchar.height,xheight,data.target.parameters.size,shift)) --- end local newchar = { commands = { { "down", shift }, @@ -494,6 +493,30 @@ local function smashed(data,unicode,optional) end end +-- -- relocate all but less flexible so not used .. instead some noad hackery plus +-- -- the above +-- +-- local function smashed(data,unicode,optional) +-- local oldchar = data.characters[unicode] +-- if oldchar then +-- local xheight = data.target.parameters.xheight +-- local height = oldchar.height +-- local shift = oldchar.height < 1.5*xheight and -(1.8*xheight-height) or 0 +-- local newchar = { +-- commands = { +-- { "down", shift }, +-- { "char", unicode }, +-- }, +-- unicode = unicode, +-- height = height, +-- width = oldchar.width, +-- } +-- return newchar +-- elseif not optional then +-- report_fallbacks("missing %U prime in font %a",unicode,data.target.properties.fullname) +-- end +-- end + addextra(0xFE932, { description="SMASHED PRIME 0x02032", unicodeslot=0xFE932 } ) addextra(0xFE933, { description="SMASHED PRIME 0x02033", unicodeslot=0xFE933 } ) addextra(0xFE934, { description="SMASHED PRIME 0x02034", unicodeslot=0xFE934 } ) diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua index f2a588fc7..f3867876d 100644 --- a/tex/context/base/math-map.lua +++ b/tex/context/base/math-map.lua @@ -184,7 +184,7 @@ local regular_tf = { }, symbols = { [0x2202]=0x2202, [0x2207]=0x2207, - [0x0027]=0x2032, -- prime + [0x0027]=0x2032, -- prime }, } diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index ba4de833d..da17f6a33 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -38,6 +38,7 @@ local trace_processing = false registertracker("math.processing", function( local trace_analyzing = false registertracker("math.analyzing", function(v) trace_analyzing = v end) local trace_normalizing = false registertracker("math.normalizing", function(v) trace_normalizing = v end) local trace_collapsing = false registertracker("math.collapsing", function(v) trace_collapsing = v end) +local trace_patching = false registertracker("math.patching", function(v) trace_patching = v end) local trace_goodies = false registertracker("math.goodies", function(v) trace_goodies = v end) local trace_variants = false registertracker("math.variants", function(v) trace_variants = v end) local trace_alternates = false registertracker("math.alternates", function(v) trace_alternates = v end) @@ -50,6 +51,7 @@ local report_processing = logreporter("mathematics","processing") local report_remapping = logreporter("mathematics","remapping") local report_normalizing = logreporter("mathematics","normalizing") local report_collapsing = logreporter("mathematics","collapsing") +local report_patching = logreporter("mathematics","patching") local report_goodies = logreporter("mathematics","goodies") local report_variants = logreporter("mathematics","variants") local report_alternates = logreporter("mathematics","alternates") @@ -175,10 +177,10 @@ local function process(start,what,n,parent) elseif id == math_char or id == math_textchar or id == math_delim then break elseif id == math_noad then --- if prev then --- -- we have no proper prev in math nodes yet --- setfield(start,"prev",prev) --- end +if prev then + -- we have no proper prev in math nodes yet + setfield(start,"prev",prev) +end local noad = getfield(start,"nucleus") if noad then process(noad,what,n,start) end -- list noad = getfield(start,"sup") if noad then process(noad,what,n,start) end -- list @@ -522,129 +524,6 @@ function handlers.resize(head,style,penalties) return true end -local collapse = { } processors.collapse = collapse - -local mathpairs = characters.mathpairs - -mathpairs[0x2032] = { [0x2032] = 0x2033, [0x2033] = 0x2034, [0x2034] = 0x2057 } -- (prime,prime) (prime,doubleprime) (prime,tripleprime) -mathpairs[0x2033] = { [0x2032] = 0x2034, [0x2033] = 0x2057 } -- (doubleprime,prime) (doubleprime,doubleprime) -mathpairs[0x2034] = { [0x2032] = 0x2057 } -- (tripleprime,prime) - -mathpairs[0x2035] = { [0x2035] = 0x2036, [0x2036] = 0x2037 } -- (reversedprime,reversedprime) (reversedprime,doublereversedprime) -mathpairs[0x2036] = { [0x2035] = 0x2037 } -- (doublereversedprime,reversedprime) - -mathpairs[0x222B] = { [0x222B] = 0x222C, [0x222C] = 0x222D } -mathpairs[0x222C] = { [0x222B] = 0x222D } - -mathpairs[0x007C] = { [0x007C] = 0x2016, [0x2016] = 0x2980 } -- bar+bar=double bar+double=triple -mathpairs[0x2016] = { [0x007C] = 0x2980 } -- double+bar=triple - -local movesub = { - -- primes - [0x2032] = 0xFE932, - [0x2033] = 0xFE933, - [0x2034] = 0xFE934, - [0x2057] = 0xFE957, - -- reverse primes - [0x2035] = 0xFE935, - [0x2036] = 0xFE936, - [0x2037] = 0xFE937, -} - -local validpair = { - [noad_rel] = true, - [noad_ord] = true, - [noad_opdisplaylimits] = true, - [noad_oplimits] = true, - [noad_opnolimits] = true, -} - -local function movesubscript(parent,current_nucleus,current_char) - local prev = getfield(parent,"prev") - if prev and getid(prev) == math_noad then - if not getfield(prev,"sup") and not getfield(prev,"sub") then - setfield(current_nucleus,"char",movesub[current_char or getchar(current_nucleus)]) - -- {f} {'}_n => f_n^' - local nucleus = getfield(parent,"nucleus") - local sub = getfield(parent,"sub") - local sup = getfield(parent,"sup") - setfield(prev,"sup",nucleus) - setfield(prev,"sub",sub) - local dummy = copy_node(nucleus) - setfield(dummy,"char",0) - setfield(parent,"nucleus",dummy) - setfield(parent,"sub",nil) - if trace_collapsing then - report_collapsing("fixing subscript") - end - end - end -end - -local function collapsepair(pointer,what,n,parent,nested) -- todo: switch to turn in on and off - if parent then - if validpair[getsubtype(parent)] then - local current_nucleus = getfield(parent,"nucleus") - if getid(current_nucleus) == math_char then - local current_char = getchar(current_nucleus) - if not getfield(parent,"sub") and not getfield(parent,"sup") then - local mathpair = mathpairs[current_char] - if mathpair then - local next_noad = getnext(parent) - if next_noad and getid(next_noad) == math_noad then - if validpair[getsubtype(next_noad)] then - local next_nucleus = getfield(next_noad,"nucleus") - if getid(next_nucleus) == math_char then - local next_char = getchar(next_nucleus) - local newchar = mathpair[next_char] - if newchar then - local fam = getfield(current_nucleus,"fam") - local id = font_of_family(fam) - local characters = fontcharacters[id] - if characters and characters[newchar] then - if trace_collapsing then - report_collapsing("%U + %U => %U",current_char,next_char,newchar) - end - setfield(current_nucleus,"char",newchar) - local next_next_noad = getnext(next_noad) - if next_next_noad then - setfield(parent,"next",next_next_noad) - setfield(next_next_noad,"prev",parent) - else - setfield(parent,"next",nil) - end - setfield(parent,"sup",getfield(next_noad,"sup")) - setfield(parent,"sub",getfield(next_noad,"sub")) - setfield(next_noad,"sup",nil) - setfield(next_noad,"sub",nil) - free_node(next_noad) - collapsepair(pointer,what,n,parent,true) - if not nested and movesub[current_char] then - movesubscript(parent,current_nucleus) - end - end - end - end - end - end - elseif not nested and movesub[current_char] then - movesubscript(parent,current_nucleus,current_char) - end - elseif not nested and movesub[current_char] then - movesubscript(parent,current_nucleus,current_char) - end - end - end - end -end - -collapse[math_char] = collapsepair - -function noads.handlers.collapse(head,style,penalties) - processnoads(head,collapse,"collapse") - return true -end - -- normalize scripts local unscript = { } noads.processors.unscript = unscript @@ -904,6 +783,12 @@ local function getcorrection(method,font,char) -- -- or character.italic -- (thi end +local setcolor = nodes.tracers.colors.set +local resetcolor = nodes.tracers.colors.reset +local italic_kern = new_kern +local c_positive_d = "trace:db" +local c_negative_d = "trace:dr" + local function insert_kern(current,kern) local sub = new_node(math_sub) -- todo: pool local noad = new_node(math_noad) -- todo: pool @@ -913,12 +798,6 @@ local function insert_kern(current,kern) return sub end -local setcolor = nodes.tracers.colors.set -local resetcolor = nodes.tracers.colors.reset -local italic_kern = new_kern -local c_positive_d = "trace:db" -local c_negative_d = "trace:dr" - registertracker("math.italics", function(v) if v then italic_kern = function(k,font) @@ -1049,6 +928,133 @@ function mathematics.resetitalics() texsetattribute(a_mathitalics,unsetvalue) end +-- primes and such + +local collapse = { } processors.collapse = collapse + +local mathpairs = characters.mathpairs + +mathpairs[0x2032] = { [0x2032] = 0x2033, [0x2033] = 0x2034, [0x2034] = 0x2057 } -- (prime,prime) (prime,doubleprime) (prime,tripleprime) +mathpairs[0x2033] = { [0x2032] = 0x2034, [0x2033] = 0x2057 } -- (doubleprime,prime) (doubleprime,doubleprime) +mathpairs[0x2034] = { [0x2032] = 0x2057 } -- (tripleprime,prime) + +mathpairs[0x2035] = { [0x2035] = 0x2036, [0x2036] = 0x2037 } -- (reversedprime,reversedprime) (reversedprime,doublereversedprime) +mathpairs[0x2036] = { [0x2035] = 0x2037 } -- (doublereversedprime,reversedprime) + +mathpairs[0x222B] = { [0x222B] = 0x222C, [0x222C] = 0x222D } +mathpairs[0x222C] = { [0x222B] = 0x222D } + +mathpairs[0x007C] = { [0x007C] = 0x2016, [0x2016] = 0x2980 } -- bar+bar=double bar+double=triple +mathpairs[0x2016] = { [0x007C] = 0x2980 } -- double+bar=triple + +local movesub = { + -- primes + [0x2032] = 0xFE932, + [0x2033] = 0xFE933, + [0x2034] = 0xFE934, + [0x2057] = 0xFE957, + -- reverse primes + [0x2035] = 0xFE935, + [0x2036] = 0xFE936, + [0x2037] = 0xFE937, +} + +local validpair = { + [noad_rel] = true, + [noad_ord] = true, + [noad_opdisplaylimits] = true, + [noad_oplimits] = true, + [noad_opnolimits] = true, +} + +local function movesubscript(parent,current_nucleus,current_char) + local prev = getfield(parent,"prev") + if prev and getid(prev) == math_noad then + if not getfield(prev,"sup") and not getfield(prev,"sub") then + setfield(current_nucleus,"char",movesub[current_char or getchar(current_nucleus)]) + -- {f} {'}_n => f_n^' + local nucleus = getfield(parent,"nucleus") + local sub = getfield(parent,"sub") + local sup = getfield(parent,"sup") + setfield(prev,"sup",nucleus) + setfield(prev,"sub",sub) + local dummy = copy_node(nucleus) + setfield(dummy,"char",0) + setfield(parent,"nucleus",dummy) + setfield(parent,"sub",nil) + if trace_collapsing then + report_collapsing("fixing subscript") + end + end + end +end + +local function collapsepair(pointer,what,n,parent,nested) -- todo: switch to turn in on and off + if parent then + if validpair[getsubtype(parent)] then + local current_nucleus = getfield(parent,"nucleus") + if getid(current_nucleus) == math_char then + local current_char = getchar(current_nucleus) + if not getfield(parent,"sub") and not getfield(parent,"sup") then + local mathpair = mathpairs[current_char] + if mathpair then + local next_noad = getnext(parent) + if next_noad and getid(next_noad) == math_noad then + if validpair[getsubtype(next_noad)] then + local next_nucleus = getfield(next_noad,"nucleus") + local next_char = getchar(next_nucleus) + if getid(next_nucleus) == math_char then + local newchar = mathpair[next_char] + if newchar then + local fam = getfield(current_nucleus,"fam") + local id = font_of_family(fam) + local characters = fontcharacters[id] + if characters and characters[newchar] then + if trace_collapsing then + report_collapsing("%U + %U => %U",current_char,next_char,newchar) + end + setfield(current_nucleus,"char",newchar) + local next_next_noad = getnext(next_noad) + if next_next_noad then + setfield(parent,"next",next_next_noad) + setfield(next_next_noad,"prev",parent) + else + setfield(parent,"next",nil) + end + setfield(parent,"sup",getfield(next_noad,"sup")) + setfield(parent,"sub",getfield(next_noad,"sub")) + setfield(next_noad,"sup",nil) + setfield(next_noad,"sub",nil) + free_node(next_noad) + collapsepair(pointer,what,n,parent,true) + if not nested and movesub[current_char] then + movesubscript(parent,current_nucleus,current_char) + end + end + end + end + end + elseif not nested and movesub[current_char] then + movesubscript(parent,current_nucleus,current_char) + end + elseif not nested and movesub[current_char] then + movesubscript(parent,current_nucleus,current_char) + end + elseif not nested and movesub[current_char] then + movesubscript(parent,current_nucleus,current_char) + end + end + end + end +end + +collapse[math_char] = collapsepair + +function noads.handlers.collapse(head,style,penalties) + processnoads(head,collapse,"collapse") + return true +end + -- variants local variants = { } diff --git a/tex/context/base/math-stc.mkvi b/tex/context/base/math-stc.mkvi index 6d1450f29..54824c58b 100644 --- a/tex/context/base/math-stc.mkvi +++ b/tex/context/base/math-stc.mkvi @@ -546,6 +546,11 @@ \setbox\scratchboxtwo\csname\??mathstackersalternative\p_alternative\endcsname \setbox\scratchboxthree\hbox to \scratchwidth{\hss\box\scratchboxthree\hss}% % + \scratchunicode#codeextra\relax + \ifcase\scratchunicode\else + \setbox\scratchboxone\csname\??mathstackersalternative\p_alternative\endcsname + \fi + % \math_stackers_normalize_three % analysis \ifcase#bottom\relax @@ -573,17 +578,17 @@ \kern-\scratchwidth % under \math_stackers_start_tagged_bot - \scratchunicode#codeextra\relax - \ifcase\scratchunicode\else - \setbox\scratchboxtwo\csname\??mathstackersalternative\p_alternative\endcsname - \fi \math_stackers_bottom\bgroup \lower\dimexpr \scratchdepth +\ht\scratchboxtwo +\mathstackersparameter\c!distance % was \c!voffset \relax - \box\scratchboxtwo + \ifcase#top\relax + \box\scratchboxtwo + \else + \box\scratchboxone + \fi \egroup \math_stackers_stop_tagged \fi diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 449115619..e6c444347 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -282,6 +282,8 @@ return { "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", -- "firstofoneunexpanded", + "firstoftwounexpanded", "secondoftwounexpanded", + "firstofthreeunexpanded", "secondofthreeunexpanded", "thirdofthreeunexpanded", -- "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", diff --git a/tex/context/base/page-mix.lua b/tex/context/base/page-mix.lua index 2695d915b..e5e5cdb5e 100644 --- a/tex/context/base/page-mix.lua +++ b/tex/context/base/page-mix.lua @@ -867,6 +867,7 @@ function mixedcolumns.getsplit(result,n) if grid then -- print(n,result.maxtotal,r.total,r.extra) if isglobal then + local rh = r.height -- ht = (lineheight * ceil(result.height/lineheight) - strutdp ht = amount(rh,strutdp,0) dp = strutdp diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua index 37566cd94..7e0d06121 100644 --- a/tex/context/base/publ-imp-apa.lua +++ b/tex/context/base/publ-imp-apa.lua @@ -76,17 +76,18 @@ local categories = specification.categories categories.article = { sets = { - authors = { "author", "editor", "title" }, - links = { "doi", "url" }, + author = { "author", "editor", "title" }, + links = { "doi", "url" }, + isbn = { "issn" }, }, required = { - "authors" + "author" }, optional = { "year", "subtitle", "type", "file", "journal", "volume", "number", "pages", - "note", "links", + "note", "links", "isbn", }, } @@ -95,7 +96,7 @@ categories.article = { categories.magazine = { sets = categories.article.sets, required = { - "authors", + "author", "year", "journal", }, @@ -103,7 +104,7 @@ categories.magazine = { "subtitle", "type", "file", "volume", "number", "pages", "month", "day", - "note", "links", + "note", "links", "isbn", }, } @@ -113,18 +114,20 @@ categories.newspaper = categories.magazine categories.periodical = { sets = { - authors = { "editor", "publisher" }, + author = { "editor", "publisher" }, + links = { "doi", "url" }, + isbn = { "issn" }, }, required = { "title", "year", }, optional = { - "authors", + "author", "subtitle", "file", "series", "volume", "number", "month", "organization", - "note", + "note", "links", "isbn", }, } @@ -132,10 +135,10 @@ categories.periodical = { categories.standard = { sets = { - authors = { "author", "institution", "organization" }, + author = { "author", "institution", "organization" }, }, required = { - "authors", + "author", "year", "title", "subtitle", "note", @@ -150,16 +153,16 @@ categories.standard = { categories.book = { sets = { - authors = { "author", "editor", "publisher", "title" }, + author = { "author", "editor", "publisher", "title" }, }, - required = { "authors" }, + required = { "author" }, optional = { "year", "month", "day", "subtitle", "type", "file", "edition", "series", "volume", "number", "pages", "address", "url", - "note", "ISBN" + "note", "isbn" }, } @@ -167,10 +170,10 @@ categories.book = { categories.inbook = { sets = { - authors = { "author", "editor", "publisher", "title", "chapter", "pages" }, + author = { "author", "editor", "publisher", "title", "chapter", "pages" }, }, required = { - "authors", + "author", "year" , }, optional = { @@ -178,7 +181,7 @@ categories.inbook = { "volume", "number", "series", "edition", "month", "address", - "note", "ISBN", + "note", "isbn", }, } @@ -186,10 +189,10 @@ categories.inbook = { categories.booklet = { sets = { - authors = { "author", "title" }, + author = { "author", "title" }, }, required = { - "authors" + "author" }, optional = { "year", "month", @@ -204,10 +207,10 @@ categories.booklet = { categories.incollection = { sets = { - authors = { "author", "editor", "publisher" }, + author = { "author", "editor", "publisher" }, }, required = { - "authors", + "author", "title", "booktitle", "year", }, @@ -217,7 +220,7 @@ categories.incollection = { "volume", "number", "series", "chapter", "pages", "address", - "note", "ISBN", + "note", "isbn", }, } @@ -234,7 +237,7 @@ categories.proceedings = { "volume", "number", "series", "pages", "month", "address", "publisher", "organization", - "note", "ISBN" + "note", "isbn" }, } @@ -249,7 +252,7 @@ categories.inproceedings = { "volume", "number", "series", "pages", "address", "organization", - "note", "ISBN" + "note", "isbn" }, } @@ -289,7 +292,7 @@ categories.techreport = { "subtitle", "type", "file", "number", "month", "address", - "note" + "note", --"isbn", }, } @@ -303,7 +306,7 @@ categories.manual = { "subtitle", "file", "author", "address", "organization", "edition", "month", "year", - "note", + "note", "isbn", }, } @@ -361,6 +364,9 @@ categories.electronic = { -- use this type when nothing else fits. categories.misc = { + sets = { + isbn = { "isbn", "issn" }, + }, required = { -- nothing is really important here }, @@ -369,13 +375,16 @@ categories.misc = { "title", "subtitle", "file", "year", "month", "howpublished", - "note" + "note", "isbn", }, } -- other (whatever jabref does not know!) categories.other = { + sets = { + isbn = { "isbn", "issn" }, + }, required = { "author", "title", @@ -384,7 +393,7 @@ categories.other = { optional = { "subtitle", "file", "note", - "doi" + "doi", "isbn", }, } diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index ffb9fb1ca..ef148e657 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -46,7 +46,7 @@ \c!etallimit=5, \c!etaldisplay=\btxlistvariantparameter\c!etallimit, %\c!journalconversion=\v!normal, - \c!monthconversion=\v!number, + \c!monthconversion=\v!month, \c!authorconversion=\v!invertedshort] \definebtxlistvariant @@ -77,7 +77,7 @@ \c!surnamefirstnamesep=\btxlistvariantparameter\c!surnamefirstnamesep, \c!etallimit=5, % when 2-4, show all first time, etaldisplay subsequently... \c!etaldisplay=1, - \c!monthconversion=\btxlistvariantparameter\c!monthconversion, + % \c!monthconversion=\btxlistvariantparameter\c!monthconversion, \c!authorconversion=\v!name, \c!interaction=\v!start, % \c!setups=btx:cite:initialize, @@ -302,35 +302,11 @@ \fi \stoptexdefinition -\starttexdefinition btx:apa:suffixeddate - \btxleftparenthesis - \btxdoifelse {year} { - \btxflush{year} - \btxflush{suffix} - \btxdoif {month} { - \btxcomma - % language issue here (monthconversion)? - \btxflush{month} - \btxdoif {day} { - \btxspace - \btxflush{day} - } - } - } { - \btxlabeltext{apa:nd} - \btxdoif {suffix} { - \btxspace - \btxflush{suffix} - } - } - \btxrightparenthesisperiod -\stoptexdefinition - \starttexdefinition btx:apa:title-subtitle-type \btxdoif {title} { \setmode{btx:apa:title-placed} \btxdoif {file} { - % we make the title active opening file + % we make the title active, opening file \texdefinition{btx:apa:inject} {url(file:\btxflush{file})} } { @@ -351,77 +327,76 @@ } \stoptexdefinition -\starttexdefinition btx:apa:author-or-title - <\btxfieldname{authors},\btxfieldtype{authors}>\space\btxflush{authors}\space - \btxdoifelse {author} { - \btxflushauthor[invertedshort]{author} - } { - \texdefinition{btx:apa:title-subtitle-type} +\starttexdefinition btx:apa:title-if-not-placed #it + \doifnotmode {btx:apa:title-placed} { + \btxdoif {title} { + \btxspace + \doifelse {#it} {it} { + \begingroup + \it + \texdefinition{btx:apa:title-subtitle-type} + \italiccorrection + \endgroup + } { + \texdefinition{btx:apa:title-subtitle-type} + } + } } \stoptexdefinition \starttexdefinition btx:apa:editor-or-editors - \btxleftparenthesis - \btxsingularorplural {editor} { - \btxlabeltext{apa:Editor} - } { - \btxlabeltext{apa:Editors} + \btxdoif {editor} { + \btxflush {editor} + \btxleftparenthesis + \btxsingularorplural {editor} { + \btxlabeltext{apa:Editor} + } { + \btxlabeltext{apa:Editors} + } + \btxrightparenthesisperiod } - \btxrightparenthesisperiod \stoptexdefinition -\starttexdefinition btx:apa:author-or-editor-or-publisher-or- #title #publisher - <\btxfieldname{authors},\btxfieldtype{authors}>\space\btxflush{authors}\space - \btxdoifelse {author} { - \btxflushauthor[invertedshort]{author} - } { - \btxdoifelse {editor} { - \btxflushauthor[invertedshort]{editor} +\unprotect + +\starttexdefinition btx:apa:authoryear + % we make the authoryear active, pointing to the citation + \texdefinition{btx:apa:inject} {\s!internal(\currentbtxinternal)} + { +<\btxfoundname{author},\btxfoundtype{author}> + \doifelse {\btxfoundname{author}} {editor} { \texdefinition{btx:apa:editor-or-editors} } { - \btxdoifelse {#publisher} { -% \setmode{btx:apa:publisher-as-author} - \btxflush{#publisher} + \doifelse {\btxfoundname{author}} {title} { + \texdefinition{btx:apa:title-subtitle-type} } { - \doif {#title} {title} { - \texdefinition{btx:apa:title-subtitle-type} - } + \btxflush {author} } } - } -\stoptexdefinition - -\starttexdefinition btx:apa:editor-or-organization #title - \btxdoifelse {editor} { - \btxflushauthor[invertedshort]{editor} - \texdefinition{btx:apa:editor-or-editors} - } { - \btxdoifelse {organization} { - \btxflush{organization} + \btxleftparenthesis + \btxdoifelse {year} { + \btxflush{year} + \btxflush{suffix} + \btxdoif {month} { + \btxcomma + \btxflush{month} + \btxdoif {day} { + \btxspace + \btxflush{day} + } + } } { - \doif {#title} {title} { - \texdefinition{btx:apa:title-subtitle-type} + \btxlabeltext{apa:nd} + \btxdoif {suffix} { + \btxspace + \btxflush{suffix} } } + \btxrightparenthesisperiod } \stoptexdefinition -\starttexdefinition btx:apa:title-if-not-placed #it - \doifnotmode {btx:apa:title-placed} { - \btxdoif {title} { - \btxspace - \doifelse {#it} {it} { - \begingroup - \it - \texdefinition{btx:apa:title-subtitle-type} - \italiccorrection - \endgroup - } { - \texdefinition{btx:apa:title-subtitle-type} - } - } - } -\stoptexdefinition +\protect \starttexdefinition btx:apa:italic #field \begingroup @@ -441,11 +416,7 @@ \btxspace } } - \btxdoif {editor} { - \btxflushauthor[normalshort]{editor} - \btxspace - \texdefinition{btx:apa:editor-or-editors} - } + \texdefinition{btx:apa:editor-or-editors} \btxdoif {#title} { \texdefinition{btx:apa:italic}{Word -> #title} } @@ -608,30 +579,41 @@ \btxspace \btxlabeltext{apa:Retrieved} \btxspace - \ifconditional\btxinteractive + \btxdoifelseinteractive {url} { \goto { \hyphenatedurl{\btxflush{url}} } [ url(\btxflush{url}) ] - \else + } { \hyphenatedurl{\btxflush{url}} - \fi + } } \stoptexdefinition \starttexdefinition btx:apa:doi \btxdoif {doi} { \btxspace - \ifconditional\btxinteractive + \btxdoifelseinteractive {doi} { \goto { doi:\btxflush{doi} } [ url(http://dx.doi.org/\btxflush{doi}) ] - \else + } { doi:\btxflush{doi} - \fi + } + } +\stoptexdefinition + +\starttexdefinition btx:apa:isbn + % also issn - see publ-imp-apa.lua + \btxdoif {isbn} { + \btxleftparenthesis + %broken: \btxfoundname{WORD -> isbn}:\btxspace + \btxfoundname{isbn}:\btxspace + \btxflush{isbn} + \btxrightparenthesis } \stoptexdefinition @@ -640,8 +622,7 @@ \btxdoif {note} { \btxleftparenthesis {\btxflush{note}} - \btxrightparenthesis\removeunwantedspaces - % no space if last item! + \btxrightparenthesis } \stoptexdefinition @@ -649,8 +630,10 @@ \btxdoifnot {doi} { \texdefinition{btx:apa:url} } + \texdefinition{btx:apa:isbn} \texdefinition{btx:apa:note} \texdefinition{btx:apa:doi} + \removeunwantedspaces \stoptexdefinition \starttexdefinition btx:apa:doifelse-publisher-or-author-or-editor #author #if #else @@ -743,8 +726,7 @@ % Note that bibtex (and tools) do not include editor (e.g. special issue or section) \startsetups btx:apa:article - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:journal-volume-number-pages}{} \texdefinition{btx:apa:url-note-doi} @@ -755,8 +737,7 @@ % Optional fields: volume, number, pages, type, month, day, doi, url, note. \startsetups btx:apa:magazine - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:journal-volume-number-pages}{} \texdefinition{btx:apa:url-note-doi} @@ -767,8 +748,7 @@ % Optional fields: volume, number, pages, type, month, day, doi, url, note. \startsetups btx:apa:newspaper - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:journal-volume-number-pages}{pp} \texdefinition{btx:apa:url-note-doi} @@ -782,8 +762,7 @@ % todo: series? \startsetups btx:apa:book - \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{publisher} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{author} @@ -798,8 +777,7 @@ % todo: series? \startsetups btx:apa:inbook - \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{}{publisher} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \btxdoif {chapter} { \btxflush{Word -> chapter} \btxspace @@ -818,8 +796,7 @@ % todo: series? \startsetups btx:apa:incollection - \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{publisher} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:editor}{booktitle} \texdefinition{btx:apa:edition-volume-number-pages}{edition} @@ -833,8 +810,7 @@ % todo: series? \startsetups btx:apa:proceedings - \texdefinition{btx:apa:editor-or-organization}{title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \btxdoifelse {editor} { @@ -856,8 +832,7 @@ % todo: series? \startsetups btx:apa:inproceedings - \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{publisher} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:editor}{booktitle} \texdefinition{btx:apa:edition-volume-number-pages}{edition} @@ -880,9 +855,7 @@ \startsetups btx:apa:thesis \setmode{btx:apa:thesis} - % unlikely not to have author! - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \btxleftparenthesis \btxdoifelse {type} { @@ -924,8 +897,7 @@ % Optional fields: author, howpublished, address, month, year, note. \startsetups btx:apa:booklet - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{howpublished} \texdefinition{btx:apa:url-note-doi} @@ -936,8 +908,7 @@ % Optional fields: author, organization, address, edition, month, year, note. \startsetups btx:apa:manual - \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{organization} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{organization} @@ -949,8 +920,7 @@ % Optional fields: type, number, address, month, note. \startsetups btx:apa:techreport - \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{institution} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:edition-volume-number-pages}{type} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{institution} @@ -962,8 +932,7 @@ % Optional fields: month, year. \startsetups btx:apa:unpublished - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -976,8 +945,7 @@ % todo: yearfiled, monthfiled, dayfiled \startsetups btx:apa:patent - \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{assignee} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \begingroup \it @@ -1036,8 +1004,7 @@ % Like Misc below but includes organization. \startsetups btx:apa:electronic - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \btxdoif {organization} { \btxspace @@ -1057,8 +1024,7 @@ % Optional fields: note, doi, url \startsetups btx:apa:other - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -1068,8 +1034,7 @@ % Optional fields: author, title, howpublished, month, year, note. \startsetups btx:apa:misc - \texdefinition{btx:apa:author-or-title} - \texdefinition{btx:apa:suffixeddate} + \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{it} \btxdoif {howpublished} { \btxspace diff --git a/tex/context/base/publ-imp-definitions.mkiv b/tex/context/base/publ-imp-definitions.mkiv index 6b93821fc..a3196cc37 100644 --- a/tex/context/base/publ-imp-definitions.mkiv +++ b/tex/context/base/publ-imp-definitions.mkiv @@ -49,6 +49,13 @@ \fi\fi \stopxmlsetups +\startxmlsetups btx:format:year + \edef\currentbtxfieldyear{\btxfield{year}} + \ifx\currentbtxfieldyear\empty + \btxlabeltext{\currentbtxspecification:nd} + \fi +\stopxmlsetups + \startxmlsetups btx:format:month \edef\currentbtxfieldmonth{\btxfield{month}} \ifx\currentbtxfieldmonth\empty diff --git a/tex/context/base/publ-imp-page.mkvi b/tex/context/base/publ-imp-page.mkvi index e4eaacb92..3f8fb96be 100644 --- a/tex/context/base/publ-imp-page.mkvi +++ b/tex/context/base/publ-imp-page.mkvi @@ -24,6 +24,9 @@ \setupbtxrendering [\c!pagestate=\v!stop] +\definebtxlistvariant + [\v!page] + \startsetups \s!btx:\s!list:\s!page:concat \ifcase\currentbtxoverflow \ifcase\currentbtxconcat @@ -40,19 +43,27 @@ \startsetups \s!btx:\s!list:\s!page:normal \fastsetup{\s!btx:\s!list:\s!page:concat} - \goto { - \currentbtxfirstpage - } [ - internal(\currentbtxfirstinternal) - ] - \ifx\currentbtxlastpage\empty \else - \btxlistparameter\c!pageconnector + \btxdoifelseinteractive {page} { \goto { + \currentbtxfirstpage + } [ + internal(\currentbtxfirstinternal) + ] + \ifx\currentbtxlastpage\empty \else + \btxlistvariantparameter\c!pageconnector + \goto { + \currentbtxlastpage + } [ + internal(\currentbtxlastinternal) + ] + \fi + } { + \currentbtxfirstpage + \ifx\currentbtxlastpage\empty \else + \btxlistvariantparameter\c!pageconnector \currentbtxlastpage - } [ - internal(\currentbtxlastinternal) - ] - \fi + \fi + } \stopsetups \protect diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 784813330..054e20d37 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -975,19 +975,19 @@ do end end - local function get(name,tag,field,what) + local function get(name,tag,field,what,check) local dataset = rawget(datasets,name) if dataset then - local fields = dataset.luadata[tag] - if fields then - local category = fields.category - local catspec = currentspecificationcategories[category] + local data = dataset.luadata[tag] + if data then + local category = data.category + local catspec = currentspecificationcategories[category] if not catspec then return false end local fields = catspec.fields if fields then - local kind = fields[field] + local kind = (not check or data[field]) and fields[field] if kind then return what and kind or field end @@ -995,12 +995,22 @@ do if sets then local set = sets[field] if set then - for i=1,#set do - local field = set[i] - local kind = fields[field] - if kind then - return what and kind or field + if check then + for i=1,#set do + local field = set[i] + local kind = (not check or data[field]) and fields[field] + if kind then + return what and kind or field + end end + elseif what then + local t = { } + for i=1,#set do + t[i] = fields[set[i]] or "unknown" + end + return concat(t,",") + else + return concat(set,",") end end end @@ -1010,17 +1020,10 @@ do return "" end - function commands.btxfieldname(name,tag,field) - local found = get(name,tag,field) - -- print(name,tag,field,found) - context(found) - end - - function commands.btxfieldtype(name,tag,field) - local found = get(name,tag,field,true) - -- print(name,tag,field,found) - context(found) - end + function commands.btxfieldname(name,tag,field) context(get(name,tag,field,false,false)) end + function commands.btxfieldtype(name,tag,field) context(get(name,tag,field,true, false)) end + function commands.btxfoundname(name,tag,field) context(get(name,tag,field,false,true )) end + function commands.btxfoundtype(name,tag,field) context(get(name,tag,field,true, true )) end function commands.btxflush(name,tag,field) local dataset = rawget(datasets,name) diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 552b322f8..f2a45584b 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -195,16 +195,20 @@ \unexpanded\setvalue{\??constructionstarthandler\v!btxlist}% {\csname\??constructionstarthandler\v!construction\endcsname - \ifx\currentbtxnumbering\v!no\else - \ifx\currentbtxinternal\empty \else - \startgoto[\s!internal(\currentbtxinternal)]% + \ifconditional\btx_interactive + \ifx\currentbtxnumbering\v!no\else + \ifx\currentbtxinternal\empty \else + \startgoto[\s!internal(\currentbtxinternal)]% + \fi \fi \fi} \unexpanded\setvalue{\??constructionstophandler\v!btxlist}% - {\ifx\currentbtxnumbering\v!no\else - \ifx\currentbtxinternal\empty \else - \stopgoto + {\ifconditional\btx_interactive + \ifx\currentbtxnumbering\v!no\else + \ifx\currentbtxinternal\empty \else + \stopgoto + \fi \fi \fi \csname\??constructionstophandler\v!construction\endcsname @@ -424,15 +428,17 @@ % \btxfield : current % \btxspecificfield : dataset,tag,key -\def\btxfield #1{\ctxcommand{btxfield("\currentbtxdataset","\currentbtxtag","#1")}} -\def\btxdetail #1{\ctxcommand{btxdetail("\currentbtxdataset","\currentbtxtag","#1")}} -\def\btxflush #1{\ctxcommand{btxflush("\currentbtxdataset","\currentbtxtag","#1")}} -\def\btxfieldname #1{\ctxcommand{btxfieldname("\currentbtxdataset","\currentbtxtag","#1")}} -\def\btxfieldtype #1{\ctxcommand{btxfieldtype("\currentbtxdataset","\currentbtxtag","#1")}} -\def\btxauthorfield#1{\ctxcommand{btxauthorfield(\number\currentbtxauthorindex,"#1")}} -\def\btxdoifelse #1{\ctxcommand{btxdoifelse("\currentbtxdataset","\currentbtxtag","#1")}} -\def\btxdoif #1{\ctxcommand{btxdoif("\currentbtxdataset","\currentbtxtag","#1")}} -\def\btxdoifnot #1{\ctxcommand{btxdoifnot("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxfield #1{\ctxcommand{btxfield("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxdetail #1{\ctxcommand{btxdetail("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxflush #1{\ctxcommand{btxflush("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxfieldname #1{\ctxcommand{btxfieldname("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxfieldtype #1{\ctxcommand{btxfieldtype("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxfoundname #1{\ctxcommand{btxfoundname("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxfoundtype #1{\ctxcommand{btxfoundtype("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxauthorfield #1{\ctxcommand{btxauthorfield(\number\currentbtxauthorindex,"#1")}} +\def\btxdoifelse #1{\ctxcommand{btxdoifelse("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxdoif #1{\ctxcommand{btxdoif("\currentbtxdataset","\currentbtxtag","#1")}} +\def\btxdoifnot #1{\ctxcommand{btxdoifnot("\currentbtxdataset","\currentbtxtag","#1")}} \let\btxsetup\fastsetup @@ -981,22 +987,49 @@ % Interaction: only list \newconditional\btxinteractive +\newconditional\btx_interactive +\unexpanded\def\btxdoifelseinteractive{\thirdofthreearguments} \unexpanded\def\btxdoifelseinteraction{\secondoftwoarguments} +\unexpanded\def\publ_doifelse_interactive_list_yes#1% + {\edef\p_interaction{\namedbtxlistvariantparameter{#1}\c!interaction}% + \ifx\p_interaction\v!start + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\unexpanded\def\publ_doifelse_interactive_cite_yes#1% + {\edef\p_interaction{\namedbtxcitevariantparameter{#1}\c!interaction}% + \ifx\p_interaction\v!start + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + \appendtoks \iflocation - \edef\p_interaction{\btxlistvariantparameter\c!interaction}% + \edef\p_interaction{\btxrenderingparameter\c!interaction}% \ifx\p_interaction\v!stop - \let\btxdoifelseinteraction\secondoftwoarguments + \let\btxdoifelseinteraction\secondoftwounexpanded + \let\btxdoifelseinteractive\thirdofthreeunexpanded \setfalse\btxinteractive \else - \let\btxdoifelseinteraction\firstoftwoarguments + \let\btxdoifelseinteraction\firstoftwounexpanded + \let\btxdoifelseinteractive\publ_doifelse_interactive_list_yes \settrue\btxinteractive + \ifx\p_interaction\v!all + \settrue\btx_interactive + \else + \setfalse\btx_interactive + \fi \fi \else - \let\btxdoifelseinteraction\secondoftwoarguments + \let\btxdoifelseinteraction\secondoftwounexpanded + \let\btxdoifelseinteractive\thirdofthreeunexpanded \setfalse\btxinteractive + \setfalse\btx_interactive \fi \to \everysetupbtxlistplacement @@ -1004,14 +1037,17 @@ \iflocation \edef\p_interaction{\btxcitevariantparameter\c!interaction}% \ifx\p_interaction\v!stop - \let\btxdoifelseinteraction\secondoftwoarguments + \let\btxdoifelseinteraction\secondoftwounexpanded + \let\btxdoifelseinteractive\thirdofthreeunexpanded \setfalse\btxinteractive \else - \let\btxdoifelseinteraction\firstoftwoarguments + \let\btxdoifelseinteraction\firstoftwounexpanded + \let\btxdoifelseinteractive\publ_doifelse_interactive_cite_yes \settrue\btxinteractive \fi \else - \let\btxdoifelseinteraction\secondoftwoarguments + \let\btxdoifelseinteraction\secondoftwounexpanded + \let\btxdoifelseinteractive\thirdofthreeunexpanded \setfalse\btxinteractive \fi \to \everysetupbtxciteplacement @@ -1367,7 +1403,8 @@ [\v!standard] \setupbtxrendering - [\c!specification=\btxparameter\c!specification, + [\c!interaction=\v!start, % \v!all + \c!specification=\btxparameter\c!specification, \c!dataset=\v!standard, \c!repeat=\v!no, \c!continue=\v!no, @@ -1407,7 +1444,8 @@ \c!etaldisplay=\btxlistvariantparameter\c!etallimit, %\c!journalconversion=\v!normal, \c!monthconversion=\v!number, - \c!authorconversion=\v!inverted] + \c!authorconversion=\v!inverted, + \c!interaction=\c!start] \definebtxlistvariant [author] @@ -1416,6 +1454,12 @@ [editor] [author] +\definebtxlistvariant + [url] + +\definebtxlistvariant + [doi] + \setupbtxcitevariant [\c!specification=\btxparameter\c!specification, \c!alternative=num, @@ -1436,7 +1480,6 @@ \c!etaldisplay=\btxlistvariantparameter\c!etaldisplay, \c!monthconversion=\btxlistvariantparameter\c!monthconversion, \c!authorconversion=\v!name, - \c!interaction=\v!start, % \c!setups=btx:cite:initialize, \c!pubsep={,\space}, \c!lastpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space}, @@ -1447,7 +1490,8 @@ \c!range=\endash, \c!left=, \c!middle=, - \c!right=] + \c!right=, + \c!interaction=\v!start] \definebtxcitevariant [author] diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua index ae5161569..a6141c769 100644 --- a/tex/context/base/publ-tra.lua +++ b/tex/context/base/publ-tra.lua @@ -28,13 +28,13 @@ local specials = publications.tables.specials local report = logs.reporter("publications","tracers") function tracers.showdatasetfields(settings) - local dataset = settings.dataset - local current = datasets[dataset] - local luadata = current.luadata + local dataset = settings.dataset + local current = datasets[dataset] + local luadata = current.luadata + local specification = settings.specification + local fielddata = specification and specifications[specification] or specifications.apa + local categories = fielddata.categories if next(luadata) then - local kind = settings.kind - local fielddata = kind and specifications[kind] or specifications.apa - local categories = fielddata.categories ctx_starttabulate { "|lT|lT|pT|" } ctx_NC() ctx_bold("tag") ctx_NC() ctx_bold("category") @@ -71,14 +71,15 @@ function tracers.showdatasetfields(settings) end function tracers.showdatasetcompleteness(settings) - local dataset = settings.dataset - local current = datasets[dataset] - local luadata = current.luadata - local kind = settings.kind - local fielddata = kind and specifications[kind] or specifications.apa - local categories = fielddata.categories - local lpegmatch = lpeg.match - local texescape = lpeg.patterns.texescape + local dataset = settings.dataset + local current = datasets[dataset] + local luadata = current.luadata + local specification = settings.specification + local fielddata = specification and specifications[specification] or specifications.apa + local categories = fielddata.categories + + local lpegmatch = lpeg.match + local texescape = lpeg.patterns.texescape local preamble = { "|lTBw(5em)|lBTp(10em)|p|" } @@ -232,11 +233,11 @@ function tracers.showdatasetcompleteness(settings) end function tracers.showfields(settings) - local rotation = settings.rotation - local kind = settings.kind - local fielddata = kind and specifications[kind] or specifications.apa - local categories = fielddata.categories - local validfields = { } + local rotation = settings.rotation + local specification = settings.specification + local fielddata = specification and specifications[specification] or specifications.apa + local categories = fielddata.categories + local validfields = { } for category, data in next, categories do local sets = data.sets local fields = data.fields diff --git a/tex/context/base/publ-tra.mkiv b/tex/context/base/publ-tra.mkiv index a1281ca23..566992a01 100644 --- a/tex/context/base/publ-tra.mkiv +++ b/tex/context/base/publ-tra.mkiv @@ -35,10 +35,12 @@ \else \getdummyparameters[#2]% \fi + % \publ_specification_push{"\dummyparameter\c!specification}% \ctxcommand{#1{ - dataset = "\dummyparameter\c!dataset", - kind = "\dummyparameter\c!specification" + dataset = "\dummyparameter\c!dataset", + specification = "\dummyparameter\c!specification" }}% + % \publ_specification_pop \endgroup} \def\publ_show_dataset_fields {\publ_show_dataset_whatever{showbtxdatasetfields}} @@ -51,10 +53,12 @@ {\setdummyparameter\c!specification{\btxparameter\c!specification}% \getdummyparameters[#1]}% {\setdummyparameter\c!specification{#1}}% + % \publ_specification_push{"\dummyparameter\c!specification}% \ctxcommand{showbtxfields{ - rotation = "\dummyparameter\c!rotation", - kind = "\dummyparameter\c!specification" + rotation = "\dummyparameter\c!rotation", + specification = "\dummyparameter\c!specification" }}% + % \publ_specification_pop \endgroup} \protect diff --git a/tex/context/base/s-languages-words.lua b/tex/context/base/s-languages-words.lua new file mode 100644 index 000000000..ea7aee87b --- /dev/null +++ b/tex/context/base/s-languages-words.lua @@ -0,0 +1,32 @@ +if not modules then modules = { } end modules ['s-languages-words'] = { + version = 1.001, + comment = "companion to s-languages-words.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.languages = moduledata.languages or { } +moduledata.languages.words = moduledata.languages.words or { } + +function moduledata.languages.words.showwords(specification) + local filename = specification.filename or file.addsuffix(tex.jobname,"words") + if lfs.isfile(filename) then + local w = dofile(filename) + if w then + -- table.print(w) + for cname, category in table.sortedpairs(w.categories) do + for lname, language in table.sortedpairs(category.languages) do + context.bold(string.format("category: %s, language: %s, total: %s, unique: %s:", + cname, lname, language.total or 0, language.unique or 0) + ) + for word, n in table.sortedpairs(language.list) do + context(" %s (%s)",word,n) + end + context.par() + end + end + end + end +end + diff --git a/tex/context/base/s-languages-words.mkiv b/tex/context/base/s-languages-words.mkiv new file mode 100644 index 000000000..4e350bf34 --- /dev/null +++ b/tex/context/base/s-languages-words.mkiv @@ -0,0 +1,22 @@ +%D \module +%D [ file=s-languages-words, +%D version=2010.10.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Language Environment 3, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is used in the test suite. + +\startmodule[languages-words] + +\registerctxluafile{s-languages-words}{} + +\installmodulecommandluasingle \showwords {moduledata.languages.words.showwords} + +\stopmodule diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index b8a617ad5..f9d6b5da2 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -312,7 +312,7 @@ local function update() -- prepare parent chains, needed when new languages are end end -local function setlanguage(l,m,d,u) +local function setlanguage(l,m,d,u) -- this will become a specification table language = (l ~= "" and l) or constants.defaultlanguage data = definitions[language or constants.defaultlanguage] or definitions[constants.defaultlanguage] method = (m ~= "" and m) or (data.method ~= "" and data.method) or constants.defaultmethod @@ -495,39 +495,15 @@ function sorters.basicsorter(a,b) return basic(a,b) == -1 end --- local function numify(s) --- s = digitsoffset + tonumber(s) -- alternatively we can create range or maybe just hex numbers --- if s > digitsmaximum then --- s = digitsmaximum --- end --- return utfchar(s) --- end --- --- function sorters.strip(str) -- todo: only letters and such --- if str and str ~= "" then --- -- todo: make a decent lpeg --- str = gsub(str,"\\[\"\'~^`]*","") -- \"e -- hm, too greedy --- str = gsub(str,"\\%S*","") -- the rest --- str = gsub(str,"%s","\001") -- can be option --- str = gsub(str,"[%s%[%](){}%$\"\']*","") -- %s already done --- if digits == v_numbers then --- str = gsub(str,"(%d+)",numify) -- sort numbers properly --- end --- return str --- else --- return "" --- end --- end - local function numify(old) - if digits == v_numbers then - return old - else + if digits == v_numbers then -- was swapped, fixed 2014-11-10 local new = digitsoffset + tonumber(old) -- alternatively we can create range if new > digitsmaximum then new = digitsmaximum end return utfchar(new) + else + return old end end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex f3032a786..3da4d77e2 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 dd9b8eddd..a6ccfe118 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/symb-imp-cc.mkiv b/tex/context/base/symb-imp-cc.mkiv index 45ea97732..71e837c3f 100644 --- a/tex/context/base/symb-imp-cc.mkiv +++ b/tex/context/base/symb-imp-cc.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D LS/HH: This font has changed over time so there might be diffences +%D in rendering. The otf, ttf and type1 version can differ too. \doiffontpresentelse{ccicons.otf} { % redone ctan version \definefontfeature diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 8af86a35e..1402ef4d7 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -2948,7 +2948,14 @@ \def\fifthofsixarguments #1#2#3#4#5#6{#5} \def\sixthofsixarguments #1#2#3#4#5#6{#6} -\unexpanded\def\firstofoneunexpanded#1{#1} +\unexpanded\def\firstofoneunexpanded #1{#1} + +\unexpanded\def\firstoftwounexpanded #1#2{#1} +\unexpanded\def\secondoftwounexpanded #1#2{#2} + +\unexpanded\def\firstofthreeunexpanded #1#2#3{#1} +\unexpanded\def\secondofthreeunexpanded#1#2#3{#2} +\unexpanded\def\thirdofthreeunexpanded #1#2#3{#3} %D \macros %D {globalletempty,letempty, diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 952f20258..180394ce6 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/10/14 10:51:08 +-- merge date : 11/10/14 23:13:18 do -- begin closure to overcome local limits and interference |