From 564b126de3c406f7dc430de4fc2863b0309442b0 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sat, 6 Sep 2014 13:15:04 +0200 Subject: 2014-09-06 12:52:00 --- tex/context/base/back-exp.lua | 99 ++++++++++++++------- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4432 -> 4440 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/core-sys.lua | 4 + tex/context/base/core-sys.mkiv | 26 ++++++ tex/context/base/publ-aut.lua | 11 ++- tex/context/base/publ-imp-author.mkvi | 28 +++--- tex/context/base/publ-ini.mkiv | 18 ++-- tex/context/base/status-files.pdf | Bin 25005 -> 25037 bytes tex/context/base/status-lua.pdf | Bin 327119 -> 327163 bytes tex/context/base/trac-log.lua | 10 ++- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 13 files changed, 137 insertions(+), 65 deletions(-) (limited to 'tex') diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 647a9a049..7212f6566 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -2461,7 +2461,7 @@ end do local xmlpreamble = [[ - + @@ -2472,8 +2472,8 @@ local xmlpreamble = [[ local flushtree = wrapups.flushtree - local function wholepreamble() - return format(xmlpreamble,tex.jobname,os.date(),environment.version,exportversion) + local function wholepreamble(standalone) + return format(xmlpreamble,standalone and "yes" or "no",tex.jobname,os.date(),environment.version,exportversion) end @@ -2517,17 +2517,25 @@ local f_category = formatters["/* category: %s */"] local htmltemplate = [[ %preamble% - - + - + + %title% + + + + %style% @@ -2578,36 +2586,63 @@ local htmltemplate = [[ -- > -- ]] +-- local function cleanxhtmltree(xmltree) +-- if xmltree then +-- local xmlwrap = xml.wrap +-- for e in xml.collected(xmltree,"/document") do +-- e.at["xmlns:xhtml"] = "http://www.w3.org/1999/xhtml" +-- break +-- end +-- -- todo: inject xhtmlpreamble (xmlns should have be enough) +-- local wrapper = { tg = "a", ns = "xhtml", at = { href = "unknown" } } +-- for e in xml.collected(xmltree,"link") do +-- local at = e.at +-- local href +-- if at.location then +-- href = "#" .. gsub(at.location,":","_") +-- elseif at.url then +-- href = at.url +-- elseif at.file then +-- href = at.file +-- end +-- if href then +-- wrapper.at.href = href +-- xmlwrap(e,wrapper) +-- end +-- end +-- local wrapper = { tg = "a", ns = "xhtml", at = { name = "unknown" } } +-- for e in xml.collected(xmltree,"!link[@location]") do +-- local location = e.at.location +-- if location then +-- wrapper.at.name = gsub(location,":","_") +-- xmlwrap(e,wrapper) +-- end +-- end +-- return xmltree +-- else +-- return xml.convert('\ninvalid xhtml tree') +-- end +-- end + local function cleanxhtmltree(xmltree) if xmltree then - local xmlwrap = xml.wrap - for e in xml.collected(xmltree,"/document") do - e.at["xmlns:xhtml"] = "http://www.w3.org/1999/xhtml" - break - end - -- todo: inject xhtmlpreamble (xmlns should have be enough) - local wrapper = { tg = "a", ns = "xhtml", at = { href = "unknown" } } for e in xml.collected(xmltree,"link") do local at = e.at - local href if at.location then - href = "#" .. gsub(at.location,":","_") + at.href = "#" .. gsub(at.location,":","_") elseif at.url then - href = at.url + at.href = at.url elseif at.file then - href = at.file - end - if href then - wrapper.at.href = href - xmlwrap(e,wrapper) + at.href = at.file end end - local wrapper = { tg = "a", ns = "xhtml", at = { name = "unknown" } } + local done = { } for e in xml.collected(xmltree,"!link[@location]") do - local location = e.at.location - if location then - wrapper.at.name = gsub(location,":","_") - xmlwrap(e,wrapper) + local at = e.at + local location = at.location + if location and not done[location] then + done[location] = true + at.id = gsub(location,":","_") end end return xmltree @@ -2616,6 +2651,7 @@ local htmltemplate = [[ end end + local f_namespace = string.formatters["%s.%s"] local function remap(specification,source,target) @@ -2762,9 +2798,8 @@ local htmltemplate = [[ local files = { } local x_styles, h_styles = allusedstylesheets(xmlfile,cssfiles,files) - local preamble = wholepreamble() local results = concat { - preamble, + wholepreamble(true), x_styles, -- adds to files result, } @@ -2831,7 +2866,7 @@ local htmltemplate = [[ -- local variables = { -- style = h_styles, -- body = xml.tostring(xml.first(xmltree,"/div")), --- preamble = preamble, +-- preamble = wholepreamble(false), -- title = specification.title, -- } -- local data = utilities.templates.replace(specification.template,variables,"xml") @@ -2846,7 +2881,7 @@ local htmltemplate = [[ local variables = { style = h_styles, body = xml.tostring(xml.first(xmltree,"/div")), - preamble = preamble, + preamble = wholepreamble(false), title = specification.title, } io.savedata(resultfile,utilities.templates.replace(htmltemplate,variables,"xml")) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 4d7bcdd36..18d91da2c 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.09.04 20:30} +\newcontextversion{2014.09.06 12:50} %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 64baada13..7ec9dcdb7 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 b6d117303..14c00e588 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.09.04 20:30} +\edef\contextversion{2014.09.06 12:50} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-sys.lua b/tex/context/base/core-sys.lua index 22b0e457c..3a3a691b0 100644 --- a/tex/context/base/core-sys.lua +++ b/tex/context/base/core-sys.lua @@ -99,3 +99,7 @@ statistics.register("result saved in file", function() return format("%s.%s",outputfilename,"dvi") -- hard to imagine end end) + +function commands.systemlog(whereto,category,text) + logs.system(whereto,"context",tex.jobname,category,text) +end diff --git a/tex/context/base/core-sys.mkiv b/tex/context/base/core-sys.mkiv index b5c630be1..e05c23f0a 100644 --- a/tex/context/base/core-sys.mkiv +++ b/tex/context/base/core-sys.mkiv @@ -401,5 +401,31 @@ % \processcommalist[#1]\docommand % \endgroup} +\unexpanded\def\syst_log_indeed#1#2#3% + {\ctxcommand{systemlog("#1","#2",\!!bs#3\!!es)}} + +\let\systemlog\syst_log_indeed + +\unexpanded\def\systemlogfirst + {\ifcase\directsystemparameter\c!n\relax + \expandafter\syst_log_indeed + \or + \expandafter\syst_log_indeed + \else + \expandafter\gobblethreearguments + \fi} + +\unexpanded\def\systemloglast + {\ifcase\directsystemparameter\c!n\relax + \expandafter\syst_log_indeed + \or + \expandafter\gobblethreearguments + \or + \expandafter\gobblethreearguments + \or + \expandafter\gobblethreearguments + \or + \expandafter\syst_log_indeed + \fi} \protect \endinput diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index 90bb4b3df..28d89f6b5 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -317,6 +317,7 @@ function commands.btxauthor(dataset,tag,field,settings) end local max = split and #split or 0 if max == 0 then + return -- error end local etallimit = tonumber(settings.etallimit) or 1000 @@ -360,13 +361,15 @@ function commands.btxauthor(dataset,tag,field,settings) if juniors and #juniors > 0 then ctx_btxsetjuniors() -- (concat(juniors," ")) end + if i == max then + local overflow = #split - max + if overflow > 0 then + ctx_btxsetoverflow(overflow) + end + end ctx_btxsetup(combiner) ctx_btxstopauthor() end - local overflow = max - #split - if overflow > 0 then - ctx_btxsetoverflow(overflow) - end end -- We can consider creating a hashtable key -> entry but I wonder if diff --git a/tex/context/base/publ-imp-author.mkvi b/tex/context/base/publ-imp-author.mkvi index 29714ec03..bfcae159a 100644 --- a/tex/context/base/publ-imp-author.mkvi +++ b/tex/context/base/publ-imp-author.mkvi @@ -42,9 +42,9 @@ \fi \stopsetups -\startsetups \s!btx:\s!cite:\s!author:etaltext +\startsetups \s!btx:\s!cite:\s!author:others \ifcase\currentbtxoverflow \else - \btxcitevariantparameter\c!etaltext + \btxcitevariantparameter\c!others \fi \stopsetups @@ -67,7 +67,7 @@ \currentbtxjuniors \fi \fi - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups \startsetups \s!btx:\s!cite:\s!author:normalshort @@ -89,7 +89,7 @@ \currentbtxjuniors \fi \fi - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups \startsetups \s!btx:\s!cite:\s!author:inverted @@ -111,7 +111,7 @@ \btxcitevariantparameter\c!surnamefirstnamesep \currentbtxfirstnames \fi - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups \startsetups \s!btx:\s!cite:\s!author:invertedshort @@ -133,7 +133,7 @@ \btxcitevariantparameter\c!surnameinitialsep \currentbtxinitials \fi - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups \startsetups \s!btx:\s!cite:\s!author:name @@ -143,7 +143,7 @@ \btxcitevariantparameter\c!vonsep \fi \currentbtxsurnames - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups % list (mostly the same) @@ -158,9 +158,9 @@ \fi \stopsetups -\startsetups \s!btx:\s!list:\s!author:etaltext +\startsetups \s!btx:\s!list:\s!author:others \ifcase\currentbtxoverflow \else - \btxlistvariantparameter\c!etaltext + \btxlistvariantparameter\c!otherstext \fi \stopsetups @@ -183,7 +183,7 @@ \currentbtxjuniors \fi \fi - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \startsetups \s!btx:\s!list:\s!author:normalshort @@ -205,7 +205,7 @@ \currentbtxjuniors \fi \fi - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \startsetups \s!btx:\s!list:\s!author:inverted @@ -227,7 +227,7 @@ \btxlistvariantparameter\c!surnamefirstnamesep \currentbtxfirstnames \fi - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \startsetups \s!btx:\s!list:\s!author:invertedshort @@ -249,7 +249,7 @@ \btxlistvariantparameter\c!surnameinitialsep \currentbtxinitials \fi - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \startsetups \s!btx:\s!list:\s!author:name @@ -259,7 +259,7 @@ \btxlistvariantparameter\c!vonsep \fi \currentbtxsurnames - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \protect diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 515b80652..46fe46543 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -1143,11 +1143,11 @@ % \c!setups=btx:cite:initialize, \c!alternative=num, \c!authorconversion=\v!normal, - \c!andtext={ \btxlabeltext{and} }, - \c!otherstext={ \btxlabeltext{others}}, + \c!andtext={ \btxlabeltext{\currentbtxalternative:and} }, + \c!otherstext={ \btxlabeltext{\currentbtxalternative:others}}, \c!pubsep={, }, - \c!lastpubsep={ \btxlabeltext{and} }, - \c!finalpubsep={ \btxlabeltext{and} }, + \c!lastpubsep={ \btxlabeltext{\currentbtxalternative:and} }, + \c!finalpubsep={ \btxlabeltext{\currentbtxalternative:and} }, \c!compress=\v!no, \c!inbetween={ }, \c!range=\endash, @@ -1274,9 +1274,10 @@ \setupbtxlistvariant [\c!namesep={, }, - \c!lastnamesep={ \btxlabeltext{and} }, - \c!finalnamesep={ \btxlabeltext{and} }, + \c!lastnamesep={ \btxlabeltext{\currentbtxalternative:and} }, + \c!finalnamesep={ \btxlabeltext{\currentbtxalternative:and} }, \c!firstnamesep={ }, + \c!otherstext={ \btxlabeltext{\currentbtxalternative:others}}, \c!juniorsep={ }, \c!vonsep={ }, \c!initialsep={ }, @@ -1284,8 +1285,7 @@ \c!surnameinitialsep={, }, \c!surnamefirstnamesep={, }, \c!etallimit=5, - \c!etaldisplay=5, - \c!etaltext={ \btxlabeltext{others}}, + \c!etaldisplay=\btxlistvariantparameter\c!etallimit, %c!journalconversion=\v!normal, \c!monthconversion=\v!number, \c!authorconversion=\v!normal] @@ -1317,7 +1317,7 @@ \c!surnamefirstnamesep=\btxlistvariantparameter\c!surnamefirstnamesep, \c!etallimit=\btxlistvariantparameter\c!etallimit, \c!etaldisplay=\btxlistvariantparameter\c!etaldisplay, - \c!etaltext=\btxlistvariantparameter\c!etaltext, + \c!otherstext=\btxlistvariantparameter\c!otherstext, \c!monthconversion=\btxlistvariantparameter\c!monthconversion, \c!authorconversion=\v!name] diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index add1bea9d..90d52accd 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 0785cf051..f329fa28e 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/trac-log.lua b/tex/context/base/trac-log.lua index 72f271d9c..8e83bbafa 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -73,6 +73,8 @@ local concat, insert, remove = table.concat, table.insert, table.remove local topattern = string.topattern local next, type, select = next, type, select local utfchar = utf.char +local datetime = os.date +local openfile = io.open local setmetatableindex = table.setmetatableindex local formatters = string.formatters @@ -845,10 +847,12 @@ end -- logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") -- end -function logs.system(whereto,process,jobname,category,...) - local message = formatters["%s %s => %s => %s => %s\r"](os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) +local f_syslog = formatters["%s %s => %s => %s => %s\r"] + +function logs.system(whereto,process,jobname,category,fmt,arg,...) + local message = f_syslog(datetime("%d/%m/%y %H:%m:%S"),process,jobname,category,arg == nil and fmt or format(fmt,arg,...)) for i=1,10 do - local f = io.open(whereto,"a") -- we can consider keeping the file open + local f = openfile(whereto,"a") -- we can consider keeping the file open if f then f:write(message) f:close() diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index dd58ecbd9..29b42d5be 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 : 09/04/14 20:30:55 +-- merge date : 09/06/14 12:50:36 do -- begin closure to overcome local limits and interference -- cgit v1.2.3