From 24ec7789fc1ebd336fa907e58266e03134b6bbd2 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 30 Jul 2014 10:31:00 +0200 Subject: beta 2014.07.30 10:31 --- doc/context/manuals/allkind/mkiv-publications.pdf | Bin 340683 -> 340550 bytes doc/context/manuals/allkind/mkiv-publications.tex | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4430 -> 4431 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/mult-aux.mkiv | 4 +- tex/context/base/mult-def.mkiv | 2 + tex/context/base/publ-imp-apa.mkvi | 46 ++++++++++++++------ tex/context/base/publ-ini.lua | 2 +- tex/context/base/publ-ini.mkiv | 18 +++++++- tex/context/base/publ-jrn.lua | 47 +++++++++++++++------ tex/context/base/status-files.pdf | Bin 24949 -> 24952 bytes tex/context/base/status-lua.pdf | Bin 327044 -> 327045 bytes tex/context/base/strc-syn.mkiv | 14 +++--- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 15 files changed, 101 insertions(+), 40 deletions(-) diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf index 49290c549..984d19be7 100644 Binary files a/doc/context/manuals/allkind/mkiv-publications.pdf and b/doc/context/manuals/allkind/mkiv-publications.pdf differ diff --git a/doc/context/manuals/allkind/mkiv-publications.tex b/doc/context/manuals/allkind/mkiv-publications.tex index 23bf1e1b5..837d531b5 100644 --- a/doc/context/manuals/allkind/mkiv-publications.tex +++ b/doc/context/manuals/allkind/mkiv-publications.tex @@ -1620,7 +1620,7 @@ An experimental feature is the ability to load a list of mapping from complete journal names to abbreviated forms. \startbuffer -\btxloadjournallist[journals.txt] +\btxloadjournallist[journals.txt] % the jabref list \btxexpandedjournal {Z. Ökol. Nat.schutz} or \btxabbreviatedjournal{Z. Ökol. Nat.schutz} or diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 63779bef9..592ea2eca 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.07.29 22:25} +\newcontextversion{2014.07.30 10:31} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 127780121..10780070a 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 1ff7413d8..9564d6135 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.07.29 22:25} +\edef\contextversion{2014.07.30 10:31} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index d4f9d3b7b..748a552ee 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -891,10 +891,10 @@ % another set of (fast) helpers (grep for usage): -\def\expandnamespaceparameter#1#2#3% \??xx \getp \c!xx \c!yy +\def\expandnamespaceparameter#1#2#3% \??xx \getp \c!xx \v!yy {\csname#1\ifcsname#1\expandafter\expandafter\expandafter\mult_aux_expand_namespace_parameter#2#3} -\def\mult_aux_expand_namespace_parameter#1#2% \cs \c!yy +\def\mult_aux_expand_namespace_parameter#1#2% \cs \v!yy {#1\endcsname#1\else#2\fi\endcsname} \def\expandnamespacemacro#1#2#3% \??xx \some_edefed_cs \c!yy diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index ce8da3278..a45f4e440 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -69,6 +69,7 @@ \def\c!group {group} \def\c!groupsuffix {groupsuffix} \def\c!properties {properties} +\def\c!journalconversion {journalconversion} \def\c!referencemethod {referencemethod} % forward both @@ -90,6 +91,7 @@ \def\v!norepeat {norepeat} \def\v!mixed {mixed} \def\v!centerlast {centerlast} +\def\v!long {long} \def\s!lcgreek {lcgreek} \def\s!ucgreek {ucgreek} diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 1a758a87d..38ea0c74f 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -21,6 +21,13 @@ \startbtxrenderingdefinitions[apa] +%D In order to get journals expanded (or normalized or abbreviated) you need to load +%D a list: +%D +%D \starttyping +%D \btxloadjournallist[journals.txt] % the jabref list +%D \stoptyping + %D Because we want to mix rendering (in the manual) we need a namespace in label %D texts: @@ -165,7 +172,8 @@ \starttexdefinition btx:apa:title-and-series \btxdoif {title} { - \btxflush{converters.Word -> title} + %btxflush{converters.Word -> title} + \btxflush{Word -> title} \btxdoif {series} { \btxlparent \btxflush{series} @@ -177,7 +185,8 @@ \starttexdefinition btx:apa:title-it-and-series \btxdoif {title} { - \texdefinition{btx:apa:italic}{converters.Word -> title} + %texdefinition{btx:apa:italic}{converters.Word -> title} + \texdefinition{btx:apa:italic}{Word -> title} \btxdoif {series} { \btxlparent \btxflush{series} @@ -363,11 +372,13 @@ \startsetups btx:apa:article \texdefinition{btx:apa:author-or-key-and-year} \btxdoif {title} { - \btxflush{converters.Word -> title} + %btxflush{converters.Word -> title} + \btxflush{Word -> title} \btxperiod } \btxdoifelse {journal} { - \texdefinition{btx:apa:italic}{journal} + % expandedjournal abbreviatedjournal + \texdefinition{btx:apa:italic}{expandedjournal -> journal} } { \btxdoif {crossref} { \btxlabeltext{apa:In} @@ -398,7 +409,8 @@ \startsetups btx:apa:book \texdefinition{btx:apa:author-editors-crossref-year} \btxdoif {title} { - \texdefinition{btx:apa:italic}{converters.Word -> title} + %texdefinition{btx:apa:italic}{converters.Word -> title} + \texdefinition{btx:apa:italic}{Word -> title} \doifmodeelse {btx:apa:edited-book} { \btxdoifelse {volume} { \btxspace @@ -476,7 +488,8 @@ \startsetups btx:apa:inbook \texdefinition{btx:apa:author-editors-crossref-year} \btxdoifelse {title} { - \texdefinition{btx:apa:italic}{converters.Word -> title} + %texdefinition{btx:apa:italic}{converters.Word -> title} + \texdefinition{btx:apa:italic}{Word -> title} } { \doifmodeelse {btx:apa:edited-book} { \btxdoifelse {volume} { @@ -577,11 +590,13 @@ \startsetups btx:apa:incollection \texdefinition{btx:apa:author-and-year} \btxdoifelse {arttitle} { - \btxflush{converters.Word -> arttitle} + %btxflush{converters.Word -> arttitle} + \btxflush{Word -> arttitle} \btxperiod } { \btxdoif {title} { - \btxflush{converters.Word -> title} + %btxflush{converters.Word -> title} + \btxflush{Word -> title} \btxperiod } } @@ -592,7 +607,8 @@ \btxflushauthor{editor} \btxcomma } - \texdefinition{btx:apa:italic}{converters.Word -> booktitle} + %texdefinition{btx:apa:italic}{converters.Word -> booktitle} + \texdefinition{btx:apa:italic}{Word -> booktitle} \btxdoif {series} { \btxdoif {volume} { \btxspace @@ -639,7 +655,8 @@ \startsetups btx:apa:inproceedings \texdefinition{btx:apa:author-and-year} \btxdoif {arttitle} { - \btxflush{converters.Word -> arttitle} + %btxflush{converters.Word -> arttitle} + \btxflush{Word -> arttitle} \btxperiod } \btxlabeltext{apa:In} @@ -655,7 +672,8 @@ } \btxcomma } - \texdefinition{btx:apa:italic}{converters.Word -> title} + %texdefinition{btx:apa:italic}{converters.Word -> title} + \texdefinition{btx:apa:italic}{Word -> title} \btxdoif {series} { \btxdoif {volume} { \btxcomma @@ -697,7 +715,8 @@ \startsetups btx:apa:proceedings \texdefinition{btx:apa:editor-or-key-and-year} \btxdoif {title} { - \texdefinition{btx:apa:italic}{converters.Word -> title} + %texdefinition{btx:apa:italic}{converters.Word -> title} + \texdefinition{btx:apa:italic}{Word -> title} \btxdoif {volume} { \btxcomma \btxlabeltext{apa:number} @@ -763,7 +782,8 @@ \texdefinition{btx:apa:author-and-year} \btxdoif {title} { \btxspace - \texdefinition{btx:apa:italic}{converters.Word -> title} + %texdefinition{btx:apa:italic}{converters.Word -> title} + \texdefinition{btx:apa:italic}{Word -> title} } \btxdoif {nationality} { \btxspace diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 1052c37e2..35988cc58 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -1377,7 +1377,7 @@ function lists.fetchentries(dataset) for i=1,#list do local li = list[i] ctx_btxsettag(li[1]) - ctx_btxsetnumber(li[4]) + ctx_btxsetnumber(li[3]) ctx_btxchecklistentry() end end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index c2823d45b..6e680e790 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -498,14 +498,18 @@ \endgroup} \def\btx_entry_inject_yes - {\fastsetup{\s!btx:\currentbtxalternative:lefttext}% + {\ifx\currentbtxlefttext\empty\else + \fastsetup{\s!btx:\currentbtxalternative:lefttext}% + \fi \fastsetup\currentbtxsetup \removeunwantedspaces \ifx\currentbtxcombis\empty \else \btxrenderingparameter\c!separator \processcommacommand[\currentbtxcombis]\btx_entry_inject_combi \fi - \fastsetup{\s!btx:\currentbtxalternative:righttext}}% + \ifx\currentbtxrighttext\empty\else + \fastsetup{\s!btx:\currentbtxalternative:righttext}% + \fi}% \def\btx_entry_inject_nop {\tttf \getmessage\m!publications{12}{\currentbtxsetup}} @@ -1078,6 +1082,15 @@ \def\btxexpandedjournal #1{\ctxcommand{btxexpandedjournal("#1")}} % \unexpanded ? \def\btxabbreviatedjournal#1{\ctxcommand{btxabbreviatedjournal("#1")}} % \unexpanded ? +% \installcorenamespace{btxjournal} +% +% \letvalue{\s!btxjournal\v!long }\btxexpandedjournal +% \letvalue{\s!btxjournal\v!short }\btxabbreviatedjournal +% \letvalue{\s!btxjournal\v!normal}\firstofoneargument +% +% \unexpanded\def\btxcheckedjournal +% {\expandnamespaceparameter\s!btxjournal\btxrenderingparameter\c!journalconversion} + % \btxloadjournallist[list.txt] % Foo Journal of Bars = FBJ \n .... % % \btxexpandedjournal[fbj] @@ -1255,6 +1268,7 @@ \c!etallimit=5, \c!etaldisplay=5, \c!etaltext={ \btxlabeltext{others}}, + %c!journalconversion=\v!normal, \c!monthconversion=\v!number, \c!authorconversion=\v!normal] diff --git a/tex/context/base/publ-jrn.lua b/tex/context/base/publ-jrn.lua index 31d618dd6..de98608c7 100644 --- a/tex/context/base/publ-jrn.lua +++ b/tex/context/base/publ-jrn.lua @@ -6,19 +6,26 @@ if not modules then modules = { } end modules ['publ-jrn'] = { license = "see context related readme files" } +-- http://jabref.sourceforge.net/journals/journal_abbreviations_general.txt +-- +-- = [;shortest unique abbreviation[;frequency]]. + -- require("char-utf") -- Abhandlungen aus dem Westfälischen Museum für Naturkunde = Abh. Westfäl. Mus. Nat.kd. -- Abhandlungen der Naturforschenden Gesellschaft in Zürich = Abh. Nat.forsch. Ges. Zür. -- Abhandlungen des Naturwissenschaftlichen Vereins zu Bremen = Abh. Nat.wiss. Ver. Bremen +if not characters then require("char-utf") end + local find = string.find local P, C, S, Cs, lpegmatch, lpegpatterns = lpeg.P, lpeg.C, lpeg.S, lpeg.Cs, lpeg.match, lpeg.patterns -local lower = characters.lower +local lower = characters.lower local report_journals = logs.reporter("publications","journals") +publications = publications or { } local journals = { } publications.journals = journals @@ -50,11 +57,18 @@ local function add(expansion,abbreviation) end end +-- [#%-] comment +-- meaning = abbreviations [;.....] + local whitespace = lpegpatterns.whitespace^0 -local separator = whitespace * lpeg.P("=") * whitespace -local endofline = lpegpatterns.space^0 * (lpegpatterns.newline + P(-1)) -local splitter = whitespace * C((1-separator)^1) * separator * C((1-endofline)^1) -local pattern = (splitter / add)^0 +local assignment = whitespace * P("=") * whitespace +local separator = P(";") +local newline = lpegpatterns.newline +local endofline = lpegpatterns.space^0 * (newline + P(-1) + separator) +local restofline = (1-newline)^0 +local splitter = whitespace * C((1-assignment)^1) * assignment * C((1-endofline)^1) * restofline +local comment = S("#-%") * restofline +local pattern = (comment + splitter / add)^0 function journals.load(filename) if not filename then @@ -122,11 +136,15 @@ function journals.abbreviated(name) return abbreviations[s] or abbreviations[simplify(expansions[s])] or name end -commands.btxloadjournallist = journals.load -commands.btxsavejournallist = journals.save -commands.btxaddjournal = function(...) context(journals.add(...)) end -commands.btxexpandedjournal = function(name) context(journals.expanded(name)) end -commands.btxabbreviatedjournal = function(name) context(journals.abbreviated(name)) end +local commands, context = commands, context + +if commands then + commands.btxloadjournallist = journals.load + commands.btxsavejournallist = journals.save + commands.btxaddjournal = function(...) context(journals.add(...)) end + commands.btxexpandedjournal = function(name) context(journals.expanded(name)) end + commands.btxabbreviatedjournal = function(name) context(journals.abbreviated(name)) end +end -- journals.load("e:/tmp/journals.txt") -- journals.save("e:/tmp/journals.lua") @@ -134,5 +152,10 @@ commands.btxabbreviatedjournal = function(name) context(journals.abbreviated(nam -- inspect(journals.expanded ("Z. Ökol. Nat.schutz")) -- inspect(journals.abbreviated("Z. Ökol. Nat. schutz")) -typesetters.manipulators.methods.expandedjournal = journals.expanded -typesetters.manipulators.methods.abbreviatedjournal = journals.abbreviated +if typesetters then + typesetters.manipulators.methods.expandedjournal = journals.expanded + typesetters.manipulators.methods.abbreviatedjournal = journals.abbreviated +end + +-- journals.load("t:/manuals/publications-mkiv/journals.txt") +-- journals.save("t:/manuals/publications-mkiv/journals.lua") diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 0955b4832..faa6c8b27 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 ab7d11449..76bbc72b8 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-syn.mkiv b/tex/context/base/strc-syn.mkiv index 6dfc79832..baf5cef7b 100644 --- a/tex/context/base/strc-syn.mkiv +++ b/tex/context/base/strc-syn.mkiv @@ -423,12 +423,14 @@ %D Presets. -\setupsimplelist - [\v!sorting] - [\c!headstyle=\simplelistparameter\c!synonymstyle, - \c!headcolor=\simplelistparameter\c!synonymcolor, - \c!style=\simplelistparameter\c!textstyle, - \c!color=\simplelistparameter\c!textcolor] +% To be considered: +% +% \setupsimplelist +% [\v!sorting] +% [\c!headstyle=\simplelistparameter\c!synonymstyle, +% \c!headcolor=\simplelistparameter\c!synonymcolor, +% \c!style=\simplelistparameter\c!textstyle, +% \c!color=\simplelistparameter\c!textcolor] \definesynonyms [\v!abbreviation] diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5e6456394..28a5117c6 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 : 07/29/14 22:25:18 +-- merge date : 07/30/14 10:31:59 do -- begin closure to overcome local limits and interference -- cgit v1.2.3