From 81e329bb8da4ef551f9a242883f6f39111eb2338 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Fri, 27 Mar 2015 22:15:05 +0100 Subject: 2015-03-27 21:41:00 --- tex/context/base/cldf-scn.lua | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4321 -> 0 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/lpdf-xmp.lua | 3 +- tex/context/base/mult-ini.lua | 1 + tex/context/base/publ-dat.lua | 10 +- tex/context/base/publ-imp-apa.mkvi | 102 +++++------ tex/context/base/publ-imp-aps.lua | 36 ++-- tex/context/base/publ-imp-aps.mkvi | 195 +++++---------------- tex/context/base/publ-ini.lua | 13 +- tex/context/base/publ-ini.mkiv | 18 +- tex/context/base/regi-ini.mkiv | 4 +- tex/context/base/status-files.pdf | Bin 24664 -> 0 bytes tex/context/base/status-lua.pdf | Bin 399807 -> 0 bytes tex/context/base/strc-lst.lua | 33 ++-- tex/context/base/strc-not.lua | 108 ++++++++---- tex/context/base/strc-not.mkvi | 42 ++--- tex/context/base/strc-num.lua | 47 ++--- tex/context/base/strc-num.mkiv | 78 ++++----- tex/context/base/strc-sec.mkiv | 65 ------- tex/context/base/toks-ini.lua | 8 +- tex/context/base/typo-cap.lua | 6 +- tex/context/base/typo-cap.mkiv | 12 +- tex/context/base/typo-chr.lua | 15 +- tex/context/base/typo-chr.mkiv | 2 +- tex/context/base/typo-krn.lua | 7 +- tex/context/base/typo-krn.mkiv | 5 +- tex/context/base/x-asciimath.lua | 125 ++++++++----- tex/context/base/x-asciimath.mkiv | 3 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 31 files changed, 441 insertions(+), 505 deletions(-) delete mode 100644 tex/context/base/context-version.pdf delete mode 100644 tex/context/base/status-files.pdf delete mode 100644 tex/context/base/status-lua.pdf (limited to 'tex') diff --git a/tex/context/base/cldf-scn.lua b/tex/context/base/cldf-scn.lua index a3d8b0d87..13339c362 100644 --- a/tex/context/base/cldf-scn.lua +++ b/tex/context/base/cldf-scn.lua @@ -86,7 +86,7 @@ function interfaces.implement(specification) if scope == "private" then return end - if commands[name] then + if commands[name] and not specification.overload then report("warning: 'commands.%s' is redefined",name) end commands[name] = command diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index f266d155c..d5d8dae02 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{2015.03.26 22:52} +\newcontextversion{2015.03.27 21:39} %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 deleted file mode 100644 index 19bc2b33e..000000000 Binary files a/tex/context/base/context-version.pdf and /dev/null differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index ceead82bf..5f7b96523 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{2015.03.26 22:52} +\edef\contextversion{2015.03.27 21:39} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/lpdf-xmp.lua b/tex/context/base/lpdf-xmp.lua index 695f0224a..aa205d10a 100644 --- a/tex/context/base/lpdf-xmp.lua +++ b/tex/context/base/lpdf-xmp.lua @@ -158,7 +158,6 @@ local function flushxmpinfo() local creator = "LuaTeX + ConTeXt MkIV" local time = lpdf.timestamp() local fullbanner = status.banner - -- local fullbanner = gsub(tex.pdftexbanner,"kpse.*","") pdfaddxmpinfo("DocumentID", documentid) pdfaddxmpinfo("InstanceID", instanceid) @@ -173,7 +172,7 @@ local function flushxmpinfo() pdfaddtoinfo("Creator", creator) pdfaddtoinfo("CreationDate", time) pdfaddtoinfo("ModDate", time) --- pdfaddtoinfo("PTEX.Fullbanner", fullbanner) -- no checking done on existence + -- pdfaddtoinfo("PTEX.Fullbanner", fullbanner) -- no checking done on existence local blob = xml.tostring(xml.first(xmp or valid_xmp(),"/x:xmpmeta")) local md = pdfdictionary { diff --git a/tex/context/base/mult-ini.lua b/tex/context/base/mult-ini.lua index 9baf6574e..c64ac8c05 100644 --- a/tex/context/base/mult-ini.lua +++ b/tex/context/base/mult-ini.lua @@ -309,6 +309,7 @@ implement { implement { name = "writestatus", + overload = true, actions = interfaces.writestatus, arguments = { "string", "string" }, } diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua index 68e2c5a0c..a6226a4fc 100644 --- a/tex/context/base/publ-dat.lua +++ b/tex/context/base/publ-dat.lua @@ -1112,10 +1112,12 @@ do name = "btxsavedataset", actions = publications.save, arguments = { - { "dataset" }, - { "filename" }, - { "filetype" }, - { "criterium" }, + { + { "dataset" }, + { "filename" }, + { "filetype" }, + { "criterium" }, + } } } diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 84d263e5c..c812a76be 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -595,7 +595,7 @@ \fastsetup{btx:apa:cite:author:year} \stopsetups -\startsetups [btx:apa:page:list] +\startsetups btx:apa:page:list \fastsetup{\s!btx:\s!page:concat} \ifx\currentbtxlastpage\empty \btxlabeltext{apa:page} @@ -633,21 +633,23 @@ % Or texdefinition? -\startsetups [apa:list:sameauthor] +\startsetups apa:list:sameauthor \fastsetup{apa:list:sameauthor:rule} \stopsetups -\startsetups [apa:list:sameauthor:rule] +\startsetups apa:list:sameauthor:rule \blackrule [\c!width=\dimexpr\listparameter\c!margin-\interwordspace\relax, - \c!height=1.5\linewidth]% are you sure you want to inconsistent with the rest? happens nowhere! + \c!height=1.5\linewidth]% \linewidth is just too thin with respect to font strokes... \stopsetups -\startsetups [apa:list:sameauthor:\v!empty]% it's not a space +\startsetups [apa:list:sameauthor:\v!empty] \kern\dimexpr\listparameter\c!margin-\interwordspace\relax \stopsetups -\startsetups [apa:list:sameauthor:ditto] % horrible ! +% horrible ! + +\startsetups apa:list:sameauthor:ditto \inframed [\c!width=\dimexpr\listparameter\c!margin-\interwordspace\relax, \c!frame=\v!off, @@ -675,6 +677,7 @@ %D returned. In lua syntax, it can be understood as %D author or editor or publisher or title or "" +% #title can be title or booktitle \starttexdefinition btx:apa:translated-title #title \ifx\currentbtxlanguage\empty @@ -713,7 +716,7 @@ \starttexdefinition btx:apa:title \setmode{btx:apa:title-placed} - % we make the title active, opening file + % we make the title active, opening "file" \btxdoifelse {file} { \texdefinition{btx:format:inject} {url(file:\btxflush{file})} @@ -729,6 +732,7 @@ } \btxdoif {title} { \btxperiod + % TODO: this period may NOT be wanted, as in: Title (2nd ed.). } \stoptexdefinition @@ -743,7 +747,7 @@ } \stoptexdefinition -\starttexdefinition nospaces btx:apa:suffixedyear +\starttexdefinition btx:apa:suffixedyear \btxdoifelse {year} { \btxflush{year} \btxflush{suffix} @@ -752,6 +756,8 @@ } \stoptexdefinition +% #author may be author(set) or editor + \starttexdefinition btx:apa:author-or-editor #author \btxdoif {#author} { \btxflush{#author} @@ -806,11 +812,22 @@ } \stoptexdefinition +% TODO: The title is terminated with period. However, +% we probably don't want this before the parenthesis. + +\starttexdefinition btx:apa:leftparenthesis-or-comma + \doifmodeelse {btx:apa:editionset-is-empty} { + \btxleftparenthesis + \resetmode{btx:apa:editionset-is-empty} + } { + \btxcomma + } +\stoptexdefinition + \starttexdefinition btx:apa:editionset - \btxleftparenthesis - \setmode{btx:apa:editionset-empty} + \setmode{btx:apa:editionset-is-empty} \doif {\currentbtxcategory} {techreport} { - \resetmode{btx:apa:editionset-empty} + \texdefinition{btx:apa:leftparenthesis-or-comma} \btxdoifelse {type} { \btxusecommand[apa:list:type] { \btxflush{type} @@ -818,10 +835,9 @@ } { \btxlabeltext{apa:technicalreport} } - \btxcomma } \btxdoif {volume} { - \resetmode{btx:apa:editionset-empty} + \texdefinition{btx:apa:leftparenthesis-or-comma} \btxoneorrange {volume} { \btxlabeltext{apa:Volume} } { @@ -829,24 +845,21 @@ } \btxspace \btxflush{volume} - \btxcomma } \btxdoif {number} { - \resetmode{btx:apa:editionset-empty} + \texdefinition{btx:apa:leftparenthesis-or-comma} \btxlabeltext{apa:number} \btxspace \btxflush{number} - \btxcomma } \btxdoif {edition} { - \resetmode{btx:apa:editionset-empty} + \texdefinition{btx:apa:leftparenthesis-or-comma} \btxflush{edition} \btxspace \btxlabeltext{apa:edition} - \btxcomma } \btxdoif {pages} { - \resetmode{btx:apa:editionset-empty} + \texdefinition{btx:apa:leftparenthesis-or-comma} \btxoneorrange {pages} { \btxlabeltext{apa:page} } { @@ -854,11 +867,8 @@ } \btxnbsp \btxflush{pages} - \btxcomma } - \removeunwantedspaces - \removepunctuation - \doifnotmode {btx:apa:editionset-empty} { + \doifnotmode {btx:apa:editionset-is-empty} { \btxrightparenthesisperiod } \stoptexdefinition @@ -872,36 +882,26 @@ \btxusecommand[apa:list:journal] { \btxflush{journal} } - \btxstopstyleandcolor - \btxdoif {volume} { + \btxdoifelse {volume} { \btxcomma - \btxstartstyleandcolor[apa:list:journal] - \btxflush{volume} + \btxflush{volume} \btxstopstyleandcolor - \btxdoifnot {number} { - \btxdoifelse {pages} - {\btxcomma} - {\btxperiod} + \btxdoif {number} { + %\btxleftparenthesis + (\btxflush{number} + \btxrightparenthesis } - } - \btxdoif {number} { - \btxdoifelse {volume} { - \removeunwantedspaces( - } { + } { + \btxstopstyleandcolor + \btxdoif {number} { \btxcomma \btxleftparenthesis + \btxflush{number} + \btxrightparenthesis } - \btxflush{number} - \btxdoifelse {pages} - {\btxrightparenthesiscomma} - {\btxrightparenthesisperiod} } \btxdoif {pages} { - \btxdoifnot {volume} { - \btxdoifnot {number} { - \btxcomma - } - } + \btxcomma \doif {\currentbtxcategory} {newspaper} { \btxoneorrange {pages} { \btxlabeltext{apa:page} @@ -911,22 +911,16 @@ \btxnbsp } \btxflush{pages} - \btxperiod } + \btxperiod \doifnot {\currentbtxcategory} {newspaper} { \btxdoifnot {volume} { \btxdoifnot {number} { \btxdoifnot {pages} { - \btxdoifelse {doi} { - \btxperiod + \btxdoif {doi} {%set: doi or url + \btxspace \btxlabeltext{apa:Advanced} \btxperiod - } { - \btxdoif {url} { - \btxperiod - \btxlabeltext{apa:Advanced} - \btxperiod - } } } } diff --git a/tex/context/base/publ-imp-aps.lua b/tex/context/base/publ-imp-aps.lua index c143e648b..5977fdb27 100644 --- a/tex/context/base/publ-imp-aps.lua +++ b/tex/context/base/publ-imp-aps.lua @@ -86,7 +86,7 @@ local categories = specification.categories categories.article = { sets = { - author = { "author", "editor", "title" }, + author = { "author", "editor" }, volume = { "volume", "number", "pages" }, doi = generic.doi, isbn = { "issn" }, @@ -97,7 +97,7 @@ categories.article = { optional = { "collaboration", "year", - "subtitle", "type", "file", + "title", "subtitle", "type", "file", "journal", "volume", "doi", "note", "isbn" }, @@ -114,7 +114,7 @@ categories.magazine = { }, optional = { "collaboration", - "subtitle", "type", "file", + "title", "subtitle", "type", "file", "number", "month", "day", "doi", "note", "isbn" @@ -167,15 +167,18 @@ categories.standard = { categories.book = { sets = { - author = { "author", "editor", "publisher", "title" }, + author = { "author", "editor", "publisher" }, editionset = generic.editionset, doi = generic.doi, }, - required = { "author" }, + required = { + "author", + "title", + }, optional = { "collaboration", "year", "month", "day", - "subtitle", "type", "file", + "title", "subtitle", "type", "file", "editionset", "series", "address", "doi", "note", "isbn" @@ -186,13 +189,14 @@ categories.book = { categories.inbook = { sets = { - author = { "author", "editor", "publisher", "title", }, + author = { "author", "editor", "publisher", }, editionset = generic.editionset, doi = generic.doi, }, required = { "author", "year" , + "title", }, optional = { "collaboration", @@ -211,7 +215,7 @@ categories.inbook = { categories.incollection = { sets = { - author = { "author", "editor", "publisher", "title", }, + author = { "author", "editor", "publisher" }, editionset = generic.editionset, doi = generic.doi, }, @@ -222,7 +226,7 @@ categories.incollection = { }, optional = { "collaboration", - "subtitle", "type", "file", + "title", "subtitle", "type", "file", "editionset", "series", "chapter", "month", @@ -235,12 +239,12 @@ categories.incollection = { categories.booklet = { sets = { - author = { "author", "title", }, publisher = { "howpublished" }, -- no "publisher"! doi = generic.doi, }, required = { - "author" + "author", + "title", }, optional = { "publisher", @@ -256,7 +260,7 @@ categories.booklet = { categories.proceedings = { sets = { - author = { "editor", "organization", "publisher", "title" }, -- no "author"! + author = { "editor", "organization", "publisher" }, -- no "author"! publisher = { "publisher", "organization" }, editionset = generic.editionset, doi = generic.doi, @@ -268,7 +272,7 @@ categories.proceedings = { optional = { "collaboration", "publisher", - "subtitle", "file", + "title", "subtitle", "file", "editionset", "series", "month", "address", @@ -283,7 +287,7 @@ categories.inproceedings = { required = categories.incollection.required, optional = { "collaboration", - "subtitle", "type", "file", + "title", "subtitle", "type", "file", "month", "edition", "series", "address", "organization", @@ -338,7 +342,7 @@ categories.phdthesis = categories.mastersthesis categories.techreport = { sets = { - author = { "author", "institution", "publisher", "title" }, + author = { "author", "institution", "publisher" }, publisher = { "publisher", "institution", }, editionset = { "type", "volume", "number", "pages" }, -- no "edition"! doi = generic.doi, @@ -364,7 +368,7 @@ categories.techreport = { categories.manual = { sets = { - author = { "author", "organization", "publisher", "title" }, + author = { "author", "organization", "publisher" }, publisher = { "publisher", "organization", }, editionset = generic.editionset, doi = generic.doi, diff --git a/tex/context/base/publ-imp-aps.mkvi b/tex/context/base/publ-imp-aps.mkvi index 996f78592..3179e8149 100644 --- a/tex/context/base/publ-imp-aps.mkvi +++ b/tex/context/base/publ-imp-aps.mkvi @@ -56,7 +56,6 @@ [aps] [\c!authorconversion=normalshort, placetitle=\v!yes] % can be set to no for journal, for example. - % this does not work - see below? (would title=yes be acceptable?) % The following are similar to default, but inherit from aps:list @@ -422,13 +421,9 @@ aps:technicalreport={Tech. Rep.}, % Technical report aps:supplement={Suppl.}, % Supplement (not used?) aps:patent=Patent, - aps:Author=Author, - aps:Translator={Trans.}, % Translator(s) (not used?) aps:inpress={in press}, aps:tobe={to be published}, aps:unpublished={unpublished}, - aps:Advanced={Advanced online publication}, - aps:Retrieved={Available from}, % {Retrieved from}, aps:In=In] % Check this (google translate!!): @@ -450,13 +445,9 @@ aps:technicalreport={Technisch rapport}, % Technical report aps:supplement=Supplement, aps:patent=Octrooi, - aps:Author=Auteur, - aps:Translator=Vertaler, aps:inpress={in press}, % CHECK THESE! aps:tobe={worden gepubliceerd}, aps:unpublished={onuitgegeven}, - aps:Advanced={Geavanceerde online publicatie}, - aps:Retrieved={Beschikbaar vanaf}, % {Ontvangen van}, aps:In=In] \setupbtxlabeltext @@ -477,13 +468,9 @@ aps:technicalreport={Rapport technique}, aps:supplement=Supplément, aps:patent=Brevet, - aps:Author=Auteur, - aps:Translator=Traducteur, aps:inpress={sous impression}, aps:tobe={à paraître}, aps:unpublished={inédit}, % pour un livre - aps:Advanced={Publication en ligne anticipée}, - aps:Retrieved={Disponible à}, % {Téléchargé de}, aps:In=Dans] \setupbtxlabeltext @@ -503,13 +490,9 @@ aps:technicalreport={Technischer Bericht}, aps:supplement={Beilage}, % Supplement aps:patent=Patent, - aps:Author=Autor, - aps:Translator={Übersetzer}, % Übers. aps:inpress={in der Presse}, % CHECK THESE! aps:tobe={veröffentlicht werden}, aps:unpublished={unveröffentlicht}, - aps:Advanced={Erweiterte Online-Publikation}, - aps:Retrieved={heruntergeladen von}, aps:In=In] % thanks: Andrea Valle @@ -531,13 +514,9 @@ aps:technicalreport={Relazione tecnica}, aps:supplement={Supplemento}, aps:patent=Brevetto, - aps:Author=Autore, - aps:Translator={Trad.}, % Translator(s) aps:inpress={in press}, % CHECK THESE! aps:tobe={da pubblicare}, aps:unpublished={inedito}, - aps:Advanced={Pre-pubblicazione on line}, - aps:Retrieved={Accessible online}, aps:In=In] \setupbtxlabeltext @@ -557,19 +536,15 @@ aps:technicalreport={Informe técnico}, aps:supplement=Suplemento, aps:patent=Patente, - aps:Author=Autor, - aps:Translator=Traductor, aps:inpress={en prensa}, % CHECK THESE! aps:tobe={que se publicará}, aps:unpublished={inédito}, - aps:Advanced={Publicación en línea avanzada}, - aps:Retrieved={Disponible desde}, % {Obtenido de}, aps:In=En] % cite setups \startsetups btx:aps:nd - \doifelse {\currentbtxcategory} {journal} { + \doifelse {\currentbtxcategory} {article} { \btxlabeltext{aps:tobe} } { \doifelse {\currentbtxcategory} {book} { @@ -672,34 +647,28 @@ \stoptexdefinition \starttexdefinition btx:aps:title - \setmode{btx:aps:title-placed} - % we make the title active, opening file - \btxdoifelse {file} { - \texdefinition{btx:format:inject} - {url(file:\btxflush{file})} - { - \btxstartstyleandcolor [aps:list:title:\currentbtxcategory] - \texdefinition{btx:aps:composed-title}{title} - \btxstopstyleandcolor - } - } { - \btxstartstyleandcolor [aps:list:title:\currentbtxcategory] - \texdefinition{btx:aps:composed-title}{title} - \btxstopstyleandcolor + \btxdoif {title} { + % we make the title active, opening file + \btxdoifelse {file} { + \texdefinition{btx:format:inject} + {url(file:\btxflush{file})} + { + \btxstartstyleandcolor [aps:list:title:\currentbtxcategory] + \texdefinition{btx:aps:composed-title}{title} + \btxstopstyleandcolor + } + } { + \btxstartstyleandcolor [aps:list:title:\currentbtxcategory] + \texdefinition{btx:aps:composed-title}{title} + \btxstopstyleandcolor + } + \btxcomma } \stoptexdefinition -\starttexdefinition btx:aps:title-if-not-placed - \doifmodeelse {btx:aps:title-placed} { - \resetmode{btx:aps:title-placed} - } { - %does not work (need to check the setting) - %\doifelse{\btxparameter{placetitle}}\v!yes { - \btxdoif {title} { - \texdefinition {btx:aps:title} - \btxcomma - } - %} +\starttexdefinition btx:aps:optional-title + \doif{\btxparameter{placetitle}}\v!yes { + \texdefinition {btx:aps:title} } \stoptexdefinition @@ -711,39 +680,32 @@ } \stoptexdefinition -%\starttexdefinition btx:aps:suffixedyear -% \btxdoifelse {year} { -% \btxflush{year} -% \btxflush{suffix} -% } { -% \fastsetup{btx:aps:nd} -% } -%\stoptexdefinition +% #author may be author(set) or editor \starttexdefinition btx:aps:author-or-editor #author \btxdoif {#author} { \btxflush{#author} - \doif {\btxfoundname{#author}} {editor} { + \doifelse {\btxfoundname{#author}} {editor} { \btxleftparenthesis \btxsingularorplural {editor} { \btxlabeltext{aps:Editor} } { \btxlabeltext{aps:Editors} } - \btxrightparenthesisperiod + \btxrightparenthesis + } { + \btxdoif {collaboration} { + \btxleftparenthesis + \btxflush{collaboration} + \btxrightparenthesis + } } } \stoptexdefinition \starttexdefinition btx:aps:author \btxflush{author} - \btxdoifelse {collaboration} { - \btxleftparenthesis - \btxflush{collaboration} - \btxrightparenthesiscomma - } { - \btxcomma - } + \btxcomma \stoptexdefinition \starttexdefinition btx:aps:editor-in @@ -764,7 +726,7 @@ \starttexdefinition btx:aps:editionset \doif {\currentbtxcategory} {techreport} { \btxdoifelse {type} { - \btxusecommand[aps:list:type] { + \btxusecommand[\currentbtx:type] { \btxflush{type} } } { @@ -806,77 +768,6 @@ } \stoptexdefinition -%% this could be simplified! -%\starttexdefinition btx:aps:journal-volume-number-pages -% \btxdoif {journal} { -% \btxspace -% \btxstartstyleandcolor[aps:list:journal] -% \btxusecommand[aps:list:journal] { -% \btxflush{journal} -% } -% \btxstopstyleandcolor -% \btxdoif {volume} { -% \btxcomma -% \btxstartstyleandcolor[aps:list:journal] -% \btxflush{volume} -% \btxstopstyleandcolor -% \btxdoifnot {number} { -% \btxdoifelse {pages} -% {\btxcomma} -% {\btxperiod} -% } -% } -% \btxdoif {number} { -% \btxdoifelse {volume} { -% \removeunwantedspaces( -% } { -% \btxcomma -% \btxleftparenthesis -% } -% \btxflush{number} -% \btxdoifelse {pages} -% {\btxrightparenthesiscomma} -% {\btxrightparenthesisperiod} -% } -% \btxdoif {pages} { -% \btxdoifnot {volume} { -% \btxdoifnot {number} { -% \btxcomma -% } -% } -% \doif {\currentbtxcategory} {newspaper} { -% \btxoneorrange {pages} { -% \btxlabeltext{aps:page} -% } { -% \btxlabeltext{aps:pages} -% } -% \btxnbsp -% } -% \btxflush{pages} -% \btxperiod -% } -% \doifnot {\currentbtxcategory} {newspaper} { -% \btxdoifnot {volume} { -% \btxdoifnot {number} { -% \btxdoifnot {pages} { -% \btxdoifelse {doi} { -% \btxperiod -% \btxlabeltext{aps:Advanced} -% \btxperiod -% } { -% \btxdoif {url} { -% \btxperiod -% \btxlabeltext{aps:Advanced} -% \btxperiod -% } -% } -% } -% } -% } -% } -% } -%\stoptexdefinition - \starttexdefinition btx:aps:journal-volumeset-year \btxdoif {journal} { % expandedjournal abbreviatedjournal @@ -902,7 +793,7 @@ \btxflush{pages} } \btxleftparenthesis - \fastsetup{btx:aps:year} + \texdefinition{btx:aps:year} \btxrightparenthesis \btxperiod } @@ -928,7 +819,7 @@ \btxcomma } } - \fastsetup{btx:aps:year} + \texdefinition{btx:aps:year} \btxrightparenthesis \stoptexdefinition @@ -940,8 +831,6 @@ % use \btxentry here? \starttexdefinition btx:aps:url - \btxspace - \btxlabeltext{aps:Retrieved} \btxspace \begingroup \setbreakpoints[doi] @@ -1014,7 +903,7 @@ \startsetups btx:aps:list:article \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:optional-title} \texdefinition{btx:aps:journal-volumeset-year} \texdefinition{btx:aps:url-note-doi} \stopsetups @@ -1050,7 +939,7 @@ \startsetups btx:aps:list:standard \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:title} \texdefinition{btx:aps:url-doi-note} \stopsetups % year? @@ -1064,7 +953,7 @@ \startsetups btx:aps:list:book \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:title} \texdefinition{btx:aps:editionset} \texdefinition{btx:aps:publisher-wherefrom-year} \texdefinition{btx:aps:url-doi-note} @@ -1081,7 +970,7 @@ \startsetups btx:aps:list:inbook \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:title} \texdefinition{btx:aps:editor-in} \texdefinition{btx:aps:editionset} \texdefinition{btx:aps:publisher-wherefrom-year} @@ -1113,7 +1002,7 @@ \startsetups btx:aps:list:inproceedings \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:title} \texdefinition{btx:aps:editor-in} \texdefinition{btx:aps:editionset} \btxdoif {organization} { @@ -1135,7 +1024,7 @@ \startsetups btx:aps:list:thesis \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:title} \btxleftparenthesis \btxdoifelse {type} { \btxusecommand[aps:list:type] { @@ -1214,7 +1103,7 @@ \startsetups btx:aps:list:patent \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:title} \begingroup \it \btxdoif {nationality} { @@ -1246,7 +1135,7 @@ \startsetups btx:aps:list:electronic \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:title} \btxdoif {organization} { \btxspace \btxflush{organization} @@ -1274,7 +1163,7 @@ \startsetups btx:aps:list:misc \texdefinition{btx:aps:author} - \texdefinition{btx:aps:title-if-not-placed} + \texdefinition{btx:aps:title} \btxdoif {howpublished} { \btxspace \btxflush{howpublished} diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 42d4c4251..ea6f22e0d 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['publ-ini'] = { +7if not modules then modules = { } end modules ['publ-ini'] = { version = 1.001, comment = "this module part of publication support", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -1980,11 +1980,11 @@ do arguments = { "string", "string" } } - implement { - name = "btxresolvelistreference", - actions = lists.resolve, - arguments = { "string", "string" } - } + -- implement { + -- name = "btxresolvelistreference", + -- actions = lists.resolve, + -- arguments = { "string", "string" } + -- } implement { name = "btxcollectlistentries", @@ -2303,6 +2303,7 @@ do -- ctx_btxstartcite() ctx_btxsettag(tag) + ctx_btxsetcategory(entry.category or "unknown") -- if oneleft then if i == 1 then diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 6c96aaf2a..a7494058e 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -701,7 +701,7 @@ \else \let\currentbtxrendering\currentbtxspecification \fi\fi - \setbtxparameterset\s!list\currentbtxspecification + \setbtxparameterset\currentbtxspecification\s!list \the\everybtxlistrendering \ifconditional#1\relax \edef\currentbtxrenderingtitle{\btxrenderingparameter\c!title}% @@ -1057,14 +1057,14 @@ % till here -\unexpanded\def\btxnumberedreference[#1]% \bibtexnumref (replaced by \cite[num]) - {\dontleavehmode - \begingroup - \btxparameter\v!left - \penalty\plustenthousand % todo - \clf_btxresolvelistreference{\currentbtxdataset}{#1}% todo: split dataset from #1, so another call - \btxparameter\v!right - \endgroup} +% \unexpanded\def\btxnumberedreference[#1]% \bibtexnumref (replaced by \cite[num]) +% {\dontleavehmode +% \begingroup +% \btxparameter\v!left +% \penalty\plustenthousand % todo +% \clf_btxresolvelistreference{\currentbtxdataset}{#1}% todo: split dataset from #1, so another call +% \btxparameter\v!right +% \endgroup} %D When a publication is cited, we need to signal that somehow. This is done with the %D following (not user) command. We could tag without injecting a node but this way diff --git a/tex/context/base/regi-ini.mkiv b/tex/context/base/regi-ini.mkiv index 71add44a1..6190393d8 100644 --- a/tex/context/base/regi-ini.mkiv +++ b/tex/context/base/regi-ini.mkiv @@ -25,9 +25,9 @@ \let\currentregime\empty -\unexpanded\def\enableregime[#1]{\clf_enableregime} +\unexpanded\def\enableregime[#1]{\clf_enableregime{#1}} \unexpanded\def\disableregime {\clf_disableregime} -\unexpanded\def\startregime [#1]{\clf_startregime} +\unexpanded\def\startregime [#1]{\clf_startregime{#1}} \unexpanded\def\stopregime {\clf_stopregime} \protect \endinput diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf deleted file mode 100644 index 493ddbafd..000000000 Binary files a/tex/context/base/status-files.pdf and /dev/null differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf deleted file mode 100644 index baf911308..000000000 Binary files a/tex/context/base/status-lua.pdf and /dev/null differ diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 06506cb7f..73ee44487 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -198,6 +198,12 @@ function lists.addto(t) -- maybe more more here (saves parsing at the tex end) m.level = structures.sections.currentlevel() end local numberdata = t.numberdata + if numberdata then + local numbers = numberdata.numbers + if type(numbers) == "string" then + numberdata.numbers = structures.counters.compact(numbers,nil,true) + end + end local group = numberdata and numberdata.group local name = m.name if not group then @@ -232,13 +238,6 @@ function lists.addto(t) -- maybe more more here (saves parsing at the tex end) if trace_lists then report_lists("added %a, internal %a",name,p) end - local n = t.numberdata - if n then - local numbers = n.numbers - if type(numbers) == "string" then - n.numbers = structures.counters.compact(numbers,nil,true) - end - end return p end @@ -1134,22 +1133,22 @@ implement { name = "doiflisthaspageelse", actions = { lists.haspagedata, com implement { name = "doiflisthasnumberelse", actions = { lists.hasnumberdata, commands.doifelse }, arguments = { "string", "integer" } } implement { name = "doiflisthasentry", actions = { lists.iscached, commands.doifelse }, arguments = { "integer" } } -local function savedlistnumber(name,n) +local function savedlisttitle(name,n,tag) local data = cached[tonumber(n)] if data then - local numberdata = data.numberdata - if numberdata then - typesetnumber(numberdata,"number",numberdata or false) + local titledata = data.titledata + if titledata then + helpers.title(titledata[tag] or titledata.title or "",data.metadata) end end end -local function savedlisttitle(name,n,tag) +local function savedlistnumber(name,n) local data = cached[tonumber(n)] if data then - local titledata = data.titledata - if titledata then - helpers.title(titledata[tag] or titledata.title or "",data.metadata) + local numberdata = data.numberdata + if numberdata then + typesetnumber(numberdata,"number",numberdata or false) end end end @@ -1165,6 +1164,10 @@ local function savedlistprefixednumber(name,n) end end +lists.savedlisttitle = savedlisttitle +lists.savedlistnumber = savedlistnumber +lists.savedlistprefixednumber = savedlistprefixednumber + implement { name = "savedlistnumber", actions = savedlistnumber, diff --git a/tex/context/base/strc-not.lua b/tex/context/base/strc-not.lua index 40b78d59f..71eccf1ce 100644 --- a/tex/context/base/strc-not.lua +++ b/tex/context/base/strc-not.lua @@ -38,6 +38,8 @@ local variables = interfaces.variables local context = context local commands = commands +local implement = interfaces.implement + -- state: store, insert, postpone local function store(tag,n) @@ -69,9 +71,11 @@ end notes.store = store -function commands.storenote(tag,n) - context(store(tag,n)) -end +implement { + name = "storenote", + actions = { store, context }, + arguments = { "string", "integer" } +} local function get(tag,n) -- tricky ... only works when defined local nd = notedata[tag] @@ -108,9 +112,11 @@ end notes.listindex = listindex -function commands.notelistindex(tag,n) - context(listindex(tag,n)) -end +implement { + name = "notelistindex", + actions = { listindex, context }, + arguments = { "string", "integer" } +} local function setstate(tag,newkind) local state = notestates[tag] @@ -144,18 +150,28 @@ end notes.setstate = setstate notes.getstate = getstate -commands.setnotestate = setstate +implement { + name = "setnotestate", + actions = setstate, + arguments = { "string", "string" } +} -function commands.getnotestate(tag) - context(getstate(tag)) -end +implement { + name = "getnotestate", + actions = { getstate, context }, + arguments = "string" +} function notes.define(tag,kind,number) local state = setstate(tag,kind) state.number = number end -commands.definenote = notes.define +implement { + name = "definenote", + actions = notes.define, + arguments = { "string", "string", "integer" } +} function notes.save(tag,newkind) local state = notestates[tag] @@ -184,8 +200,8 @@ function notes.restore(tag,forcedstate) end end -commands.savenote = notes.save -commands.restorenote = notes.restore +implement { name = "savenote", actions = notes.save, arguments = { "string", "string" } } +implement { name = "restorenote", actions = notes.restore, arguments = { "string", "string" } } local function hascontent(tag) local ok = notestates[tag] @@ -205,9 +221,11 @@ end notes.hascontent = hascontent -function commands.doifnotecontent(tag) - commands.doif(hascontent(tag)) -end +implement { + name = "doifnotecontent", + actions = { hascontent, commands.doif }, + arguments = "string", +} local function internal(tag,n) local nd = get(tag,n) @@ -243,9 +261,11 @@ end notes.doifonsamepageasprevious = onsamepageasprevious -function commands.doifnoteonsamepageasprevious(tag) - commands.doifelse(onsamepageasprevious(tag)) -end +implement { + name = "doifnoteonsamepageasprevious", + actions = { onsamepageasprevious, commands.doifelse }, + arguments = "string", +} function notes.checkpagechange(tag) -- called before increment ! local nd = notedata[tag] -- can be unset at first entry @@ -277,7 +297,10 @@ function notes.postpone() end end -commands.postponenotes = notes.postpone +implement { + name = "postponenotes", + actions = notes.postpone +} function notes.setsymbolpage(tag,n,l) local l = l or listindex(tag,n) @@ -297,7 +320,11 @@ function notes.setsymbolpage(tag,n,l) end end -commands.setnotesymbolpage = notes.setsymbolpage +implement { + name = "setnotesymbolpage", + actions = notes.setsymbolpage, + arguments = { "string", "integer" } +} local function getsymbolpage(tag,n) local li = internal(tag,n) @@ -351,11 +378,11 @@ notes.getsymbolpage = getsymbolpage notes.getnumberpage = getnumberpage notes.getdeltapage = getdeltapage -function commands.notesymbolpage(tag,n) context(getsymbolpage(tag,n)) end -function commands.notenumberpage(tag,n) context(getnumberpage(tag,n)) end -function commands.notedeltapage (tag,n) context(getdeltapage (tag,n)) end +implement { name = "notesymbolpage", actions = { getsymbolpage, context }, arguments = { "string", "integer" } } +implement { name = "notenumberpage", actions = { getnumberpage, context }, arguments = { "string", "integer" } } +implement { name = "notedeltapage", actions = { getdeltapage, context }, arguments = { "string", "integer" } } -function commands.flushnotes(tag,whatkind,how) -- store and postpone +local function flushnotes(tag,whatkind,how) -- store and postpone local state = notestates[tag] local kind = state.kind if kind == whatkind then @@ -411,15 +438,26 @@ function commands.flushnotes(tag,whatkind,how) -- store and postpone end end -function commands.flushpostponednotes() +local function flushpostponednotes() if trace_notes then report_notes("flushing all postponed notes") end for tag, _ in next, notestates do - commands.flushnotes(tag,"postpone") + flushnotes(tag,"postpone") end end +implement { + name = "flushpostponednotes", + actions = flushpostponednotes +} + +implement { + name = "flushnotes", + actions = flushnotes, + arguments = { "string", "string", "string" } +} + function notes.resetpostponed() if trace_notes then report_notes("resetting all postponed notes") @@ -432,13 +470,17 @@ function notes.resetpostponed() end end -function commands.notetitle(tag,n) - command.savedlisttitle(tag,notedata[tag][n]) -end +implement { + name = "notetitle", + actions = function(tag,n) lists.savedlisttitle(tag,notedata[tag][n]) end, + arguments = { "string", "integer" } +} -function commands.noteprefixednumber(tag,n,spec) - commands.savedlistprefixednumber(tag,notedata[tag][n]) -end +implement { + name = "noteprefixednumber", + actions = function(tag,n) lists.savedlistprefixednumber(tag,notedata[tag][n]) end, + arguments = { "string", "integer" } +} function notes.internalid(tag,n) local nd = get(tag,n) diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi index 982dc2fbe..bfa029e2b 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -393,7 +393,7 @@ \setexpandednoteparameter\s!insert{\namednoteparameter\currentnoteparent\s!insert}% \definenotation[\currentnote][\currentnoteparent][\c!type=\v!note]% \fi - \ctxcommand{definenote("\currentnote","insert",\number\currentnoteinsertionnumber)}% + \clf_definenote{\currentnote}{insert}\currentnoteinsertionnumber\relax \to \everydefinenote % maybe we will share this at some point: @@ -438,7 +438,7 @@ \strc_notes_inject_dummy \else \begingroup - \edef\currentnotenumber{\ctxcommand{storenote("\currentnote",\currentconstructionlistentry)}}% + \edef\currentnotenumber{\clf_storenote{\currentnote}\currentconstructionlistentry}% \settrue\processingnote \ifconditional\c_strc_notes_skip \globallet\lastnotesymbol\strc_notes_inject_symbol_nop @@ -520,7 +520,7 @@ \endcsname} \setvalue{\??noteinteractioninline\v!yes}% - {\strc_references_get_simple_page_reference{page(\ctxcommand{notenumberpage("\currentnote",\currentnotenumber)})}% + {\strc_references_get_simple_page_reference{page(\clf_notenumberpage{\currentnote}\currentnotenumber)}% \edef\strc_notes_get_reference_attribute_symbol{attr\referenceattribute\currentreferenceattribute}% \let \strc_notes_set_style_color_inline \strc_notes_set_style_color_inline_yes} @@ -540,7 +540,7 @@ % page(...) : we could have a dedicated one \setvalue{\??noteinteractiondisplay\v!yes}% - {\strc_references_get_simple_page_reference{page(\ctxcommand{notesymbolpage("\currentnote",\currentnotenumber)})}% + {\strc_references_get_simple_page_reference{page(\clf_notesymbolpage{\currentnote}\currentnotenumber)}% \edef\strc_notes_set_reference_attribute_number{\attribute\referenceattribute\currentreferenceattribute}% \let \strc_notes_set_reference_attribute_text \donothing \let \strc_notes_set_destination_attribute_text\donothing @@ -553,7 +553,7 @@ \let\strc_notes_set_style_color_display \strc_notes_set_style_color_display_nop} \setvalue{\??noteinteractiondisplay\v!all}% - {\strc_references_get_simple_page_reference{page(\ctxcommand{notesymbolpage("\currentnote",\currentnotenumber)})}% + {\strc_references_get_simple_page_reference{page(\clf_notesymbolpage{\currentnote}\currentnotenumber)}% \edef\strc_notes_set_reference_attribute_text {\attribute\referenceattribute\currentreferenceattribute}% %\strc_references_set_simple_page_reference{note:\cldcontext{structures.notes.internalid("\currentnote",\currentnotenumber)}}% \strc_references_set_simple_page_reference{note:\currentnote:\currentnotenumber}% @@ -562,7 +562,7 @@ \let \strc_notes_set_style_color_display \strc_notes_set_style_color_display_yes} \setvalue{\??noteinteractiondisplay\v!text}% - {\strc_references_get_simple_page_reference{page(\ctxcommand{notesymbolpage("\currentnote",\currentnotenumber)})}% + {\strc_references_get_simple_page_reference{page(\clf_notesymbolpage{\currentnote}\currentnotenumber)}% \edef\strc_notes_set_reference_attribute_text {\attribute\referenceattribute\currentreferenceattribute}% %\strc_references_set_simple_page_reference{note:\cldcontext{structures.notes.internalid("\currentnote",\currentnotenumber)}}% \strc_references_set_simple_page_reference{note:\currentnote:\currentnotenumber}% @@ -587,7 +587,7 @@ {\iftrialtypesetting % keep \else\ifx\currentcolorparameter\empty - \scratchcounter\ctxcommand{notedeltapage("\currentnote",\currentnotenumber)}\relax % todo calculate once + \scratchcounter\clf_notedeltapage{\currentnote}\currentnotenumber\relax % todo calculate once \setlocationcolorspecified\scratchcounter \fi\fi} @@ -606,7 +606,7 @@ % in mkii the pointer only showed up in pagewise notes \unexpanded\def\strc_notes_inject_pointer % todo calculate once - {\ifcase\ctxcommand{notedeltapage("\currentnote",\currentnotenumber)}\relax + {\ifcase\clf_notedeltapage{\currentnote}\currentnotenumber\relax\relax % unknown \or % same page @@ -655,7 +655,7 @@ \hbox \strc_notes_get_reference_attribute_symbol \bgroup \dostarttagged\t!descriptionsymbol\currentnote \dotagsetnotesymbol - \noteparameter\c!textcommand{\ctxcommand{noteprefixednumber("\currentnote",\currentnotenumber)}}% + \noteparameter\c!textcommand{\clf_noteprefixednumber{\currentnote}\currentnotenumber\relax}% % the next one can cycle so we need to make sure it has no advance width \doif{\noteparameter\c!indicator}\v!yes\strc_notes_inject_pointer \dostoptagged @@ -1030,7 +1030,7 @@ \def\strc_notes_set_location_text % we don't use inserts anyway (e.g. endnotes) {\settrue\c_strc_notes_delayed - \ctxcommand{setnotestate("\currentnote","store")}% + \clf_setnotestate{\currentnote}{store}% \page_inserts_set_location\currentnoteinsertion\v!text % \setupinsertion[\currentnote][\c!location=\v!text]% \global\count\currentnoteinsertionnumber\zerocount \global\dimen\currentnoteinsertionnumber\maxdimen @@ -1205,7 +1205,7 @@ \edef\currentnote{#tag}% \strc_constructions_initialize{#tag}% \strc_notes_synchronize - \edef\currentconstructionlistentry{\ctxcommand{notelistindex("\currentnote",#id)}}% index in list cache + \edef\currentconstructionlistentry{\clf_notelistindex{\currentnote}#id}% index in list cache % as we can have collected notes (e.g. in tables) we need to recover % \currentdescriptionattribute and \currentdescriptionsynchronize % @@ -1226,7 +1226,7 @@ } \unexpanded\def\strc_notes_inject_text % hm main? - {\ctxcommand{savedlisttitle("\currentconstructionmain",\currentconstructionlistentry)}} + {\clf_savedlisttitle{\currentconstructionmain}\currentconstructionlistentry\relax} \let\startpushnote\relax \let\stoppushnote \relax @@ -1400,7 +1400,7 @@ {\ifconditional\postponingnotes\else \global\settrue\postponingnotes \global\let\flushnotes\doflushnotes - \ctxcommand{postponenotes()}% + \clf_postponenotes \fi} \let\flushnotes\relax @@ -1410,7 +1410,7 @@ \begingroup \let\flushnotes \relax \let\postponenotes\relax - \ctxcommand{flushpostponednotes()}% this also resets the states ! + \clf_flushpostponednotes% this also resets the states ! \global\setfalse\postponednote \global\setfalse\postponingnotes \global\let\flushnotes\relax @@ -1457,20 +1457,20 @@ \strc_counters_save{#tag}% \strc_counters_reset{#tag}% \fi - \ctxcommand{savenote("#tag","store")}} + \clf_savenote{#tag}{store}} \def\strc_notes_local_stop_step#tag% {\p_strc_notes_continue{\noteparameter\c!continue}% \ifx\p_strc_notes_continue\v!yes \else \strc_counters_restore{#tag}% \fi - \ctxcommand{restorenote("#tag")}} + \clf_restorenote{#tag}} \unexpanded\def\placelocalnotes {\dodoubleempty\strc_notes_local_place} \def\strc_notes_local_place[#tag][#settings]% - {\doif{\ctxcommand{getnotestate("#tag")}}{store}{\strc_notes_local_place_indeed{#settings}{#tag}}} + {\doif{\clf_getnotestate{#tag}}{store}{\strc_notes_local_place_indeed{#settings}{#tag}}} \def\strc_notes_local_place_indeed#settings#tag% {\begingroup @@ -1530,7 +1530,7 @@ \def\strc_notes_place_indeed#settings#tag% settings note {\edef\currentnote{#tag}% grouping ? - \doifelse{\ctxcommand{getnotestate("#tag")}}{store} + \doifelse{\clf_getnotestate{#tag}}{store} \strc_notes_local_place_indeed \strc_notes_global_place_indeed {#settings}{#tag}} @@ -1550,7 +1550,7 @@ {\setvalue{\??notealternative#alternative}{#command}} \unexpanded\def\doifnotescollected#tag% - {\ctxcommand{doifnotecontent("#tag")}} + {\clf_doifnotecontent{#tag}} \def\strc_notes_place_local_alternative % will be a setup (wrapper) {\doifnotescollected\currentnote @@ -1577,7 +1577,7 @@ % setups ? -\def\flushlocalnotes#tag{\ctxcommand{flushnotes("#tag","store","\noteparameter\c!criterium")}} +\def\flushlocalnotes#tag{\clf_flushnotes{#tag}{store}{\noteparameter\c!criterium}} \installnotealternative \v!none {\flushlocalnotes\currentnote} @@ -1769,7 +1769,7 @@ %D } %D \stoptyping -\def\doifnoteonsamepageelse[#tag]{\ctxcommand{doifnoteonsamepageasprevious("#tag")}} +\def\doifnoteonsamepageelse[#tag]{\clf_doifnoteonsamepageasprevious{#tag}} %D New trickery: diff --git a/tex/context/base/strc-num.lua b/tex/context/base/strc-num.lua index 15c543b08..0203334ff 100644 --- a/tex/context/base/strc-num.lua +++ b/tex/context/base/strc-num.lua @@ -396,10 +396,8 @@ local function check(name,data,start,stop) end end -counters.reset = reset -counters.set = set -function counters.setown(name,n,value) +local function setown(name,n,value) local cd = counterdata[name] if cd then local d = allocate(name,n) @@ -417,7 +415,7 @@ function counters.setown(name,n,value) end end -function counters.restart(name,n,newstart,noreset) +local function restart(name,n,newstart,noreset) local cd = counterdata[name] if cd then newstart = tonumber(newstart) @@ -445,7 +443,7 @@ function counters.restore(name) end end -function counters.add(name,n,delta) +local function add(name,n,delta) local cd = counterdata[name] if cd and (cd.state == v_start or cd.state == "") then local data = cd.data @@ -514,7 +512,12 @@ local function get(name,n,key) end end -counters.get = get +counters.reset = reset +counters.set = set +counters.add = add +counters.get = get +counters.setown = setown +counters.restart = restart function counters.value(name,n) -- what to do with own return get(name,n or 1,'number') or 0 @@ -600,20 +603,20 @@ end -- -implement { name = "addcounter", actions = counters.add, arguments = { "string", "integer", "integer" } } -implement { name = "setcounter", actions = counters.set, arguments = { "string", 1, "integer" } } -implement { name = "setowncounter", actions = counters.setown, arguments = { "string", 1, "string" } } -implement { name = "restartcounter", actions = counters.restart, arguments = { "string", 1, "integer" } } -implement { name = "resetcounter", actions = counters.reset, arguments = { "string", 1 } } -implement { name = "incrementcounter", actions = counters.add, arguments = { "string", 1, 1 } } -implement { name = "decrementcounter", actions = counters.add, arguments = { "string", 1, -1 } } - -implement { name = "setsubcounter", actions = counters.set, arguments = { "string", "integer", "integer" } } -implement { name = "setownsubcounter", actions = counters.setown, arguments = { "string", "integer", "string" } } -implement { name = "restartsubcounter", actions = counters.restart, arguments = { "string", "integer", "integer" } } -implement { name = "resetsubcounter", actions = counters.reset, arguments = { "string", "integer" } } -implement { name = "incrementsubcounter", actions = counters.add, arguments = { "string", "integer", 1 } } -implement { name = "decrementsubcounter", actions = counters.add, arguments = { "string", "integer", -1 } } +implement { name = "addcounter", actions = add, arguments = { "string", "integer", "integer" } } +implement { name = "setcounter", actions = set, arguments = { "string", 1, "integer" } } +implement { name = "setowncounter", actions = setown, arguments = { "string", 1, "string" } } +implement { name = "restartcounter", actions = restart, arguments = { "string", 1, "integer" } } +implement { name = "resetcounter", actions = reset, arguments = { "string", 1 } } +implement { name = "incrementcounter", actions = add, arguments = { "string", 1, 1 } } +implement { name = "decrementcounter", actions = add, arguments = { "string", 1, -1 } } + +implement { name = "setsubcounter", actions = set, arguments = { "string", "integer", "integer" } } +implement { name = "setownsubcounter", actions = setown, arguments = { "string", "integer", "string" } } +implement { name = "restartsubcounter", actions = restart, arguments = { "string", "integer", "integer" } } +implement { name = "resetsubcounter", actions = reset, arguments = { "string", "integer" } } +implement { name = "incrementsubcounter", actions = add, arguments = { "string", "integer", 1 } } +implement { name = "decrementsubcounter", actions = add, arguments = { "string", "integer", -1 } } implement { name = "rawcountervalue", actions = { counters.raw , context }, arguments = { "string", 1 } } implement { name = "countervalue", actions = { counters.value , context }, arguments = { "string", 1 } } @@ -634,8 +637,8 @@ implement { name = "subsubcountervalues", actions = { counters.subs , con implement { name = "savecounter", actions = counters.save, arguments = "string" } implement { name = "restorecounter", actions = counters.restore, arguments = "string" } -implement { name = "incrementedcounter", actions = { counters.add, context }, arguments = { "string", 1, 1 } } -implement { name = "decrementedcounter", actions = { counters.add, context }, arguments = { "string", 1, -1 } } +implement { name = "incrementedcounter", actions = { add, context }, arguments = { "string", 1, 1 } } +implement { name = "decrementedcounter", actions = { add, context }, arguments = { "string", 1, -1 } } implement { name = "showcounter", actions = showcounter, arguments = "string" } -- todo implement { name = "checkcountersetup", actions = checkcountersetup, arguments = { "string", "integer", "integer", "string" } } diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index bd736f249..8cee9c3b0 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -54,7 +54,7 @@ \edef\p_start{\counterparameter\c!start}% \clf_definecounter name {\currentcounter}% - start \ifx\p_start\empty\zerocount\else\p_start\fi + start \ifx\p_start\empty\zerocount\else\numexpr\p_start\relax\fi counter {\counterparameter\s!counter}% method {\counterparameter\c!method}% \relax @@ -70,7 +70,7 @@ \ifx\currentcounter\empty \else \edef\p_number{\counterparameter\c!number}% \ifx\p_number\empty \else - \clf_setcounter{\counterparameter\s!name}\p_number\relax + \clf_setcounter{\counterparameter\s!name}\numexpr\p_number\relax \letcounterparameter\c!number\empty \fi \edef\p_start{\counterparameter\c!start}% @@ -241,26 +241,26 @@ \expandafter\gobbleoneoptional \fi} -\def\strc_counters_set_two [#1][#2][#3]{\clf_setsubcounter {\namedcounterparameter{#1}\s!name}#2 #3\relax} -\def\strc_counters_setown_two [#1][#2][#3]{\clf_setownsubcounter {\namedcounterparameter{#1}\s!name}#2{#3}} -\def\strc_counters_restart_two [#1][#2][#3]{\clf_restartsubcounter {\namedcounterparameter{#1}\s!name}#2 #3\relax} -\def\strc_counters_reset_two [#1][#2]{\clf_resetsubcounter {\namedcounterparameter{#1}\s!name}#2\relax} -\def\strc_counters_increment_two [#1][#2]{\clf_incrementsubcounter {\namedcounterparameter{#1}\s!name}#2\relax} -\def\strc_counters_decrement_two [#1][#2]{\clf_decrementsubcounter {\namedcounterparameter{#1}\s!name}#2\relax} - -\def\strc_counters_raw_two [#1][#2]{\clf_subcountervalue {\namedcounterparameter{#1}\s!name}#2 } -\def\strc_counters_last_two [#1][#2]{\clf_lastsubcountervalue {\namedcounterparameter{#1}\s!name}#2 } -\def\strc_counters_first_two [#1][#2]{\clf_firstsubcountervalue {\namedcounterparameter{#1}\s!name}#2 } -\def\strc_counters_next_two [#1][#2]{\clf_nextsubcountervalue {\namedcounterparameter{#1}\s!name}#2 } -\def\strc_counters_prev_two [#1][#2]{\clf_previoussubcountervalue{\namedcounterparameter{#1}\s!name}#2 } -\def\strc_counters_subs_two [#1][#2]{\clf_subsubcountervalues {\namedcounterparameter{#1}\s!name}#2 } - -\def\strc_counters_set_one [#1][#2][#3]{\clf_setcounter {\namedcounterparameter{#1}\s!name}#2\relax} +\def\strc_counters_set_two [#1][#2][#3]{\clf_setsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax\numexpr#3\relax} +\def\strc_counters_setown_two [#1][#2][#3]{\clf_setownsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax{#3}} +\def\strc_counters_restart_two [#1][#2][#3]{\clf_restartsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax\numexpr#3\relax} +\def\strc_counters_reset_two [#1][#2]{\clf_resetsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\def\strc_counters_increment_two [#1][#2]{\clf_incrementsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\def\strc_counters_decrement_two [#1][#2]{\clf_decrementsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} + +\def\strc_counters_raw_two [#1][#2]{\clf_subcountervalue {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\def\strc_counters_last_two [#1][#2]{\clf_lastsubcountervalue {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\def\strc_counters_first_two [#1][#2]{\clf_firstsubcountervalue {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\def\strc_counters_next_two [#1][#2]{\clf_nextsubcountervalue {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\def\strc_counters_prev_two [#1][#2]{\clf_previoussubcountervalue{\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\def\strc_counters_subs_two [#1][#2]{\clf_subsubcountervalues {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} + +\def\strc_counters_set_one [#1][#2][#3]{\clf_setcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} \def\strc_counters_setown_one [#1][#2][#3]{\clf_setowncounter {\namedcounterparameter{#1}\s!name}{#2}} -\def\strc_counters_restart_one [#1][#2][#3]{\clf_restartcounter {\namedcounterparameter{#1}\s!name}#2\relax} -\def\strc_counters_reset_one [#1][#2]{\clf_resetcounter {\namedcounterparameter{#1}\s!name}\relax} -\def\strc_counters_increment_one [#1][#2]{\clf_incrementcounter {\namedcounterparameter{#1}\s!name}\relax} -\def\strc_counters_decrement_one [#1][#2]{\clf_decrementcounter {\namedcounterparameter{#1}\s!name}\relax} +\def\strc_counters_restart_one [#1][#2][#3]{\clf_restartcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\def\strc_counters_reset_one [#1][#2]{\clf_resetcounter {\namedcounterparameter{#1}\s!name}} +\def\strc_counters_increment_one [#1][#2]{\clf_incrementcounter {\namedcounterparameter{#1}\s!name}} +\def\strc_counters_decrement_one [#1][#2]{\clf_decrementcounter {\namedcounterparameter{#1}\s!name}} \def\strc_counters_raw_one [#1][#2]{\clf_countervalue {\namedcounterparameter{#1}\s!name}} \def\strc_counters_last_one [#1][#2]{\clf_lastcountervalue {\namedcounterparameter{#1}\s!name}} @@ -272,12 +272,12 @@ \def\strc_counters_save_one [#1]{\clf_savecounter {\namedcounterparameter{#1}\s!name}} \def\strc_counters_restore_one [#1]{\clf_restorecounter {\namedcounterparameter{#1}\s!name}} -\unexpanded\def\strc_counters_set #1#2{\clf_setcounter {\namedcounterparameter{#1}\s!name}#2\relax} +\unexpanded\def\strc_counters_set #1#2{\clf_setcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} \unexpanded\def\strc_counters_setown #1#2{\clf_setowncounter {\namedcounterparameter{#1}\s!name}{#2}} -\unexpanded\def\strc_counters_restart #1#2{\clf_restartcounter {\namedcounterparameter{#1}\s!name}#2\relax} -\unexpanded\def\strc_counters_reset #1{\clf_resetcounter {\namedcounterparameter{#1}\s!name}\relax} -\unexpanded\def\strc_counters_increment #1{\clf_incrementcounter {\namedcounterparameter{#1}\s!name}\relax} -\unexpanded\def\strc_counters_decrement #1{\clf_decrementcounter {\namedcounterparameter{#1}\s!name}\relax} +\unexpanded\def\strc_counters_restart #1#2{\clf_restartcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\unexpanded\def\strc_counters_reset #1{\clf_resetcounter {\namedcounterparameter{#1}\s!name}} +\unexpanded\def\strc_counters_increment #1{\clf_incrementcounter {\namedcounterparameter{#1}\s!name}} +\unexpanded\def\strc_counters_decrement #1{\clf_decrementcounter {\namedcounterparameter{#1}\s!name}} \def\strc_counters_raw #1{\clf_countervalue {\namedcounterparameter{#1}\s!name}} \def\strc_counters_last #1{\clf_lastcountervalue {\namedcounterparameter{#1}\s!name}} @@ -286,19 +286,19 @@ \def\strc_counters_prev #1{\clf_previouscountervalue {\namedcounterparameter{#1}\s!name}} \def\strc_counters_subs #1{\clf_subcountervalues {\namedcounterparameter{#1}\s!name}} -\unexpanded\def\strc_counters_set_sub #1#2#3{\clf_setsubcounter {\namedcounterparameter{#1}\s!name}#2 #3\relax} -\unexpanded\def\strc_counters_setown_sub #1#2#3{\clf_setownsubcounter {\namedcounterparameter{#1}\s!name}#2{#3}} -\unexpanded\def\strc_counters_restart_sub #1#2#3{\clf_restartsubcounter {\namedcounterparameter{#1}\s!name}#2 #3\relax} -\unexpanded\def\strc_counters_reset_sub #1#2{\clf_resetsubcounter {\namedcounterparameter{#1}\s!name}#2\relax} -\unexpanded\def\strc_counters_increment_sub #1#2{\clf_incrementsubcounter {\namedcounterparameter{#1}\s!name}#2\relax} -\unexpanded\def\strc_counters_decrement_sub #1#2{\clf_decrementsubcounter {\namedcounterparameter{#1}\s!name}#2\relax} +\unexpanded\def\strc_counters_set_sub #1#2#3{\clf_setsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax\numexpr#3\relax} +\unexpanded\def\strc_counters_setown_sub #1#2#3{\clf_setownsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax{#3}} +\unexpanded\def\strc_counters_restart_sub #1#2#3{\clf_restartsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax\numexpr#3\relax} +\unexpanded\def\strc_counters_reset_sub #1#2{\clf_resetsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\unexpanded\def\strc_counters_increment_sub #1#2{\clf_incrementsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} +\unexpanded\def\strc_counters_decrement_sub #1#2{\clf_decrementsubcounter {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} - \def\strc_counters_raw_sub #1#2{\clf_subcountervalue {\namedcounterparameter{#1}\s!name}#2 } % maybe raw - \def\strc_counters_last_sub #1#2{\clf_lastsubcountervalue {\namedcounterparameter{#1}\s!name}#2 } - \def\strc_counters_first_sub #1#2{\clf_firstsubcountervalue {\namedcounterparameter{#1}\s!name}#2 } - \def\strc_counters_next_sub #1#2{\clf_nextsubcountervalue {\namedcounterparameter{#1}\s!name}#2 } - \def\strc_counters_prev_sub #1#2{\clf_previoussubcountervalue{\namedcounterparameter{#1}\s!name}#2 } - \def\strc_counters_subs_sub #1#2{\clf_subsubcountervalues {\namedcounterparameter{#1}\s!name}#2 } + \def\strc_counters_raw_sub #1#2{\clf_subcountervalue {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} % maybe raw + \def\strc_counters_last_sub #1#2{\clf_lastsubcountervalue {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} + \def\strc_counters_first_sub #1#2{\clf_firstsubcountervalue {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} + \def\strc_counters_next_sub #1#2{\clf_nextsubcountervalue {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} + \def\strc_counters_prev_sub #1#2{\clf_previoussubcountervalue{\namedcounterparameter{#1}\s!name}\numexpr#2\relax} + \def\strc_counters_subs_sub #1#2{\clf_subsubcountervalues {\namedcounterparameter{#1}\s!name}\numexpr#2\relax} \unexpanded\def\strc_counters_save #1{\clf_savecounter {\namedcounterparameter{#1}\s!name}} \unexpanded\def\strc_counters_restore #1{\clf_restorecounter {\namedcounterparameter{#1}\s!name}} @@ -338,7 +338,7 @@ \strc_counters_reset{#1}% \fi \fi - \clf_incrementsubcounter{\namedcounterparameter{#1}\s!name}#2\relax} + \clf_incrementsubcounter{\namedcounterparameter{#1}\s!name}\numexpr#2\relax} \unexpanded\def\convertedcounter {\dodoubleempty\strc_counters_converted} diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index a4084187f..759941c85 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -175,71 +175,6 @@ \setnextinternalreference \storeinternalreference\currentstructurename\nextinternalreference % \strc_sectioning_set_reference_prefix -% \ctxcommand{% todo: combine with next call, adapt marks accordingly -% setsectionentry{ -% references = { -% internal = \nextinternalreference, -% block = "\currentsectionblock", -% reference = "\currentstructurereference", -% referenceprefix = "\currentstructurereferenceprefix", -% backreference = "\currentstructurebackreference", -% }, -% directives = { -% resetset = "\structureparameter\c!sectionresetset", -% }, -% metadata = { -% kind = "section", -% name = "\currentstructurename", -% catcodes = \the\ifx\currentstructurecatcodes\empty\catcodetable\else\csname\currentstructurecatcodes\endcsname\fi, -% coding = "\currentstructurecoding", -% \ifx\currentstructurecoding\s!xml -% xmlroot = "\xmldocument", -% \fi -% \ifx\currentstructurexmlsetup\empty \else -% xmlsetup = "\currentstructurexmlsetup", -% \fi -% \ifx\currentstructuresaveinlist\v!no -% nolist = true, -% \fi -% \ifx\currentstructureincrementnumber\v!yes -% increment = "\currentstructureincrementnumber", -% \fi -% }, -% titledata = { % we can add mark and reference -% label = \!!bs\detokenize\expandafter{\currentstructurelabel }\!!es, -% title = \!!bs\detokenize\expandafter{\currentstructuretitle }\!!es, -% \ifx\currentstructurebookmark\currentstructuretitle \else -% bookmark = \!!bs\detokenize\expandafter{\currentstructurebookmark }\!!es, -% \fi -% \ifx\currentstructuremarking\currentstructuretitle \else -% marking = \!!bs\detokenize\expandafter{\currentstructuremarking }\!!es, -% \fi -% \ifx\currentstructuresaveinlist\v!no \else -% \ifx\currentstructurelist\currentstructuretitle \else -% list = \!!bs\detokenize\expandafter{\currentstructurelist}\!!es, -% \fi -% \fi -% }, -% numberdata = { -% % needed ? -% block = "\currentsectionblock", -% \ifx\currentstructureshownumber\v!no -% hidenumber = true, % titles -% \fi -% % so far -% separatorset = "\structureparameter\c!sectionseparatorset", -% conversion = "\structureparameter\c!sectionconversion", % for good old times sake -% conversionset = "\structureparameter\c!sectionconversionset", -% starter = \!!bs\structureparameter\c!sectionstarter\!!es, -% stopper = \!!bs\structureparameter\c!sectionstopper\!!es, -% set = "\structureparameter\c!sectionset", -% segments = "\structureparameter\c!sectionsegments", -% ownnumber = "\currentstructureownnumber", -% language = "\currentlanguage", % for the moment, needed for bookmarks conversion -% }, -% userdata = \!!bs\detokenize{#3}\!!es % will be converted to table at the lua end -% } -% }% \clf_setsectionentry references { internal \nextinternalreference\space diff --git a/tex/context/base/toks-ini.lua b/tex/context/base/toks-ini.lua index 0cd25a36c..f8b945890 100644 --- a/tex/context/base/toks-ini.lua +++ b/tex/context/base/toks-ini.lua @@ -68,7 +68,13 @@ if newtoken then local set_macro = newtoken.set_macro - set_macro = function(k,v) context.setvalue(k,v or '') end + set_macro = function(k,v,g) + if g == "global" then + context.setgvalue(k,v or '') + else + context.setvalue(k,v or '') + end + end local bits = { escape = 2^ 0, diff --git a/tex/context/base/typo-cap.lua b/tex/context/base/typo-cap.lua index fdc7740de..80a74bac9 100644 --- a/tex/context/base/typo-cap.lua +++ b/tex/context/base/typo-cap.lua @@ -432,4 +432,8 @@ end -- interface -commands.setcharactercasing = cases.set +interfaces.implement { + name = "setcharactercasing", + actions = cases.set, + arguments = { "string", "integer" } +} diff --git a/tex/context/base/typo-cap.mkiv b/tex/context/base/typo-cap.mkiv index eef4951fb..2859ba104 100644 --- a/tex/context/base/typo-cap.mkiv +++ b/tex/context/base/typo-cap.mkiv @@ -77,7 +77,7 @@ % test \Word{test TEST \TeX} test \unexpanded\def\setcharactercasing[#1]% - {\ctxcommand{setcharactercasing("#1",\number\fontid\font)}} + {\clf_setcharactercasing{#1}\fontid\font} % todo: names casings @@ -166,21 +166,15 @@ % % here we keep the \groupedcommand -% \def\typo_capitals_set_fake#1% -% {\edef\currentcapitals{#1}% -% \scratchcounter\fontid\font -% \usecapitalsstyleparameter\c!style -% \ctxcommand{setcharactercasing("\currentcapitals",\number\scratchcounter,\number\fontid\font)}} - \def\typo_capitals_set_fake#1% {\edef\currentcapitals{#1}% - \ctxcommand{setcharactercasing("\currentcapitals",\number\fontid\font)}% + \clf_setcharactercasing{\currentcapitals}\fontid\font \usecapitalsstyleparameter\c!style} \def\typo_capitals_set_real#1% {\edef\currentcapitals{#1}% \sc - \ctxcommand{setcharactercasing("\currentcapitals",\number\fontid\font)}} + \clf_setcharactercasing{\currentcapitals}\fontid\font} \unexpanded\def\pseudosmallcapped{\groupedcommand{\typo_capitals_set_fake\v!WORD }\donothing} % all upper \unexpanded\def\pseudoSmallcapped{\groupedcommand{\typo_capitals_set_fake\v!capital}\donothing} % one upper + font diff --git a/tex/context/base/typo-chr.lua b/tex/context/base/typo-chr.lua index 87cffa7d4..073574218 100644 --- a/tex/context/base/typo-chr.lua +++ b/tex/context/base/typo-chr.lua @@ -72,13 +72,19 @@ if not modules then modules = { } end modules ['typo-chr'] = { -- -- local enabled = false -- --- function commands.signal(what) +-- local function signal(what) -- if not enabled then -- nodes.tasks.prependaction("processors","normalizers", "typesetters.signals.handler") -- enabled = true -- end -- context(stringusernode(signal,what)) -- end +-- +-- interfaces.implement { +-- name = "signal", +-- actions = signal, +-- arguments = "string", +-- } local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph @@ -88,7 +94,7 @@ local free_node = node.free local punctuation = characters.is_punctuation -function commands.removepunctuation() +local function removepunctuation() local list = texnest[texnest.ptr] if list then local tail = list.tail @@ -102,3 +108,8 @@ function commands.removepunctuation() end end end + +interfaces.implement { + name = "removepunctuation", + actions = removepunctuation, +} diff --git a/tex/context/base/typo-chr.mkiv b/tex/context/base/typo-chr.mkiv index 138bf348a..23efecb22 100644 --- a/tex/context/base/typo-chr.mkiv +++ b/tex/context/base/typo-chr.mkiv @@ -22,6 +22,6 @@ \registerctxluafile{typo-chr}{1.001} %unexpanded\def\removepunctuation{\ctxcommand{signal("removepunctuation")}} -\unexpanded\def\removepunctuation{\ctxcommand{removepunctuation()}} +\unexpanded\def\removepunctuation{\clf_removepunctuation} \protect diff --git a/tex/context/base/typo-krn.lua b/tex/context/base/typo-krn.lua index 1616577dc..46a977cfd 100644 --- a/tex/context/base/typo-krn.lua +++ b/tex/context/base/typo-krn.lua @@ -622,4 +622,9 @@ end -- interface -commands.setcharacterkerning = kerns.set +interfaces.implement { + name = "setcharacterkerning", + actions = kerns.set, + arguments = "string" +} + diff --git a/tex/context/base/typo-krn.mkiv b/tex/context/base/typo-krn.mkiv index f5f452ae5..e638ab85f 100644 --- a/tex/context/base/typo-krn.mkiv +++ b/tex/context/base/typo-krn.mkiv @@ -35,13 +35,10 @@ \typo_kerning_set \fi} -% \def\typo_kerning_set -% {\ctxcommand{setcharacterkerning(\characterkerningparameter\c!factor)}} - \def\typo_kerning_set {\usecharacterkerningstyleandcolor\c!style\c!color % goodie, maybe also strut \useaddfontfeatureparameter\characterkerningparameter - \ctxcommand{setcharacterkerning("\characterkerningparameter\c!factor")}} + \clf_setcharacterkerning{\characterkerningparameter\c!factor}} \unexpanded\def\resetcharacterkerning % fast one {\attribute\kernattribute\attributeunsetvalue} diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua index 7defd3387..5914c3c69 100644 --- a/tex/context/base/x-asciimath.lua +++ b/tex/context/base/x-asciimath.lua @@ -758,45 +758,67 @@ local issimplified = { -- special mess -local d_one = lpeg.R("09") -local d_two = d_one * d_one -local d_three = d_two * d_one -local d_spaced = (Carg(1) * d_three)^1 -local d_split = P(-1) + P(",") - -local digitized = Cs(( - d_three * d_spaced * d_split + - d_two * d_spaced * d_split + - d_one * d_spaced * d_split + - P(1) - )^1) - --- print(lpeg.match(digitized,"1")) --- print(lpeg.match(digitized,"12")) --- print(lpeg.match(digitized,"123")) --- print(lpeg.match(digitized,"1234")) --- print(lpeg.match(digitized,"12345")) --- print(lpeg.match(digitized,"123456")) --- print(lpeg.match(digitized,"1234567")) --- print(lpeg.match(digitized,"12345678")) --- print(lpeg.match(digitized,"123456789")) - --- print(lpeg.match(digitized,"1,1")) --- print(lpeg.match(digitized,"12,12")) --- print(lpeg.match(digitized,"123,123")) --- print(lpeg.match(digitized,"1234,1234")) --- print(lpeg.match(digitized,"12345,12345")) --- print(lpeg.match(digitized,"123456,123456")) --- print(lpeg.match(digitized,"1234567,1234567")) --- print(lpeg.match(digitized,"12345678,12345678")) --- print(lpeg.match(digitized,"123456789,123456789")) +local d_one = R("09") +local d_two = d_one * d_one +local d_three = d_two * d_one +local d_four = d_three * d_one +local d_split = P(-1) + P(",") + +local d_spaced = (Carg(1) * d_three)^1 + +local digitized_1 = Cs ( ( + d_three * d_spaced * d_split + + d_two * d_spaced * d_split + + d_one * d_spaced * d_split + + P(1) + )^1 ) + +local p_fourbefore = d_four * d_split +local p_fourafter = d_four * P(-1) + +local p_beforecomma = d_three * d_spaced * d_split + + d_two * d_spaced * d_split + + d_one * d_spaced * d_split + + d_one * d_split + +local p_aftercomma = p_fourafter + + d_three * d_spaced + + d_two * d_spaced + + d_one * d_spaced + +local digitized_2 = Cs ( + p_fourbefore * p_aftercomma + + p_beforecomma * ((p_aftercomma + d_one^1)^0) + ) + +local d_spaced = (Carg(1) * (d_three + d_two + d_one))^1 +local p_aftercomma = p_fourafter + + d_three * d_spaced * P(1)^0 + +local digitized_3 = Cs ( + p_fourbefore * p_aftercomma + + p_beforecomma * ((p_aftercomma + d_one^1)^0) + ) + +local splitmethods = { + digitized_1, + digitized_2, + digitized_3, +} + +local splitmethod = nil function asciimath.setup(settings) - local separator = settings.separator - if separator == interfaces.variables.yes then - digitseparator = utfchar(0x2008) - elseif separator and separator ~= "" then - digitseparator = separator + splitmethod = splitmethods[tonumber(settings.splitmethod) or 0] + if splitmethod then + local separator = settings.separator + if separator == true or not interfaces or interfaces.variables.yes then + digitseparator = utfchar(0x2008) + elseif type(separator) == "string" and separator ~= "" then + digitseparator = separator + else + splitmethod = nil + end end end @@ -804,8 +826,8 @@ local collected_digits = { } local collected_filename = "asciimath-digits.lua" function numbermess(s) - if digitseparator then - local d = lpegmatch(digitized,s,1,digitseparator) + if splitmethod then + local d = lpegmatch(splitmethod,s,1,digitseparator) if d then if trace_digits and s ~= d then collected_digits[s] = d @@ -816,6 +838,29 @@ function numbermess(s) return s end +asciimath.setup { splitmethod = 3 } + +local t = { + "1", "12", "123", "1234", "12345", "123456", "1234567", "12345678", "123456789", + "1,1", + "12,12", + "123,123", + "1234,1234", + "12345,1234", + "1234,12345", + "12345,12345", + "123456,123456", + "1234567,1234567", + "12345678,12345678", + "123456789,123456789", + "0,1234", + "1234,0", + "1234,00", + "0,123456789", +} +for i=1,#t do print(formatters["%-20s : [%s]"](t[i],numbermess(t[i]))) end + + statistics.register("asciimath",function() if trace_digits then local n = table.count(collected_digits) @@ -1762,7 +1807,7 @@ if not context then -- convert("10000,00001") -- convert("4/18*100text(%)~~22,2") -- convert("4/18*100text(%)≈22,2") -convert("62541/(197,6)≈316,05") +-- convert("62541/(197,6)≈316,05") -- convert([[sum x]]) -- convert([[sum^(1)_(2) x]]) diff --git a/tex/context/base/x-asciimath.mkiv b/tex/context/base/x-asciimath.mkiv index 27d19693f..7007893ae 100644 --- a/tex/context/base/x-asciimath.mkiv +++ b/tex/context/base/x-asciimath.mkiv @@ -151,7 +151,8 @@ \appendtoks \ctxlua{moduledata.asciimath.setup { - separator = "\asciimathparameter\c!separator", + splitmethod = "\asciimathparameter\c!splitmethod", + separator = "\asciimathparameter\c!separator", }}% \to \everysetupasciimath diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b97021447..1ae47cf63 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 : 03/26/15 22:52:35 +-- merge date : 03/27/15 21:39:51 do -- begin closure to overcome local limits and interference -- cgit v1.2.3