diff options
author | Hans Hagen <pragma@wxs.nl> | 2014-05-26 14:56:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2014-05-26 14:56:00 +0200 |
commit | 044365a4f17208925ebff5f8749c91571ed947ed (patch) | |
tree | d62eff899bcad16b6b92fab3fcbc0f4d7d40dec6 /tex | |
parent | f779927eb2f4fdee785601823e87b28595ad71db (diff) | |
download | context-044365a4f17208925ebff5f8749c91571ed947ed.tar.gz |
beta 2014.05.26 14:56
Diffstat (limited to 'tex')
23 files changed, 998 insertions, 584 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index d4be2d713..17a4cc83d 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.05.24 15:14} +\newcontextversion{2014.05.26 14:56} %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 Binary files differindex d6a93c511..ade42d03a 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 03ef02652..aa97b7490 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.05.24 15:14} +\edef\contextversion{2014.05.26 14:56} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv index 75b65418f..fb91ba4e6 100644 --- a/tex/context/base/core-env.mkiv +++ b/tex/context/base/core-env.mkiv @@ -647,6 +647,36 @@ \expandafter\firstofoneargument \fi} +%D A few more (we could use a public test variable so that we only need +%D to expand once, assuming expandable variables): + +\letvalue{\??variables:}\empty + +\unexpanded\def\doifelseemptyvariable#1#2% + {\edef\m_syst_string_one{\csname\??variables\ifcsname\??variables#1:#2\endcsname#1:#2\else:\fi\endcsname}% + \ifx\m_syst_string_one\empty + \expandafter\firstoffourarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\unexpanded\def\doifemptyvariable#1#2% + {\edef\m_syst_string_one{\csname\??variables\ifcsname\??variables#1:#2\endcsname#1:#2\else:\fi\endcsname}% + \ifx\m_syst_string_one\empty + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + +\unexpanded\def\doifnotemptyvariable#1#2% + {\edef\m_syst_string_one{\csname\??variables\ifcsname\??variables#1:#2\endcsname#1:#2\else:\fi\endcsname}% + \ifx\m_syst_string_one\empty + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + + \def\getvariabledefault#1#2% #3% can be command, so no ifcsname here {\executeifdefined{\??variables#1:#2}}% {#3} diff --git a/tex/context/base/data-env.lua b/tex/context/base/data-env.lua index 58a081506..90b031b0f 100644 --- a/tex/context/base/data-env.lua +++ b/tex/context/base/data-env.lua @@ -120,10 +120,12 @@ local relations = allocate { -- todo: handlers also here }, bib = { names = { 'bib' }, + variable = 'BIBINPUTS', suffixes = { 'bib' }, }, bst = { names = { 'bst' }, + variable = 'BSTINPUTS', suffixes = { 'bst' }, }, fontconfig = { diff --git a/tex/context/base/lang-lab.lua b/tex/context/base/lang-lab.lua index 91c258418..1540bc04e 100644 --- a/tex/context/base/lang-lab.lua +++ b/tex/context/base/lang-lab.lua @@ -30,19 +30,27 @@ end labels.split = split -local contextsprint = context.sprint +local contextsprint = context.sprint + +local f_setlabeltextpair = formatters["\\setlabeltextpair{%s}{%s}{%s}{%s}{%s}"] +local f_key_key = formatters["\\v!%s:\\v!%s"] +local f_key_raw = formatters["\\v!%s:%s"] +local f_raw_key = formatters["%s:\\v!%s"] +local f_raw_raw = formatters["%s:%s"] +local f_key = formatters["\\v!%s"] +local f_raw = formatters["%s"] local function definelanguagelabels(data,class,tag,rawtag) for language, text in next, data.labels do if text == "" then -- skip elseif type(text) == "table" then - contextsprint(prtcatcodes,"\\setlabeltextpair{",class,"}{",language,"}{",tag,"}{",text[1],"}{",text[2],"}") + contextsprint(prtcatcodes,f_setlabeltextpair(class,language,tag,text[1],text[2])) if trace_labels then report_labels("language %a, defining label %a as %a and %a",language,rawtag,text[1],text[2]) end else - contextsprint(prtcatcodes,"\\setlabeltextpair{",class,"}{",language,"}{",tag,"}{",text,"}{}") + contextsprint(prtcatcodes,f_setlabeltextpair(class,language,tag,text,"")) if trace_labels then report_labels("language %a, defining label %a as %a",language,rawtag,text) end @@ -62,17 +70,17 @@ function labels.define(class,name,prefixed) if second then if rawget(variables,first) then if rawget(variables,second) then - definelanguagelabels(data,class,formatters["\\v!%s:\\v!%s"](first,second),tag) + definelanguagelabels(data,class,f_key_key(first,second),tag) else - definelanguagelabels(data,class,formatters["\\v!%s:%s"](first,second),tag) + definelanguagelabels(data,class,f_key_raw(first,second),tag) end elseif rawget(variables,second) then - definelanguagelabels(data,class,formatters["%s:\\v!%s"](first,second),tag) + definelanguagelabels(data,class,f_raw_key(first,second),tag) else - definelanguagelabels(data,class,formatters["%s:%s"](first,second),tag) + definelanguagelabels(data,class,f_raw_raw(first,second),tag) end elseif rawget(variables,rawtag) then - definelanguagelabels(data,class,formatters["\\v!%s"](tag),tag) + definelanguagelabels(data,class,f_key(tag),tag) else definelanguagelabels(data,class,tag,tag) end diff --git a/tex/context/base/lang-txt.lua b/tex/context/base/lang-txt.lua index 4c3a3a985..e4935aa88 100644 --- a/tex/context/base/lang-txt.lua +++ b/tex/context/base/lang-txt.lua @@ -2630,4 +2630,129 @@ data.labels={ }, }, }, + btx = { + ["mastersthesis"] = { + labels = { + en = "Master's thesis", + fr = "Thèse de master (DEA, DESS, master)", + de = "Masterarbeit", + }, + }, + ["phdthesis"] = { + labels = { + en = "PhD thesis", + fr = "Thèse de doctorat", + de = "Dissertation", + }, + }, + ["technicalreport"] = { + labels = { + en = "Technical report", + fr = "Rapport technique", + de = "Technischer Bericht", + }, + }, + -- + ["editor"] = { + labels = { + en = "editor", + fr = "éditeur", + de = "Herausgeber", + }, + }, + ["editors"] = { + labels = { + en = "editors", + fr = "éditeurs", + de = "Herausgeber", + }, + }, + ["edition"] = { + labels = { + en = "edition", + fr = "édition", + de = "Auflage", + }, + }, + -- + ["volume"] = { + labels = { + en = "volume", + de = "Band", + }, + }, + ["Volume"] = { + labels = { + en = "Volume", + de = "Band", + }, + }, + ["number"] = { + labels = { + en = "number", + fr = "numéro", + de = "Numer", + }, + }, + ["Number"] = { + labels = { + en = "Number", + fr = "Numéro", + de = "Numer", + }, + }, + ["in"] = { + labels = { + en = "in", + fr = "dans", + de = "in", + }, + }, + ["of"] = { + labels = { + en = "of", + fr = "de", + de = "von", + }, + }, + -- + ["In"] = { + labels = { + en = "In", + fr = "Dans", + de = "In", + }, + }, + -- + ["p"] = { + labels = { + en = "p", + de = "S", + }, + }, + ["pp"] = { + labels = { + en = "pp", + de = "S", + }, + }, + ["pages"] = { + labels = { + en = "pages", + de = "Seiten", + }, + }, + -- + ["and"] = { + labels = { + en = "and", + de = "und", + }, + }, + ["others"] = { + labels = { + en = "et al.", + }, + }, + } } diff --git a/tex/context/base/luat-mac.lua b/tex/context/base/luat-mac.lua index 282dc8ce3..9c3f792dd 100644 --- a/tex/context/base/luat-mac.lua +++ b/tex/context/base/luat-mac.lua @@ -92,7 +92,7 @@ local nolong = 1 - longleft - longright local utf8character = P(1) * R("\128\191")^1 -- unchecked but fast local name = (R("AZ","az") + utf8character)^1 -local csname = (R("AZ","az") + S("@?!_") + utf8character)^1 +local csname = (R("AZ","az") + S("@?!_:-*") + utf8character)^1 local longname = (longleft/"") * (nolong^1) * (longright/"") local variable = P("#") * Cs(name + longname) local escapedname = escape * csname diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index 6bfde57b6..2ce2ae1df 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -605,7 +605,7 @@ {\iffirstargument \setupcurrentmathmatrix[#1]% \fi - \emptyhbox + % \emptyhbox % noted at 25-05-2014: what was that one doing here? it messed up spacing \math_matrix_align_method_analyze \mathmatrixleft \mathmatrixbox\bgroup diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index dda4e5aad..2bae5a0b0 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -121,7 +121,7 @@ return { -- "lefttorightmark", "righttoleftmark", -- - "breakablethinspace", "nobreakspace", "narrownobreakspace", "zerowidthnobreakspace", + "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", @@ -140,6 +140,7 @@ return { "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "startcontextdefinitioncode", "stopcontextdefinitioncode", + "texdefinition", -- "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "doifelsecommandhandler","doifnotcommandhandler","doifcommandhandler", @@ -239,7 +240,7 @@ return { -- "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", -- - "endgraf", "endpar", "everyendpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", + "endgraf", "endpar", "everyendpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "nbsp", "obeyspaces", "obeylines", "obeyedspace", "obeyedline", "normalspace", -- diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 8fcf8f548..5bda9bb29 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -1385,7 +1385,7 @@ \fi} \unexpanded\def\pack_framed_finish - {\pack_framed_stop_orientation % hm, wrong place ! should rotate the result (after reshape) + {%\pack_framed_stop_orientation % hm, wrong place ! should rotate the result (after reshape) .. moved down \pack_framed_locator_before\p_framed_location \ifconditional\c_framed_has_format \ifx\p_framed_autowidth\v!force @@ -1417,6 +1417,7 @@ \ifx\p_framed_empty\v!yes \pack_framed_fake_box \fi + \pack_framed_stop_orientation % moved here at 2014-05-25 \iftrialtypesetting \else \edef\p_framed_region{\framedparameter\c!region}% \ifx\p_framed_region\v!yes % maybe later named diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua index 6062d0d4c..fc810ed6b 100644 --- a/tex/context/base/publ-dat.lua +++ b/tex/context/base/publ-dat.lua @@ -484,6 +484,9 @@ function publications.load(dataset,filename,kind) filetype = file.suffix(filename) end local fullname = resolvers.findfile(filename,"bib") + if fullname == "" then + fullname = resolvers.findfile(filename) -- let's not be too picky + end if dataset.loaded[fullname] then -- will become better -- skip elseif fullname == "" then diff --git a/tex/context/base/publ-imp-apa.bib b/tex/context/base/publ-imp-apa.bib new file mode 100644 index 000000000..fe56719f8 --- /dev/null +++ b/tex/context/base/publ-imp-apa.bib @@ -0,0 +1,29 @@ +% The fields. + +@article {apa-article, + author = "...", + comment = "...", + crossref = "...", + editor = "...", + issue = "...", + journal = "...", + note = "...", + pages = "...", + title = "...", + volume = "...", + year = "...", +} + +@book {apa-book, + author = "...", + comment = "...", + chapter = "...", + crossref = "...", + editor = "...", + series = "...", + pages = "...", + publisher = "...", + volume = "...", + year = "...", +} + diff --git a/tex/context/base/publ-imp-apa.mkiv b/tex/context/base/publ-imp-apa.mkiv deleted file mode 100644 index 3f7b119af..000000000 --- a/tex/context/base/publ-imp-apa.mkiv +++ /dev/null @@ -1,547 +0,0 @@ -%D \module -%D [ file=publ-imp-apa, -%D version=2013.12.12, % based on bibl-apa.tex and later xml variant -%D title=APA bibliography style, -%D subtitle=Publications, -%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 therefore copyrighted -%D by \PRAGMA. See mreadme.pdf for details. - -% common - -% \loadbtxdefinitionfile[def] - -\startsetups btx:apa:common:wherefrom - \btxdoifelse {address} { - \getvariable{btx:temp}{left} - \btxdoifelse {country} { - \btxdoifelse {\getvariable{btx:temp}{label}} { - \btxflush{address}\btxcomma\btxflush{country}: \btxflush{\getvariable{btx:temp}{label}} - } { - \btxflush{address}\btxcomma\btxflush{country} - } - } { - \btxdoifelse {\getvariable{btx:temp}{label}} { - \btxflush{address}\btxcomma\btxflush{\getvariable{btx:temp}{label}} - } { - \btxflush{address} - } - } - \getvariable{btx:temp}{right} - } { - \btxdoifelse {country} { - \getvariable{btx:temp}{left} - \btxdoifelse {\getvariable{btx:temp}{label}} { - \btxflush{country}: \btxflush{\getvariable{btx:temp}{label}} - } { - \btxflush{country} - } - \getvariable{btx:temp}{right} - } { - \btxdoifelse {\getvariable{btx:temp}{label}} { - \getvariable{btx:temp}{left} - \btxflush{\getvariable{btx:temp}{label}} - \getvariable{btx:temp}{right} - } { - \getvariable{btx:temp}{otherwise} - } - } - } -\stopsetups - -% \setvariables[btx:temp][label=,left=,right=,otherwise=] - -\startsetups btx:apa:common:publisher - \begingroup - \setvariables[btx:temp][label=publisher]\relax - \btxsetup{btx:apa:common:wherefrom} - \endgroup -\stopsetups - -\startsetups btx:apa:common:organization - \begingroup - \setvariables[btx:temp][label=organization]\relax - \btxsetup{btx:apa:common:wherefrom} - \endgroup -\stopsetups - -\startsetups btx:apa:common:school - \begingroup - \setvariables[btx:temp][label=school]\relax - \btxsetup{btx:apa:common:wherefrom} - \endgroup -\stopsetups - -\startsetups btx:apa:common:institution - \begingroup - \setvariables[btx:temp][label=institution]\relax - \btxsetup{btx:apa:common:wherefrom} - \endgroup -\stopsetups - -\startsetups btx:apa:common:school:subsentence - \begingroup - \setvariables[btx:temp][label=school,left=\btxcomma,right=\btxperiod,otherwise=\btxperiod]\relax - \btxsetup{btx:apa:common:wherefrom} - \endgroup -\stopsetups - -\startsetups btx:apa:common:institution:subsentence - \begingroup - \setvariables[btx:temp][label=institution,left=\btxcomma,right=\btxperiod,otherwise=\btxperiod]\relax - \btxsetup{btx:apa:common:wherefrom} - \endgroup -\stopsetups - -\startsetups btx:apa:common:publisher:sentence - \begingroup - \setvariables[btx:temp][label=publisher,left=\btxspace,right=\btxperiod]\relax - \btxsetup{btx:apa:common:wherefrom} - \endgroup -\stopsetups - -\startsetups btx:apa:common:organization:sentence - \begingroup - \setvariables[btx:temp][label=organization,left=\btxspace,right=\btxperiod]\relax - \btxsetup{btx:apa:common:wherefrom} - \endgroup -\stopsetups - -\startsetups btx:apa:common:title-and-series - \btxdoif {title} { - \btxflush{title} - \btxdoif {series} { - \btxlparent\btxflush{series}\btxrparent - } - \btxperiod - } -\stopsetups - -\startsetups btx:apa:common:title-it-and-series - \btxdoif {title} { - \bgroup\it\btxflush{title}\/\egroup - \btxdoif {series} { - \btxlparent\btxflush{series}\btxrparent - } - \btxperiod - } -\stopsetups - -\disablemode[btx:apa:edited-book] - -\startsetups btx:apa:common:author-and-year - \btxdoif {author} { - \btxflushauthor{author} - } - \btxdoif {year} { - \btxlparent\btxflush{year}\btxrparent - } - \btxperiod -\stopsetups - -\startsetups btx:apa:common:author-or-key-and-year - \btxdoifelse {author} { - \btxflushauthor{author} - } { - \btxdoif {key} { - \btxlbracket\btxsetup{btx:format:key}\btxrbracket - } - } - \btxdoif {year} { - \btxlparent\btxflush{year}\btxrparent - } - \btxperiod -\stopsetups - -\startsetups btx:apa:common:author-editors-crossref-year - \btxdoif {author} { - \btxflushauthor{author} - } { - \btxdoifelse {editor} { - \enablemode[btx:apa:edited-book] - \btxflushauthor{editor} - \btxcomma\btxsingularplural{editor}{editor}{editors} - } { - % weird period - \btxdoif {crossref} { - \btxlbracket\btxsetup{btx:format:crossref}\btxrbracket\btxperiod - } - } - } - \btxdoif {year} { - \btxlparent\btxflush{year}\btxrparent - } - \btxperiod -\stopsetups - -\startsetups btx:apa:common:editor-or-key-and-year - \btxdoifelse {editor} { - \enablemode[btx:apa:edited-book] - \btxflushauthor{editor} - \btxcomma\btxsingularplural{editor}{editor}{editors} - } { - \btxdoif {key} { - \btxlbracket\btxsetup{btx:format:key}\btxrbracket - } - } - \btxspace - \btxdoif {year} { - \btxlparent\btxflush{year}\btxrparent - } - \btxperiod -\stopsetups - -\startsetups btx:apa:common:note - \btxdoif {note} { - \btxspace\btxflush{note}\btxperiod - } -\stopsetups - -\startsetups btx:apa:common:comment - \btxdoif {comment} { - \btxspace\btxflush{comment}\btxperiod - } -\stopsetups - -\startsetups btx:apa:common:pages:p - \btxdoif {pages} { - \btxspace\btxflush{pages}\btxspace p\btxperiod - } -\stopsetups - -\startsetups btx:apa:common:pages:pp - \btxdoif {pages} { - \btxspace\btxflush{pages}\btxspace pp\btxperiod - } -\stopsetups - -\startsetups btx:apa:common:pages:pages - \btxdoif {pages} { - \btxcomma pages~\btxflush{pages} - } -\stopsetups - -\startsetups btx:apa:common:edition:sentense - \btxdoif {edition} { - \btxspace\btxflush{edition}\btxspace edition\btxperiod - } -\stopsetups - -% check when the next is used (no period) - -% \startsetups btx:apa:common:edition -% \btxdoif {edition} { -% \btxspace\btxflush{edition}\btxspace edition -% } -% \stopsetups - -% we can share more, todo - -% specific - -\startsetups btx:apa:article - \btxsetup{btx:apa:common:author-or-key-and-year} - \btxdoif {title} { - \btxflush{title}\btxperiod - } - \btxdoifelse {journal} { - \bgroup\it\btxflush{journal}\/\egroup - } { - \btxdoif {crossref} { - In\btxspace\btxflush{crossref} - } - } - \btxdoifelse {volume} { - \btxcomma\bgroup\it\btxflush{volume}\/\egroup - \btxdoif {issue} { - \btxlparent\btxflush{issue}\btxrparent - } - \btxdoif {pages} { - \btxcomma\btxflush{pages} - } - \btxperiod - } { - \btxsetup{btx:apa:common:pages:pp} - } - \btxsetup{btx:apa:common:note} - \btxsetup{btx:apa:common:comment} -\stopsetups - -\startsetups btx:apa:book - \btxsetup{btx:apa:common:author-editors-crossref-year} - \btxdoif {title} { - \bgroup\it\btxflush{title}\/\egroup - \doifmodeelse {btx:apa:edited-book} { - \btxdoifelse {volume} { - \btxspace Number\nonbreakablespace\btxflush{volume} - \btxdoifelse {series} { - \btxspace in\nonbreakablespace\btxflush{series}\btxperiod - } { - \btxdoifelse {crossref} { - \btxspace in\btxlbracket\btxsetup{btx:format:crossref}\btxrbracket - } { - \btxperiod - } - } - } { - \btxdoif {series} { - \btxspace\btxflush{series} - } - \btxperiod - } - } { - \btxdoifelse {crossref} { - \btxdoif {chapter} { - \btxcomma\btxflush{chapter} - } - \btxsetup{btx:apa:common:pages:pages} - \btxperiod - \btxdoif {volume} { - Volume\nonbreakablespace\btxflush{volume}\btxspace of\nonbreakablespace - } - } { - \btxdoif {volume} { - \btxcomma volume\nonbreakablespace\btxflush{volume} - \btxdoif {series} { - \btxspace of\nonbreakablespace\bgroup\it\btxflush{series}\/\egroup - } - \btxdoif {chapter} { - \btxcomma\btxflush{chapter} - } - \btxsetup{btx:apa:common:pages:pages} - } - \btxperiod - } - } - } - \btxsetup{btx:apa:common:edition:sentence} - \btxsetup{btx:apa:common:publisher:sentence} - \btxsetup{btx:apa:common:pages:p}% twice? - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:inbook - \btxsetup{btx:apa:common:author-editors-crossref-year} - \btxdoifelse {title} { - \bgroup\it\btxflush{title}\/\egroup - } { - \doifmodeelse {btx:apa:edited-book} { - \btxdoifelse {volume} { - \btxspace number\nonbreakablespace\btxflush{volume} - \btxdoifelse {series} { - \btxspace in\nonbreakablespace\btxflush{series}\btxperiod - } { - \btxdoifelse {crossref} { - \btxspace in\btxlbracket\btxsetup{btx:format:crossref}\btxrbracket - } { - \btxperiod - } - } - } { - \btxdoif {series} { - \btxspace\btxflush{series}\btxperiod - } - } - } { - \btxdoifelse {crossref} { - \btxdoif {chapter} { - \btxcomma\btxflush{chapter} - } - \btxsetup{btx:apa:common:pages:pages} - \btxdoif {volume} { - Volume\nonbreakablespace\btxflush{volume}\btxspace of\nonbreakablespace - } - \btxdoif {crossref} { - \btxlbracket\btxsetup{btx:format:crossref}\btxrbracket - } - } { - \btxdoif {volume} { - \btxcomma volume\nonbreakablespace\btxflush{volume} - \btxdoif {series} { - \btxspace of\nonbreakablespace\bgroup\it\btxflush{series}\/\egroup - } - \btxdoif {chapter} { - \btxcomma\btxflush{chapter} - } - \btxsetup{btx:apa:common:pages:pages} - \btxperiod - } - } - } - } - \btxspace - \btxsetup{btx:apa:common:edition:sentence} - \btxsetup{btx:apa:common:publisher} - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:booklet - \btxsetup{btx:apa:common:author-or-key-and-year} - \btxsetup{btx:apa:common:title-it-and-series} - \btxsetup{btx:apa:common:edition:sentence} - \btxsetup{btx:apa:common:publication:sentence} - \btxsetup{btx:apa:common:pages:p} - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:manual - \btxsetup{btx:apa:common:author-or-key-and-year} - \btxsetup{btx:apa:common:title-it-and-series} - \btxsetup{btx:apa:common:edition:sentence} - \btxsetup{btx:apa:common:organization:sentence} - \btxsetup{btx:apa:common:pages:p} - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:incollection - \btxsetup{btx:apa:common:author-and-year} - \btxdoif {arttitle} { - \btxflush{arttitle}\btxperiod - } - In\btxspace - \btxdoifelse {title} { - \btxflushauthor{editor}\btxcomma - \bgroup\it\btxflush{title}\/\egroup - \btxdoif {series} { - \btxdoif {volume} { - \btxcomma number\btxspace\btxflush{volume}\btxspace in - } - \btxspace\btxflush{series} - } - \btxdoif {chapter} { - \btxcomma\btxflush{chapter}\btxspace - } - \btxsetup{btx:apa:common:pages:pages} - \btxdoif {edition} { - \btxspace\btxflush{edition}\btxspace edition - } - \btxsetup{btx:apa:common:publisher:sentence} - } { - \btxdoif {crossref} { - \btxlbracket\btxsetup{btx:format:crossref}\btxrbracket - } - \btxdoif {chapter} { - \btxcomma\btxflush{chapter} - } - \btxspace - \btxsetup{btx:apa:common:pages:pages} - } - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:inproceedings - \btxsetup{btx:apa:common:author-and-year} - \btxdoif {arttitle} { - \btxflush{arttitle}\btxperiod - } - In\btxspace - \btxdoifelse {title} { - \btxdoif {editor} { - \btxflush{btx:apa:format:editors} - \btxcomma\btxsingularplural{editor}{editor}{editors}\btxcomma - } - \bgroup\it\btxflush{title}\/\egroup - \btxdoif {series} { - \btxdoif {volume} { - \btxcomma number~\btxflush{volume} in - } - \btxspace - \btxflush{series} - } - \btxdoif {chapter} { - \btxcomma\btxflush{chapter}\btxspace - } - \btxsetup{btx:apa:common:pages:pages} - \btxperiod - \btxsetup{btx:apa:common:organization:sentence} - } { - \btxdoif {crossref} { - \btxlbracket\btxsetup{btx:format:crossref}\btxrbracket - } - \btxdoif {chapter} { - \btxcomma\btxflush{chapter}\btxspace - } - \btxsetup{btx:apa:common:pages:pages} - \btxperiod - } - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:proceedings - \btxsetup{btx:apa:common:editor-or-key-and-year} - \btxdoif {title} { - \bgroup\it\btxflush{title}\/\egroup - \btxdoif {volume} { - \btxcomma number\btxspace\btxflush{volume}\btxspace in\btxspace - } - \btxdoif {chapter} { - \btxcomma\btxflush{chapter}\btxspace - } - \btxsetup{btx:apa:common:pages:pages} - \btxperiod - \btxsetup{btx:apa:common:organization:sentence} - } - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:common:thesis - \btxsetup{btx:apa:common:author-and-year} - \btxsetup{btx:apa:common:title-it-and-series} - \btxdoifelse {type} { - \btxflush{type} - } { - \getvariable{btx:temp}{label} - } - \btxsetup{btx:apa:common:school:subsentence} - \btxsetup{btx:apa:common:pages:p} - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:mastersthesis - \setvariables[btx:temp][label=Master's thesis] - \btxsetup{btx:apa:common:thesis} -\stopsetups - -\startsetups btx:apa:phdthesis - \setvariables[btx:temp][label=PhD thesis] - \btxsetup{btx:apa:common:thesis} -\stopsetups - -\startsetups btx:apa:techreport - \btxsetup{btx:apa:common:author-and-year} - \btxsetup{btx:apa:common:title-and-series} - \btxdoifelse {type} { - \btxflush{type} - \btxdoif {volume} { - \btxspace\btxflush{volume} - } - } { - \btxspace Technical Report - } - \btxsetup{btx:apa:common:institution:subsentence} - \btxsetup{btx:apa:common:pages:p} - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:misc - \btxsetup{btx:apa:common:author-and-year} - \btxsetup{btx:apa:common:title-and-series} - \btxsetup{btx:apa:common:publisher:sentence} - \btxsetup{btx:apa:common:pages:p} - \btxsetup{btx:apa:common:note} -\stopsetups - -\startsetups btx:apa:unpublished - \btxsetup{btx:apa:common:author-and-year} - \btxsetup{btx:apa:common:title-and-series} - \btxsetup{btx:apa:common:pages:p} - \btxdoif {type} { - \btxlparent\btxflush{type}\btxrparent - } - \btxsetup{btx:apa:common:note} -\stopsetups - -\endinput diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi new file mode 100644 index 000000000..aa7f6ce6b --- /dev/null +++ b/tex/context/base/publ-imp-apa.mkvi @@ -0,0 +1,678 @@ +%D \module +%D [ file=publ-imp-apa, +%D version=2013.12.12, % based on bibl-apa.tex and later xml variant +%D title=APA bibliography style, +%D subtitle=Publications, +%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 therefore copyrighted +%D by \PRAGMA. See mreadme.pdf for details. + +% \loadbtxdefinitionfile[def] + +%D Instead of texdefinitions without arguments, we could have used setups but in my +%D editor the commands stand out better and it also saves an additional component +%D in the name (e.g. common:) because commands and setups have a different namespace. +%D +%D Sometimes we have verbose injections in an entry and these can be language +%D dependent, so we use labels. + +%D The variables control the shared code for which we use a tex definition with +%D one argument, specifying the field name. + +\setvariables + [btx:apa:publisher] + [left=\btxspace, + right=\btxperiod] + +\setvariables + [btx:apa:organization] + [left=\btxspace, + right=\btxperiod] + +\setvariables + [btx:apa:school] + [left=\btxcomma, + right=\btxperiod, + otherwise=\btxperiod] + +\setvariables + [btx:apa:institution] + [left=\btxcomma, + right=\btxperiod, + otherwise=\btxperiod] + +\starttexdefinition btx:apa:wherefrom #field + \btxdoifelse {address} { + \getvariable{btx:apa:\currentbtxcategory}{left} + \btxdoifelse {country} { + \btxflush{address} + \btxcomma + \btxflush{country} + \btxdoif {#field} { + \btxcolon + \btxflush{field} + } + } { + \btxflush{address} + \btxdoif {#field} { + \btxcomma + \btxflush{#field} + } + } + \getvariable{btx:apa:\currentbtxcategory}{right} + } { + \btxdoifelse {country} { + \getvariable{btx:apa:\currentbtxcategory}{left} + \btxflush{country} + \btxdoif {#field} { + \btxcolon + \btxflush{#field} + } + \getvariable{btx:apa:\currentbtxcategory}{right} + } { + \btxdoifelse {#field} { + \getvariable{btx:apa:#field}{left} + \btxflush{#field} + \getvariable{btx:apa:#field}{right} + } { + \getvariable{btx:apa:#field}{otherwise} + } + } + } +\stoptexdefinition + +\starttexdefinition btx:apa:italic #field + \begingroup + \it + \btxflush{#field} + \italiccorrection + \endgroup +\stoptexdefinition + +\starttexdefinition btx:apa:title-and-series + \btxdoif {title} { + \btxflush{title} + \btxdoif {series} { + \btxlparent + \btxflush{series} + \btxrparent + } + \btxperiod + } +\stoptexdefinition + +\starttexdefinition btx:apa:title-it-and-series + \btxdoif {title} { + \texdefinition{btx:apa:italic}{title} + \btxdoif {series} { + \btxlparent + \btxflush{series} + \btxrparent + } + \btxperiod + } +\stoptexdefinition + +\disablemode[btx:apa:edited-book] % hm, ugly + +\starttexdefinition btx:apa:author-and-year + \btxdoif {author} { + \btxflushauthor{author} + } + \btxdoif {year} { + \btxlparent + \btxflush{year} + \btxrparent + } + \btxperiod +\stoptexdefinition + +\starttexdefinition btx:apa:author-or-key-and-year + \btxdoifelse {author} { + \btxflushauthor{author} + } { + \btxdoif {key} { + \btxlbracket + \btxsetup{btx:format:key} + \btxrbracket + } + } + \btxdoif {year} { + \btxlparent + \btxflush{year} + \btxrparent + } + \btxperiod +\stoptexdefinition + +\starttexdefinition btx:apa:author-editors-crossref-year + \btxdoif {author} { + \btxflushauthor{author} + } { + \btxdoifelse {editor} { + \setmode{btx:apa:edited-book} + \btxflushauthor{editor} + \btxcomma + \btxsingularplural {editor} { + \btxlabeltext{editor} + } { + \btxlabeltext{editors} + } + } { + % weird period + \btxdoif {crossref} { + \btxlbracket + \btxsetup{btx:format:crossref} + \btxrbracket + \btxperiod + } + } + } + \btxdoif {year} { + \btxlparent + \btxflush{year} + \btxrparent + } + \btxperiod +\stoptexdefinition + +\starttexdefinition btx:apa:editor-or-key-and-year + \btxdoifelse {editor} { + \setmode{btx:apa:edited-book} + \btxflushauthor{editor} + \btxcomma + \btxsingularplural {editor} { + \btxlabeltext{editor} + } { + \btxlabeltext{editors} + } + } { + \btxdoif {key} { + \btxlbracket + \btxsetup{btx:format:key} + \btxrbracket + } + } + \btxspace + \btxdoif {year} { + \btxlparent + \btxflush{year} + \btxrparent + } + \btxperiod +\stoptexdefinition + +\starttexdefinition btx:apa:note + \btxdoif {note} { + \btxspace + \btxflush{note} + \btxperiod + } +\stoptexdefinition + +\starttexdefinition btx:apa:comment + \btxdoif {comment} { + \btxspace + \btxflush{comment} + \btxperiod + } +\stoptexdefinition + +\starttexdefinition btx:apa:pages:p + \btxdoif {pages} { + \btxspace + \btxflush{pages} + \btxspace + \btxlabeltext{p} + \btxperiod + } +\stoptexdefinition + +\starttexdefinition btx:apa:pages:pp + \btxdoif {pages} { + \btxspace + \btxflush{pages} + \btxspace + \btxlabeltext{pp} + \btxperiod + } +\stoptexdefinition + +\starttexdefinition btx:apa:pages:pages + \btxdoif {pages} { + \btxcomma + \btxlabeltext{pages} + \btxnbsp + \btxflush{pages} + } +\stoptexdefinition + +\starttexdefinition btx:apa:edition:sentense + \btxdoif {edition} { + \btxspace + \btxflush{edition} + \btxspace + \btxlabeltext{edition} + \btxperiod + } +\stoptexdefinition + +% check when the next is used (no period) + +% \starttexdefinition btx:apa:edition +% \btxdoif {edition} { +% \btxspace +% \btxflush{edition} +% \btxspace +% \btxlabeltext{edition} +% } +% \stoptexdefinition + +% specific + +\startsetups btx:apa:article + \texdefinition{btx:apa:author-or-key-and-year} + \btxdoif {title} { + \btxflush{title} + \btxperiod + } + \btxdoifelse {journal} { + \texdefinition{btx:apa:italic}{journal} + } { + \btxdoif {crossref} { + \btxlabeltext{In} + \btxspace + \btxflush{crossref} + } + } + \btxdoifelse {volume} { + \texdefinition{btx:apa:italic}{volume} + \btxdoif {issue} { + \btxlparent + \btxflush{issue} + \btxrparent + } + \btxdoif {pages} { + \btxcomma + \btxflush{pages} + } + \btxperiod + } { + \texdefinition{btx:apa:pages:pp} + } + \texdefinition{btx:apa:note} + \texdefinition{btx:apa:comment} +\stopsetups + +\startsetups btx:apa:book + \texdefinition{btx:apa:author-editors-crossref-year} + \btxdoif {title} { + \texdefinition{btx:apa:italic}{title} + \doifmodeelse {btx:apa:edited-book} { + \btxdoifelse {volume} { + \btxspace + \btxlabeltext{Number} + \btxnbsp + \btxflush{volume} + \btxdoifelse {series} { + \btxspace + \btxlabeltext{in} + \btxnbsp + \btxflush{series} + \btxperiod + } { + \btxdoifelse {crossref} { + \btxspace + \btxlabeltext{in} + \btxlbracket + \btxsetup{btx:format:crossref} + \btxrbracket + } { + \btxperiod + } + } + } { + \btxdoif {series} { + \btxspace + \btxflush{series} + } + \btxperiod + } + } { + \btxdoifelse {crossref} { + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + } + \texdefinition{btx:apa:pages:pages} + \btxperiod + \btxdoif {volume} { + \btxlabeltext{Volume} + \btxnbsp + \btxflush{volume} + \btxspace + \btxlabeltext{of} + \btxnbsp + } + } { + \btxdoif {volume} { + \btxcomma + \btxlabeltext{volume} + \btxnbsp + \btxflush{volume} + \btxdoif {series} { + \btxspace + \btxlabeltext{of} + \btxnbsp + \texdefinition{btx:apa:italic}{series} + } + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + } + \texdefinition{btx:apa:pages:pages} + } + \btxperiod + } + } + } + \texdefinition{btx:apa:edition:sentence} + \texdefinition{btx:apa:wherefrom}{publisher} + \texdefinition{btx:apa:pages:p}% twice? + \texdefinition{btx:apa:note} +\stopsetups + +\startsetups btx:apa:inbook + \texdefinition{btx:apa:author-editors-crossref-year} + \btxdoifelse {title} { + \texdefinition{btx:apa:italic}{title} + } { + \doifmodeelse {btx:apa:edited-book} { + \btxdoifelse {volume} { + \btxspace + \btxlabeltext{number} + \btxnbsp + \btxflush{volume} + \btxdoifelse {series} { + \btxspace + \btxlabeltext{in} + \btxnbsp + \btxflush{series} + \btxperiod + } { + \btxdoifelse {crossref} { + \btxspace + \btxlabeltext{in} + \btxlbracket + \btxsetup{btx:format:crossref} + \btxrbracket + } { + \btxperiod + } + } + } { + \btxdoif {series} { + \btxspace + \btxflush{series} + \btxperiod + } + } + } { + \btxdoifelse {crossref} { + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + } + \texdefinition{btx:apa:pages:pages} + \btxdoif {volume} { + \btxlabeltext{Volume} + \btxnbsp + \btxflush{volume} + \btxspace + \btxlabeltext{of} + \btxnbsp + } + \btxdoif {crossref} { + \btxlbracket + \btxsetup{btx:format:crossref} + \btxrbracket + } + } { + \btxdoif {volume} { + \btxcomma + \btxlabeltext{volume} + \btxnbsp + \btxflush{volume} + \btxdoif {series} { + \btxspace + \btxlabeltext{of} + \btxnbsp + \texdefinition{btx:apa:italic}{series} + } + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + } + \texdefinition{btx:apa:pages:pages} + \btxperiod + } + } + } + } + \btxspace + \texdefinition{btx:apa:edition:sentence} + \texdefinition{btx:apa:wherefrom}{publisher} + \texdefinition{btx:apa:note} +\stopsetups + +\startsetups btx:apa:booklet + \texdefinition{btx:apa:author-or-key-and-year} + \texdefinition{btx:apa:title-it-and-series} + \texdefinition{btx:apa:edition:sentence} + \texdefinition{btx:apa:publication:sentence} + \texdefinition{btx:apa:pages:p} + \texdefinition{btx:apa:note} +\stopsetups + +\startsetups btx:apa:manual + \texdefinition{btx:apa:author-or-key-and-year} + \texdefinition{btx:apa:title-it-and-series} + \texdefinition{btx:apa:edition:sentence} + \texdefinition{btx:apa:wherefrom}{organization} + \texdefinition{btx:apa:pages:p} + \texdefinition{btx:apa:note} +\stopsetups + +\startsetups btx:apa:incollection + \texdefinition{btx:apa:author-and-year} + \btxdoif {arttitle} { + \btxflush{arttitle}\btxperiod + } + \btxlabeltext{In}\btxspace + \btxdoifelse {title} { + \btxflushauthor{editor} + \btxcomma + \texdefinition{btx:apa:italic}{title} + \btxdoif {series} { + \btxdoif {volume} { + \btxcomma + \btxlabeltext{number} + \btxspace + \btxflush{volume} + \btxspace + \btxlabeltext{in} + } + \btxspace\btxflush{series} + } + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + \btxspace + } + \texdefinition{btx:apa:pages:pages} + \btxdoif {edition} { + \btxspace + \btxflush{edition} + \btxspace + \btxlabeltext{edition} + } + \texdefinition{btx:apa:wherefrom}{publisher} + } { + \btxdoif {crossref} { + \btxlbracket + \btxsetup{btx:format:crossref} + \btxrbracket + } + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + } + \btxspace + \texdefinition{btx:apa:pages:pages} + } + \texdefinition{btx:apa:note} +\stopsetups + +\startsetups btx:apa:inproceedings + \texdefinition{btx:apa:author-and-year} + \btxdoif {arttitle} { + \btxflush{arttitle} + \btxperiod + } + \btxlabeltext{In}\btxspace + \btxdoifelse {title} { + \btxdoif {editor} { + \btxflush{btx:apa:format:editors} + \btxcomma + \btxsingularplural {editor} { + \btxlabeltext{editor} + } { + \btxlabeltext{editors} + } + \btxcomma + } + \texdefinition{btx:apa:italic}{title} + \btxdoif {series} { + \btxdoif {volume} { + \btxcomma + \btxlabeltext{number}\btxspace\btxflush{crossref} + \btxflush{volume} + \btxspace + \btxlabeltext{in} + } + \btxspace + \btxflush{series} + } + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + \btxspace + } + \texdefinition{btx:apa:pages:pages} + \btxperiod + \texdefinition{btx:apa:wherefrom}{organization} + } { + \btxdoif {crossref} { + \btxlbracket + \btxsetup{btx:format:crossref} + \btxrbracket + } + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + \btxspace + } + \texdefinition{btx:apa:pages:pages} + \btxperiod + } + \texdefinition{btx:apa:note} +\stopsetups + +\startsetups btx:apa:proceedings + \texdefinition{btx:apa:editor-or-key-and-year} + \btxdoif {title} { + \texdefinition{btx:apa:italic}{title} + \btxdoif {volume} { + \btxcomma + \btxlabeltext{number} + \btxspace + \btxflush{volume} + \btxspace + \btxlabeltext{in} + \btxspace + } + \btxdoif {chapter} { + \btxcomma + \btxflush{chapter} + \btxspace + } + \texdefinition{btx:apa:pages:pages} + \btxperiod + \texdefinition{btx:apa:wherefrom}{organization} + } + \texdefinition{btx:apa:note} +\stopsetups + +\starttexdefinition btx:apa:thesis + \texdefinition{btx:apa:author-and-year} + \texdefinition{btx:apa:title-it-and-series} + \btxdoifelse {type} { + \btxflush{type} + } { + \btxlabeltext{\currentbtxcategory} + } + \texdefinition{btx:apa:wherefrom}{school} + \texdefinition{btx:apa:pages:p} + \texdefinition{btx:apa:note} +\stoptexdefinition + +\startsetups btx:apa:mastersthesis + \texdefinition{btx:apa:thesis} +\stopsetups + +\startsetups btx:apa:phdthesis + \texdefinition{btx:apa:thesis} +\stopsetups + +\startsetups btx:apa:techreport + \texdefinition{btx:apa:author-and-year} + \texdefinition{btx:apa:title-and-series} + \btxdoifelse {type} { + \btxflush{type} + \btxdoif {volume} { + \btxspace + \btxflush{volume} + } + } { + \btxspace + \btxlabeltext{technicalreport} + } + \texdefinition{btx:apa:wherefrom}{institution} + \texdefinition{btx:apa:pages:p} + \texdefinition{btx:apa:note} +\stopsetups + +\startsetups btx:apa:misc + \texdefinition{btx:apa:author-and-year} + \texdefinition{btx:apa:title-and-series} + \texdefinition{btx:apa:wherefrom}{publisher} + \texdefinition{btx:apa:pages:p} + \texdefinition{btx:apa:note} +\stopsetups + +\startsetups btx:apa:unpublished + \texdefinition{btx:apa:author-and-year} + \texdefinition{btx:apa:title-and-series} + \texdefinition{btx:apa:pages:p} + \btxdoif {type} { + \btxlparent + \btxflush{type} + \btxrparent + } + \texdefinition{btx:apa:note} +\stopsetups + +\endinput diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 054ed94ea..434728748 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -969,6 +969,7 @@ function lists.flushentries(dataset,sortvariant) else ctx_setvalue("currentbtxcombis","") end + ctx_setvalue("currentbtxcategory",entry.category or "unknown") ctx_btxhandlelistentry(tag) -- pass i instead and also pass 'placed' end end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 00eb445b1..61a84f496 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -51,11 +51,13 @@ \startcontextdefinitioncode -\def\s!btx {btx} -\def\s!cite {cite} -\def\s!list {list} -\def\v!btxcite{btxcite} -\def\v!btxlist{btxlist} +\def\s!btx {btx} +\def\s!cite {cite} +\def\s!list {list} +\def\v!btxcite {btxcite} +\def\v!btxlist {btxlist} + +\definelabelclass[btxlabel][2] % a dedicated construction mechanism @@ -289,13 +291,17 @@ %D Rendering. -\unexpanded\def\btxspace {\removeunwantedspaces\space} -\unexpanded\def\btxperiod {\removeunwantedspaces.\space} -\unexpanded\def\btxcomma {\removeunwantedspaces,\space} -\unexpanded\def\btxlparent {\removeunwantedspaces\space(} -\unexpanded\def\btxrparent {\removeunwantedspaces)\space} -\unexpanded\def\btxlbracket{\removeunwantedspaces\space[} -\unexpanded\def\btxrbracket{\removeunwantedspaces]\space} +\unexpanded\def\btxspace {\removeunwantedspaces\space} +\unexpanded\def\btxnobreakspace{\removeunwantedspaces\nobreakspace} % these two are the +\unexpanded\def\btxnbsp {\removeunwantedspaces\nbsp} % same anyway +\unexpanded\def\btxperiod {\removeunwantedspaces.\space} +\unexpanded\def\btxcomma {\removeunwantedspaces,\space} +\unexpanded\def\btxcolon {\removeunwantedspaces:\space} +\unexpanded\def\btxsemicolon {\removeunwantedspaces;\space} +\unexpanded\def\btxlparent {\removeunwantedspaces\space(} +\unexpanded\def\btxrparent {\removeunwantedspaces)\space} +\unexpanded\def\btxlbracket {\removeunwantedspaces\space[} +\unexpanded\def\btxrbracket {\removeunwantedspaces]\space} %D Rendering lists and citations. @@ -890,7 +896,8 @@ %D List helpers: -\def\currentbtxindex{0} +\let\currentbtxindex \!!zerocount +\let\currentbtxcategory\empty \unexpanded\def\btxlistvariant#1% was \currentbtxindex {\begingroup @@ -956,11 +963,11 @@ \c!setups=btx:cite:\btxcitevariantparameter\c!alternative, \c!alternative=num, \c!authorconversion=\v!normal, - \c!andtext={ and }, - \c!otherstext={ et al.}, + \c!andtext={ \btxlabeltext{and} }, + \c!otherstext={ \btxlabeltext{others}}, \c!pubsep={, }, - \c!lastpubsep={ and }, - \c!finalpubsep={ and }, + \c!lastpubsep={ \btxlabeltext{and} }, + \c!finalpubsep={ \btxlabeltext{and} }, \c!compress=\v!no, \c!inbetween={ }, \c!range=\endash, @@ -1087,8 +1094,8 @@ \setupbtxlistvariant [\c!namesep={, }, - \c!lastnamesep={ and }, - \c!finalnamesep={ and }, + \c!lastnamesep={ \btxlabeltext{and} }, + \c!finalnamesep={ \btxlabeltext{and} }, \c!firstnamesep={ }, \c!juniorsep={ }, \c!vonsep={ }, @@ -1098,7 +1105,7 @@ \c!surnamefirstnamesep={, }, \c!etallimit=5, \c!etaldisplay=5, - \c!etaltext={ et al.}, + \c!etaltext={ \btxlabeltext{others}}, \c!monthconversion=\v!number, \c!authorconversion=\v!normal] @@ -1127,3 +1134,68 @@ \loadbtxdefinitionfile[definitions] \protect + +% define in lang-txt.lua: +% +% \setupbtxlabeltext +% [en] +% [mastersthesis={Master's thesis}, +% phdthesis={PhD thesis}, +% technicalreport={Technical report}, +% editor=editor, +% editors=editors, +% edition=edition, +% volume=volume, +% Volume=Volume, +% number=number, +% Number=Number, +% in=in, +% of=of, +% In=In, +% p=p, +% pp=pp, +% pages=pages, +% and=and, +% others={et al.}] +% +% \setupbtxlabeltext +% [fr] +% [mastersthesis={Thèse de master (DEA, DESS, master)}, +% phdthesis={Thèse de doctorat}, +% technicalreport={Rapport technique}, +% editor=éditeur, +% editors=éditeurs, +% edition=édition, +% volume=volume, +% Volume=Volume, +% number=numéro, +% Number=Numéro, +% in=dans, +% of=de, +% In=Dans, +% p=p, +% pp=pp, +% pages=pages, +% and=et, +% others={et al.}] +% +% \setupbtxlabeltext +% [de] +% [mastersthesis={Masterarbeit}, +% phdthesis={Dissertation}, +% technicalreport={Technischer Bericht}, +% editor=Herausgeber, +% editors=Herausgeber, +% edition=Auflage, +% volume=Band, +% Volume=Band, +% number=Numer, +% Number=Numer, +% in=in, +% of=von, +% In=In, +% p=S, +% pp=S, +% pages=Seiten, +% and=und, +% others={et al.}] diff --git a/tex/context/base/spac-chr.mkiv b/tex/context/base/spac-chr.mkiv index f9dc6e16b..562fb940c 100644 --- a/tex/context/base/spac-chr.mkiv +++ b/tex/context/base/spac-chr.mkiv @@ -77,6 +77,7 @@ \let\zwnj\zerowidthnonjoiner \let\zwj \zerowidthjoiner +\let\nbsp\nobreakspace \chardef\optionalspace"1F % will be space unless before punctuation diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index d5a2b4d56..018881663 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -935,6 +935,11 @@ specialmethods[1] = function(start,penalty) end current = getprev(current) end + -- none found, so no reson to be special + if trace_specials then + report_specials(" context penalty, discarding") + end + return special_penalty_xxx end -- specialmethods[2] : always put something before and use that as to-be-changed @@ -1041,6 +1046,11 @@ setfield(head,"prev",nil) -- till we have 0.79 ** return remove_node(head, current, true) end +-- This will be replaces after 0.79 when we have a more robust look-back and +-- can look at the bigger picture. + +-- todo: look back and when a special is there before a list is seen penaltym keep ut + local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also pass tail if trace then reset_tracing(head) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 8bb640e26..fdb2d6fac 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 48fa93f78..987caebd4 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 308e4b6fc..2288223af 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -3268,7 +3268,7 @@ \egroup -\unexpanded\def\texdefinition#1{\csname\ifcsname#1\endcsname#1\else donothing\fi\endcsname} +\unexpanded\def\texdefinition#1{\csname\ifcsname#1\endcsname#1\else donothing\fi\endcsname} % todo: a nop cs: char 0 or some corenamespace % This is a first variant, more might be added: diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c72eb4439..4d20863ac 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 : 05/24/14 15:14:04 +-- merge date : 05/26/14 14:56:53 do -- begin closure to overcome local limits and interference |