From 156e528557cf571eb99ab05a0892429b3c2bf269 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Mon, 17 Nov 2014 15:15:04 +0100 Subject: 2014-11-17 14:34:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4386 -> 4390 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/grph-inc.lua | 26 ++- tex/context/base/publ-aut.lua | 132 ++++++++------- tex/context/base/publ-dat.lua | 22 ++- tex/context/base/publ-imp-apa.lua | 158 ++++++++++++------ tex/context/base/publ-imp-apa.mkvi | 182 ++++++++++++--------- tex/context/base/publ-imp-author.mkvi | 2 +- tex/context/base/publ-ini.lua | 15 +- tex/context/base/publ-ini.mkiv | 14 +- tex/context/base/publ-reg.lua | 1 + tex/context/base/status-files.pdf | Bin 24693 -> 24712 bytes tex/context/base/status-lua.pdf | Bin 342594 -> 344033 bytes tex/context/base/syst-aux.mkiv | 53 ++++++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 16 files changed, 373 insertions(+), 238 deletions(-) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index b12bf169a..7b474d3f2 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.17 00:32} +\newcontextversion{2014.11.17 14:32} %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 df6137533..32eb18732 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 61ab2188e..5125f8011 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.17 00:32} +\edef\contextversion{2014.11.17 14:32} \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 f191ed7d9..ea922b28c 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -643,29 +643,24 @@ local function register(askedname,specification) local newbase = oldbase -- local fc = specification.cache or figures.cachepaths.path --- --- -- todo: --- --- if fc == "auto" then --- newpath = newpath .. "/cache" --- dir.mkdir(newpath) --- else if fc and fc ~= "" and fc ~= "." then - newpath = fc + newpath = gsub(fc,"%*",newpath) -- so cachedir can be "/data/cache/*" else newbase = defaultprefix .. newbase end --- end - if not file.is_writable(newpath) then - if trace_conversion then - report_inclusion("path %a is not writable, forcing conversion path %a",newpath,".") - end - newpath = "." - end local subpath = specification.subpath or figures.cachepaths.subpath if subpath and subpath ~= "" and subpath ~= "." then newpath = newpath .. "/" .. subpath end + if not lfs.isdir(newpath) then + dir.makedirs(newpath) + if not file.is_writable(newpath) then + if trace_conversion then + report_inclusion("path %a is not writable, forcing conversion path %a",newpath,".") + end + newpath = "." + end + end local prefix = specification.prefix or figures.cachepaths.prefix if prefix and prefix ~= "" then newbase = prefix .. newbase @@ -687,7 +682,6 @@ local function register(askedname,specification) local newbase = newbase .. "." .. newformat -- local newname = file.join(newpath,newbase) - dir.makedirs(newpath) oldname = collapsepath(oldname) newname = collapsepath(newname) local oldtime = lfs.attributes(oldname,'modification') or 0 diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index 95378df4a..266740ea2 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -303,77 +303,85 @@ function commands.btxauthorfield(i,field) end end -function commands.btxauthor(dataset,tag,field,settings) - local split = getcasted(dataset,tag,field) - local max = split and #split or 0 - if max == 0 then - return - -- error - end - local etallimit = tonumber(settings.etallimit) or 1000 - local etaldisplay = tonumber(settings.etaldisplay) or etallimit - local combiner = settings.combiner - local symbol = settings.symbol - local index = settings.index - if not combiner or combiner == "" then - combiner = "normal" - end - if not symbol then - symbol = "." - end - local ctx_btxsetup = settings.kind == "cite" and ctx_btxciteauthorsetup or ctx_btxlistauthorsetup - if max > etallimit and etaldisplay < max then - max = etaldisplay - end - currentauthordata = split - currentauthorsymbol = symbol +-- This is somewhat tricky: an author is not always an author but +-- can also be a title or key, depending on the (optional) set it's +-- in. Also, authors can be combined with years and so and they +-- might be called upon mixed with other calls. - local function oneauthor(i) - local author = split[i] - if index then - ctx_btxstartauthor(i,1,0) - else - local state = author.state or 0 - ctx_btxstartauthor(i,max,state) - ctx_btxsetconcat(concatstate(i,max)) - ctx_btxsetauthorvariant(combiner) - end - local initials = author.initials - if initials and #initials > 0 then - ctx_btxsetinitials() -- (concat(the_initials(initials,symbol)," ")) +function commands.btxauthor(dataset,tag,field,settings) + local split, usedfield, kind = getcasted(dataset,tag,field) + if kind == "author" then + local max = split and #split or 0 + if max == 0 then + return + -- error end - local firstnames = author.firstnames - if firstnames and #firstnames > 0 then - ctx_btxsetfirstnames() -- (concat(firstnames," ")) + local etallimit = tonumber(settings.etallimit) or 1000 + local etaldisplay = tonumber(settings.etaldisplay) or etallimit + local combiner = settings.combiner + local symbol = settings.symbol + local index = settings.index + if not combiner or combiner == "" then + combiner = "normal" end - local vons = author.vons - if vons and #vons > 0 then - ctx_btxsetvons() -- (concat(vons," ")) + if not symbol then + symbol = "." end - local surnames = author.surnames - if surnames and #surnames > 0 then - ctx_btxsetsurnames() -- (concat(surnames," ")) + local ctx_btxsetup = settings.kind == "cite" and ctx_btxciteauthorsetup or ctx_btxlistauthorsetup + if max > etallimit and etaldisplay < max then + max = etaldisplay end - local juniors = author.juniors - if juniors and #juniors > 0 then - ctx_btxsetjuniors() -- (concat(juniors," ")) + currentauthordata = split + currentauthorsymbol = symbol + + local function oneauthor(i) + local author = split[i] + if index then + ctx_btxstartauthor(i,1,0) + else + local state = author.state or 0 + ctx_btxstartauthor(i,max,state) + ctx_btxsetconcat(concatstate(i,max)) + ctx_btxsetauthorvariant(combiner) + end + local initials = author.initials + if initials and #initials > 0 then + ctx_btxsetinitials() -- (concat(the_initials(initials,symbol)," ")) + end + local firstnames = author.firstnames + if firstnames and #firstnames > 0 then + ctx_btxsetfirstnames() -- (concat(firstnames," ")) + end + local vons = author.vons + if vons and #vons > 0 then + ctx_btxsetvons() -- (concat(vons," ")) + end + local surnames = author.surnames + if surnames and #surnames > 0 then + ctx_btxsetsurnames() -- (concat(surnames," ")) + end + local juniors = author.juniors + if juniors and #juniors > 0 then + ctx_btxsetjuniors() -- (concat(juniors," ")) + end + if not index and i == max then + local overflow = #split - max + if overflow > 0 then + ctx_btxsetoverflow(overflow) + end + end + ctx_btxsetup(combiner) + ctx_btxstopauthor() end - if not index and i == max then - local overflow = #split - max - if overflow > 0 then - ctx_btxsetoverflow(overflow) + if index then + oneauthor(index) + else + for i=1,max do + oneauthor(i) end end - ctx_btxsetup(combiner) - ctx_btxstopauthor() - end - - if index then - oneauthor(index) else - for i=1,max do - oneauthor(i) - end + report("ignored field %a of tag %a, used field %a is no author",field,tag,usedfield) end end diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua index 2ab948c9d..842832b24 100644 --- a/tex/context/base/publ-dat.lua +++ b/tex/context/base/publ-dat.lua @@ -141,6 +141,8 @@ local defaulttypes = allocate { page = "pagenumber", pages = "pagenumber", keywords = "keyword", + doi = "url", + url = "url", } tables.implicits = implicits @@ -954,9 +956,7 @@ do if not usedonly or usedonly[tag] then r = r + 1 ; result[r] = f_start(data.category or "article",tag) for key, value in sortedhash(data) do - if privates[key] then - -- skip - else + if not privates[key] then r = r + 1 ; result[r] = f_field(key,value) end end @@ -974,9 +974,17 @@ do local usedonly = usedonly and publications.usedentries() if usedonly then local list = { } - for k, v in next, luadata do - if usedonly[k] then - list[k] = v + if usedonly then + for key, value in next, luadata do + if not privates[key] and usedonly[key] then + list[key] = value + end + end + else + for key, value in next, luadata do + if not privates[key] then + list[key] = value + end end end luadata = list @@ -986,7 +994,7 @@ do end function savers.xml(dataset,filename,usedonly) - local result, n = publications.converttoxml(dataset,true,true,usedonly) + local result, n = publications.converttoxml(dataset,true,true,usedonly) -- maybe also private? but then we need to have tag as attr report("%s entries from dataset %a saved in %a",n,dataset,filename) io.savedata(filename,result) end diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua index 9b68fdc9b..fae461d81 100644 --- a/tex/context/base/publ-imp-apa.lua +++ b/tex/context/base/publ-imp-apa.lua @@ -36,6 +36,11 @@ local specification = { interpreter = "author", composer = "author", producer = "author", + doi = "url", + url = "url", + page = "pagenumber", + pages = "pagenumber", + keywords = "keyword", }, -- -- categories with their specific fields @@ -47,16 +52,18 @@ local specification = { ["demo-a"] = { sets = { author = { "author", "institution", "organization" }, + doi = { "doi", "url" }, }, - required = { "author", "title", "year", "note", "url" }, - optional = { "subtitle", "doi", "file" }, + required = { "author", "title", "year", "note", "doi" }, + optional = { "subtitle", "file" }, }, ["demo-b"] = { sets = { authors = { "author", "institution", "organization" }, + doi = { "doi", "url" }, }, - required = { "authors", "title", "year", "note", "url" }, - optional = { "subtitle", "doi", "file" }, + required = { "authors", "title", "year", "note", "doi" }, + optional = { "subtitle", "file" }, }, -- -- more categories are added below @@ -64,11 +71,25 @@ local specification = { }, } +local generic = { + -- + -- A set returns the first field (in order of position below) that is found + -- present in an entry. A set having the same name as a field conditionally + -- allows the substitution of an alternate field. + -- + -- note that anything can get assigned a doi or be available online. + doi = { "doi", "url" }, +} + -- Definition of recognized categories and the fields that they contain. -- Required fields should be present; optional fields may also be rendered; -- all other fields will be ignored. -- Sets contain either/or in order of precedence. +-- +-- For a category *not* defined here yet present in the dataset, *all* fields +-- are taken as optional. This allows for flexibility in the addition of new +-- categories. local categories = specification.categories @@ -77,7 +98,7 @@ local categories = specification.categories categories.article = { sets = { author = { "author", "editor", "title" }, - links = { "doi", "url" }, + doi = generic.doi, isbn = { "issn" }, }, required = { @@ -87,7 +108,7 @@ categories.article = { "year", "subtitle", "type", "file", "journal", "volume", "number", "pages", - "note", "links", "isbn", + "doi", "note", "isbn" }, } @@ -104,7 +125,7 @@ categories.magazine = { "subtitle", "type", "file", "volume", "number", "pages", "month", "day", - "note", "links", "isbn", + "doi", "note", "isbn" }, } @@ -115,7 +136,7 @@ categories.newspaper = categories.magazine categories.periodical = { sets = { author = { "editor", "publisher" }, - links = { "doi", "url" }, + doi = generic.doi, isbn = { "issn" }, }, required = { @@ -127,7 +148,7 @@ categories.periodical = { "subtitle", "file", "series", "volume", "number", "month", "organization", - "note", "links", "isbn", + "doi", "note", "isbn" }, } @@ -136,16 +157,15 @@ categories.periodical = { categories.standard = { sets = { author = { "author", "institution", "organization" }, + doi = generic.doi, }, required = { "author", "year", "title", "subtitle", - "note", - "url", + "doi", "note", }, optional = { - "doi" }, } @@ -153,16 +173,17 @@ categories.standard = { categories.book = { sets = { - author = { "author", "editor", "publisher", "title" }, + author = { "author", "editor", "publisher", "title" }, + edition = { "edition", "volume", "number", "pages" }, + doi = generic.doi, }, required = { "author" }, optional = { "year", "month", "day", "subtitle", "type", "file", - "edition", "series", "volume", "number", "pages", + "edition", "series", "address", - "url", - "note", "isbn" + "doi", "note", "isbn" }, } @@ -170,7 +191,9 @@ categories.book = { categories.inbook = { sets = { - author = { "author", "editor", "publisher", "title", "chapter", "pages" }, + author = { "author", "editor", "publisher", "title", "chapter" }, + edition = { "edition", "volume", "number", "pages" }, + doi = generic.doi, }, required = { "author", @@ -178,10 +201,10 @@ categories.inbook = { }, optional = { "subtitle", "type", "file", - "volume", "number", "series", - "edition", "month", + "edition", "series", + "month", "address", - "note", "isbn" + "doi", "note", "isbn" }, } @@ -190,16 +213,17 @@ categories.inbook = { categories.booklet = { sets = { author = { "author", "title" }, + doi = generic.doi, }, required = { "author" }, optional = { "year", "month", - "subtitle", "type", "file", - "address", - "howpublished", - "note", "isbn" + "subtitle", "type", "file", + "address", + "howpublished", + "doi", "note", "isbn" }, } @@ -207,7 +231,9 @@ categories.booklet = { categories.incollection = { sets = { - author = { "author", "editor", "publisher", "title" }, + author = { "author", "editor", "publisher", "title" }, + edition = { "edition", "volume", "number", "pages" }, + doi = generic.doi, }, required = { "author", @@ -216,11 +242,11 @@ categories.incollection = { }, optional = { "subtitle", "type", "file", - "month", "edition", - "volume", "number", "series", - "chapter", "pages", + "month", + "edition", "series", + "chapter", "address", - "note", "isbn" + "doi", "note", "isbn" }, } @@ -228,7 +254,9 @@ categories.incollection = { categories.proceedings = { sets = { - author = { "editor", "publisher", "title" }, + author = { "editor", "publisher", "title" }, + edition = { "edition", "volume", "number", "pages" }, + doi = generic.doi, }, required = { "author", @@ -236,10 +264,10 @@ categories.proceedings = { }, optional = { "subtitle", "file", - "volume", "number", "series", "pages", + "edition", "series", "month", "address", "organization", - "note", "isbn" + "doi", "note", "isbn" }, } @@ -251,10 +279,9 @@ categories.inproceedings = { optional = { "subtitle", "type", "file", "month", - "volume", "number", "series", - "pages", + "edition", "series", "address", "organization", - "note", "isbn" + "doi", "note", "isbn" }, } @@ -263,6 +290,9 @@ categories.conference = categories.inproceedings -- a thesis (of course). categories.thesis = { + sets = { + doi = generic.doi, + }, required = { "author", "title", @@ -274,11 +304,12 @@ categories.thesis = { "subtitle", "file", "month", "address", - "note" + "doi", "note", "isbn" }, } categories.mastersthesis = { + sets = categories.thesis.sets, required = { "author", "title", @@ -290,7 +321,7 @@ categories.mastersthesis = { "subtitle", "file", "month", "address", - "note" + "doi", "note", "isbn" }, } categories.phdthesis = categories.mastersthesis @@ -298,6 +329,11 @@ categories.phdthesis = categories.mastersthesis -- a report published by a school or other institution, usually numbered within a series. categories.techreport = { + sets = { + -- no "edition"! + edition = { "type", "volume", "number", "pages" }, + doi = generic.doi, + }, required = { "author", "title", @@ -305,16 +341,21 @@ categories.techreport = { "year" }, optional = { - "subtitle", "type", "file", - "number", "month", + "subtitle", "file", + "edition", -- set, not field! + "month", "address", - "note", --"isbn", + "doi", "note", "isbn" }, } -- technical documentation. categories.manual = { + sets = { + edition = { "edition", "volume", "number", "pages" }, + doi = generic.doi, + }, required = { "title" }, @@ -322,13 +363,16 @@ categories.manual = { "subtitle", "file", "author", "address", "organization", "edition", "month", "year", - "note", "isbn", + "doi", "note", "isbn" }, } -- a patent (of course). categories.patent = { + sets = { + doi = generic.doi, + }, required = { "nationality", "number", @@ -341,13 +385,16 @@ categories.patent = { "title", "subtitle", "file", "address", "day", "dayfiled", "month", "monthfiled", - "note" + "doi", "note" }, } -- a document having an author and title, but not formally published. categories.unpublished = { + sets = { + doi = generic.doi, + }, required = { "author", "title", @@ -355,13 +402,17 @@ categories.unpublished = { }, optional = { "subtitle", "file", - "year", "month" + "year", "month", + "doi" }, } -- like misc below but includes organization. categories.electronic = { + sets = { + doi = generic.doi, + }, required = { "title" }, @@ -372,8 +423,7 @@ categories.electronic = { "address", "organization", "howpublished", - "url", "doi", - "note" + "doi", "note" }, } @@ -381,7 +431,8 @@ categories.electronic = { categories.misc = { sets = { - isbn = { "isbn", "issn" }, + doi = generic.doi, + isbn = { "isbn", "issn" }, }, required = { -- nothing is really important here @@ -391,7 +442,7 @@ categories.misc = { "title", "subtitle", "file", "year", "month", "howpublished", - "note", "isbn", + "doi", "note", "isbn" }, } @@ -399,7 +450,8 @@ categories.misc = { categories.other = { sets = { - isbn = { "isbn", "issn" }, + doi = generic.doi, + isbn = { "isbn", "issn" }, }, required = { "author", @@ -408,8 +460,7 @@ categories.other = { }, optional = { "subtitle", "file", - "note", - "doi", "isbn", + "doi", "note", "isbn" }, } @@ -418,14 +469,15 @@ categories.other = { categories.literal = { sets = { author = { "key" }, + doi = generic.doi, }, required = { "author", "text" }, - -- optional = { - -- -- whatever comes up - -- }, + optional = { + "doi", "note" + }, virtual = false, } diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index e6055bd35..b8402e15a 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -47,7 +47,7 @@ \c!etaldisplay=\btxlistvariantparameter\c!etallimit, %\c!journalconversion=\v!normal, \c!monthconversion=\v!month, - \c!authorconversion=\v!invertedshort] + \c!authorconversion=invertedshort] \definebtxlistvariant [author] @@ -171,7 +171,7 @@ apa:Reference={Ref.}, apa:References={Refs.}, apa:Advanced={Advanced online publication}, - apa:Retrieved={Retrieved from}, + apa:Retrieved={Available from}, % {Retrieved from}, apa:others={et al.}] \setupbtxlabeltext @@ -204,7 +204,7 @@ apa:Reference={Réf.}, apa:References={Réfs.}, apa:Advanced={Publication en ligne anticipée}, - apa:Retrieved={Téléchargé de}, + apa:Retrieved={Disponible à}, % {Téléchargé de}, apa:others={et al.}] \setupbtxlabeltext @@ -303,27 +303,25 @@ \stoptexdefinition \starttexdefinition btx:apa:title-subtitle-type - \btxdoif {title} { - \setmode{btx:apa:title-placed} - \btxdoif {file} { - % we make the title active, opening file - \texdefinition{btx:apa:inject} {url(file:\btxflush{file})} + \setmode{btx:apa:title-placed} + \btxdoif {file} { + % we make the title active, opening file + \texdefinition{btx:apa:inject} {url(file:\btxflush{file})} + } + { + \btxflush{Word -> title} + \btxdoif {subtitle} { + \btxcolon + \btxflush{Word -> subtitle} } - { - \btxflush{Word -> title} - \btxdoif {subtitle} { - \btxcolon - \btxflush{Word -> subtitle} + \doifnotmode {btx:apa:thesis} { + \btxdoif{type} { + \btxleftbracket + \btxflush{Word -> type} + \btxrightbracket } - \doifnotmode {btx:apa:thesis} { - \btxdoif{type} { - \btxleftbracket - \btxflush{Word -> type} - \btxrightbracket - } - } - \btxperiod } + \btxperiod } \stoptexdefinition @@ -345,31 +343,50 @@ \stoptexdefinition \starttexdefinition btx:apa:editor-or-editors - \btxdoif {editor} { - \btxflush {editor} - \btxleftparenthesis - \btxsingularorplural {editor} { - \btxlabeltext{apa:Editor} - } { - \btxlabeltext{apa:Editors} - } - \btxrightparenthesisperiod + % \btxflushauthor[invertedshort] {editor} + % driven by authorconversion=invertedshort + %\btxflushauthor{editor} + \btxflush{editor} + \btxleftparenthesis + \btxsingularorplural {editor} { + \btxlabeltext{apa:Editor} + } { + \btxlabeltext{apa:Editors} } + \btxrightparenthesisperiod \stoptexdefinition -\unprotect +% \starttexdefinition btx:apa:flush:author +% \btxflush{author} +% \stoptexdefinition +% \starttexdefinition btx:apa:flush:editor +% \texdefinition{btx:apa:editor-or-editors}% just put the code here +% \stoptexdefinition +% \starttexdefinition btx:apa:flush:title +% \texdefinition{btx:apa:title-subtitle-type}% just put the code here +% \stoptexdefinition +% +% \texdefinition{btx:apa:flush:\btxfoundname{author}} +% +% can be used in: \starttexdefinition btx:apa:authoryear % we make the authoryear active, pointing to the citation - \texdefinition{btx:apa:inject} {\s!internal(\currentbtxinternal)} + \texdefinition{btx:apa:inject} {internal(\currentbtxinternal)} { - \doifelse {\btxfoundname{author}} {editor} { - \texdefinition{btx:apa:editor-or-editors} + \doifelse {\btxfoundname{author}} {author} { + % \btxflushauthor[invertedshort] {author} + % driven by authorconversion=invertedshort + \btxflush{author} } { \doifelse {\btxfoundname{author}} {title} { \texdefinition{btx:apa:title-subtitle-type} } { - \btxflush {author} + \doifelse {\btxfoundname{author}} {editor} { + \texdefinition{btx:apa:editor-or-editors} + } { + \btxflush{author} + } } } \btxleftparenthesis @@ -391,12 +408,11 @@ \btxflush{suffix} } } - \btxrightparenthesisperiod + \btxrightparenthesis } + \btxperiod % outside of interaction \stoptexdefinition -\protect - \starttexdefinition btx:apa:italic #field \begingroup \it @@ -405,20 +421,21 @@ \endgroup \stoptexdefinition -\starttexdefinition btx:apa:editor #title +\starttexdefinition btx:apa:editor-in- #title \btxdoifelse {editor} { \btxlabeltext{apa:In} \btxspace + \texdefinition{btx:apa:editor-or-editors} + \btxdoif {#title} { + \texdefinition{btx:apa:italic}{Word -> #title} + } } { \btxdoif {#title} { \btxlabeltext{apa:In} \btxspace + \texdefinition{btx:apa:italic}{Word -> #title} } } - \texdefinition{btx:apa:editor-or-editors} - \btxdoif {#title} { - \texdefinition{btx:apa:italic}{Word -> #title} - } \stoptexdefinition \starttexdefinition btx:apa:doif-edition-or-volume-or-number-or-pages #edition #if @@ -448,14 +465,14 @@ \btxlabeltext{apa:edition} } } { - \doif {#edition} {type} { + \doif {\currentbtxcategory} {techreport} { \btxspace \btxlabeltext{apa:technicalreport} } } \btxdoif {volume} { \btxdoif {#edition} { - \doif {#edition} {edition} + \doifelse {#edition} {edition} {\btxcomma} {\btxspace} } \btxoneorrange {volume} { @@ -471,7 +488,7 @@ \btxcomma } { \btxdoifelse {#edition} { - \doif {#edition} {edition} + \doifelse {#edition} {edition} {\btxcomma} {\btxspace} } { \btxspace @@ -486,7 +503,7 @@ \btxcomma } { \btxdoifelse {#edition} { - \doif {#edition} {edition} + \doifelse {#edition} {edition} {\btxcomma} {\btxspace} } { \btxdoif {number} { @@ -505,7 +522,7 @@ \texdefinition{btx:apa:doif-edition-or-volume-or-number-or-pages}{#edition}{\btxrightparenthesisperiod} \stoptexdefinition -\starttexdefinition btx:apa:journal-volume-number-pages #pp +\starttexdefinition btx:apa:journal-volume-number-pages \btxdoif {journal} { \btxspace % expandedjournal abbreviatedjournal @@ -538,8 +555,7 @@ \btxcomma } } - % APA rule for newspaper - \doif {#pp} {pp} { + \doif {\currentbtxcategory} {newspaper} { \btxoneorrange {pages} { \btxlabeltext{apa:p} } { @@ -550,8 +566,7 @@ \btxflush{pages} \btxperiod } - \doifnot {#pp} {pp} { - % not a newspaper + \doifnot {\currentbtxcategory} {newspaper} { \btxdoifnot {volume} { \btxdoifnot {number} { \btxdoifnot {pages} { @@ -573,36 +588,46 @@ } \stoptexdefinition +\definebreakpoints[doi] +\definebreakpoint [doi][:][nleft=3,type=1] +\definebreakpoint [doi][/][nleft=3,type=1] +\definebreakpoint [doi][-][nleft=3,type=1] +\definebreakpoint [doi][.][nleft=3,type=1] + \starttexdefinition btx:apa:url - \btxdoif {url} { - \btxspace - \btxlabeltext{apa:Retrieved} - \btxspace + % use \btxentry here? + \btxspace + \btxlabeltext{apa:Retrieved} + \btxspace + \begingroup + \setbreakpoints[doi] \btxdoifelseinteractive {url} { \goto { - \hyphenatedurl{\btxflush{url}} + \btxflush{url} } [ url(\btxflush{url}) ] } { - \hyphenatedurl{\btxflush{url}} + \btxflush{url} } - } + \endgroup \stoptexdefinition \starttexdefinition btx:apa:doi - \btxdoif {doi} { - \btxspace - \btxdoifelseinteractive {doi} { - \goto { - doi:\btxflush{doi} - } [ - url(http://dx.doi.org/\btxflush{doi}) - ] - } { + % use \btxentry here? + \btxspace + \begingroup + \setbreakpoints[doi] + \btxdoifelseinteractive {doi} { + \goto { doi:\btxflush{doi} - } + } [ + url(http://dx.doi.org/\btxflush{doi}) + ] + } { + doi:\btxflush{doi} } + \endgroup \stoptexdefinition \starttexdefinition btx:apa:isbn @@ -626,12 +651,14 @@ \stoptexdefinition \starttexdefinition btx:apa:url-note-doi - \btxdoifnot {doi} { + \doif {\btxfoundname{doi}} {url} { \texdefinition{btx:apa:url} } \texdefinition{btx:apa:isbn} \texdefinition{btx:apa:note} - \texdefinition{btx:apa:doi} + \doif {\btxfoundname{doi}} {doi} { + \texdefinition{btx:apa:doi} + } \removeunwantedspaces \stoptexdefinition @@ -660,7 +687,6 @@ \stoptexdefinition % #author is author, editor, organization, howpublished or assignee - \starttexdefinition btx:apa:wherefrom-publisher-author-is- #author \btxdoifelse {country} { \btxspace @@ -728,7 +754,7 @@ \startsetups btx:apa:article \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} - \texdefinition{btx:apa:journal-volume-number-pages}{} + \texdefinition{btx:apa:journal-volume-number-pages} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -739,7 +765,7 @@ \startsetups btx:apa:magazine \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} - \texdefinition{btx:apa:journal-volume-number-pages}{} + \texdefinition{btx:apa:journal-volume-number-pages} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -750,7 +776,7 @@ \startsetups btx:apa:newspaper \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} - \texdefinition{btx:apa:journal-volume-number-pages}{pp} + \texdefinition{btx:apa:journal-volume-number-pages} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -782,7 +808,7 @@ \btxflush{Word -> chapter} \btxspace } - \texdefinition{btx:apa:editor}{title} + \texdefinition{btx:apa:editor-in-}{title} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{author} \texdefinition{btx:apa:url-note-doi} @@ -798,7 +824,7 @@ \startsetups btx:apa:incollection \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} - \texdefinition{btx:apa:editor}{booktitle} + \texdefinition{btx:apa:editor-in-}{booktitle} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{author} \texdefinition{btx:apa:url-note-doi} @@ -834,7 +860,7 @@ \startsetups btx:apa:inproceedings \texdefinition{btx:apa:authoryear} \texdefinition{btx:apa:title-if-not-placed}{} - \texdefinition{btx:apa:editor}{booktitle} + \texdefinition{btx:apa:editor-in-}{booktitle} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \btxdoif {organization} { \btxspace diff --git a/tex/context/base/publ-imp-author.mkvi b/tex/context/base/publ-imp-author.mkvi index 61672aedb..d852e325e 100644 --- a/tex/context/base/publ-imp-author.mkvi +++ b/tex/context/base/publ-imp-author.mkvi @@ -42,7 +42,7 @@ \btxcitevariantparameter\c!finalnamesep \fi \else - \btxcitevariantparameter\c!namesep + % \btxcitevariantparameter\c!namesep \fi \stopsetups diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 1e00ca736..f58729554 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -104,6 +104,10 @@ manipulatormethods.WORDS = converters.WORDS local context = context local commands = commands +local ctx_doifelse = commands.doifelse +local ctx_doif = commands.doif +local ctx_doifnot = commands.doifnot + local ctx_setvalue = context.setvalue local ctx_firstoftwoarguments = context.firstoftwoarguments local ctx_secondoftwoarguments = context.secondoftwoarguments @@ -728,7 +732,7 @@ function commands.btxsingularorplural(dataset,tag,name) else d = false end - commands.doifelse(d) + ctx_doifelse(d) end function commands.oneorrange(dataset,tag,name) @@ -742,7 +746,7 @@ function commands.oneorrange(dataset,tag,name) d = false end - commands.doifelse(not d) -- so singular is default + ctx_doifelse(not d) -- so singular is default end function commands.firstofrange(dataset,tag,name) @@ -958,6 +962,10 @@ do ctx_btxflushauthor(field) end + -- function typesetters.url(field,value,manipulator) + -- .... + -- end + -- if there is no specification then we're in trouble but there is -- always a default anyway -- @@ -1174,9 +1182,6 @@ do end end - local ctx_doifelse = commands.doifelse - local ctx_doif = commands.doif - local ctx_doifnot = commands.doifnot function commands.btxdoifelse(name,tag,field) ctx_doifelse(okay(name,tag,field)) end function commands.btxdoif (name,tag,field) ctx_doif (okay(name,tag,field)) end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index a3fb68186..da1466c7e 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -550,18 +550,6 @@ \let\currentbtxnumber \empty \unexpanded\def\btxsetnumber {\def\currentbtxnumber} \let\currentbtxauthorvariant\v!normal \unexpanded\def\btxsetauthorvariant{\def\currentbtxauthorvariant} -%let\currentbtxfirstnames \empty \unexpanded\def\btxsetfirstnames {\def\currentbtxfirstnames} -%let\currentbtxinitials \empty \unexpanded\def\btxsetinitials {\def\currentbtxinitials} -%let\currentbtxjuniors \empty \unexpanded\def\btxsetjuniors {\def\currentbtxjuniors} -%let\currentbtxsurnames \empty \unexpanded\def\btxsetsurnames {\def\currentbtxsurnames} -%let\currentbtxvons \empty \unexpanded\def\btxsetvons {\def\currentbtxvons} - -%unexpanded\def\getcurrentbtxfirstnames{\ctxcommand{btxauthorfield("firstnames")} -%unexpanded\def\getcurrentbtxinitials {\ctxcommand{btxauthorfield("initials")} -%unexpanded\def\getcurrentbtxjuniors {\ctxcommand{btxauthorfield("juniors")} -%unexpanded\def\getcurrentbtxsurnames {\ctxcommand{btxauthorfield("surnames")} -%unexpanded\def\getcurrentbtxvons {\ctxcommand{btxauthorfield("vons")} - \unexpanded\def\currentbtxfirstnames_indeed{\ctxcommand{btx_a_f(\number\currentbtxauthorindex)}} \unexpanded\def\currentbtxinitials_indeed {\ctxcommand{btx_a_i(\number\currentbtxauthorindex)}} \unexpanded\def\currentbtxjuniors_indeed {\ctxcommand{btx_a_j(\number\currentbtxauthorindex)}} @@ -985,7 +973,7 @@ {\doifnextoptionalcselse\btx_flush_author_yes\btx_flush_author_nop} \def\btx_flush_author_yes[#1]{\btx_flush_author{#1}} -\def\btx_flush_author_nop {\btx_flush_author{\btxlistvariantparameter\c!author}} +\def\btx_flush_author_nop {\btx_flush_author{\btxlistvariantparameter\c!authorconversion}} \unexpanded\def\btx_flush_author#1#2% {\begingroup diff --git a/tex/context/base/publ-reg.lua b/tex/context/base/publ-reg.lua index ccee57ecd..f2d848ec0 100644 --- a/tex/context/base/publ-reg.lua +++ b/tex/context/base/publ-reg.lua @@ -25,6 +25,7 @@ local publications = publications local datasets = publications.datasets local specifications = publications.specifications local writers = publications.writers +local getcasted = publications.getcasted local registrations = { } local sequence = { } diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 4332c3048..0f51e6963 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 307792e1c..6f4bc79ea 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/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 1402ef4d7..d3e34f0b9 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -7011,6 +7011,59 @@ % \def\converteddimen#1#2{\ctxcommand{converteddimen(\number\dimexpr#1,"#2")}} +%D Maybe (looks ugly): +%D +%D \starttyping +%D \doifcase {foo} +%D {bar} {BAR} +%D {foo} {FOO} +%D {default} {DEFAULT} +%D +%D \doifcase {foo} +%D {bar} {BAR} +%D {foo} {\doifcase {bar} +%D {bar} {BAR} +%D {foo} {FOO} +%D {default} {DEFAULT} +%D } +%D {default} {DEFAULT} +%D \stoptyping + +% \doifcase {\btxfoundname{author}} +% {author} {\btxflush{author}} +% {editor} {\texdefinition{btx:apa:editor-or-editors}} +% {title} {\texdefinition{btx:apa:title-subtitle-type}} +% {default} {\btxflush{author}} + +% \unexpanded\def\doifcase#1% +% {\edef\m_case_asked{#1}% +% \syst_aux_case} +% +% \def\syst_aux_case#1% +% {\edef\m_case_temp{#1}% +% \ifx\m_case_temp\m_case_asked +% \expandafter\syst_aux_case_yes +% \else\ifx\m_case_temp\s!default +% \doubleexpandafter\firstofoneargument +% \else +% \doubleexpandafter\syst_aux_case_nop +% \fi\fi} +% +% \def\syst_aux_skip#1#2% +% {\edef\m_case_temp{#1}% +% \ifx\m_case_temp\s!default +% \expandafter\syst_aux_done +% \else +% \expandafter\syst_aux_skip +% \fi} +% +% \def\syst_aux_case_yes#1% +% {\def\syst_aux_done{#1}% +% \syst_aux_skip} +% +% \def\syst_aux_case_nop#1% +% {\syst_aux_case} + \protect \endinput % \edef\choicetokenyes{+} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 79a0f9030..2c5a87812 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/14 00:32:09 +-- merge date : 11/17/14 14:32:07 do -- begin closure to overcome local limits and interference -- cgit v1.2.3