summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-09-18 11:17:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-09-18 11:17:00 +0200
commitea8cd771135d573fee6529e62e08468e79b12eab (patch)
treed2f7102bac47807fd3a0cbfeb02a0bb2f6f13a30
parent02d4d3cbde5e1e94e056cdf3b732145a37413fdb (diff)
downloadcontext-ea8cd771135d573fee6529e62e08468e79b12eab.tar.gz
beta 2014.09.18 11:17
-rw-r--r--doc/context/manuals/allkind/mkiv-publications.pdfbin341600 -> 457944 bytes
-rw-r--r--doc/context/manuals/allkind/mkiv-publications.tex124
-rw-r--r--doc/context/scripts/mkiv/mtx-epub.html50
-rw-r--r--doc/context/scripts/mkiv/mtx-epub.man27
-rw-r--r--doc/context/scripts/mkiv/mtx-epub.xml23
-rw-r--r--scripts/context/lua/mtx-epub.lua115
-rw-r--r--scripts/context/lua/mtxrun.lua292
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua292
-rwxr-xr-xscripts/context/stubs/unix/mtxrun292
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua292
-rw-r--r--tex/context/base/back-exp.lua191
-rw-r--r--tex/context/base/back-exp.mkiv2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4441 -> 4385 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua2
-rw-r--r--tex/context/base/export-example.css22
-rw-r--r--tex/context/base/grph-inc.lua2
-rw-r--r--tex/context/base/l-url.lua3
-rw-r--r--tex/context/base/lpdf-epa.lua7
-rw-r--r--tex/context/base/lpdf-ini.lua41
-rw-r--r--tex/context/base/lxml-css.lua14
-rw-r--r--tex/context/base/lxml-tex.lua2
-rw-r--r--tex/context/base/page-sid.mkiv2
-rw-r--r--tex/context/base/publ-fnd.lua29
-rw-r--r--tex/context/base/publ-imp-aps.mkvi40
-rw-r--r--tex/context/base/status-files.pdfbin25043 -> 24768 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin327160 -> 324988 bytes
-rw-r--r--tex/context/base/strc-def.mkiv16
-rw-r--r--tex/context/base/trac-log.lua365
-rw-r--r--tex/context/base/util-str.lua2
-rw-r--r--tex/context/base/x-cals.lua6
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua4
33 files changed, 1554 insertions, 707 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf
index 81b9537d9..b00659d04 100644
--- a/doc/context/manuals/allkind/mkiv-publications.pdf
+++ b/doc/context/manuals/allkind/mkiv-publications.pdf
Binary files differ
diff --git a/doc/context/manuals/allkind/mkiv-publications.tex b/doc/context/manuals/allkind/mkiv-publications.tex
index 837d531b5..3ea6d61a7 100644
--- a/doc/context/manuals/allkind/mkiv-publications.tex
+++ b/doc/context/manuals/allkind/mkiv-publications.tex
@@ -46,6 +46,8 @@
% todo: doi and url
+% do etallimit etaldisplay
+
\enablemode[export]
% criterium: all + sorttype=cite => citex before rest
@@ -55,6 +57,8 @@
% \enabletrackers[publications*]
+% \enabletrackers[publications.cite.match]
+
\dontcomplain
\setupbtxlistvariant [interaction=start]
@@ -76,6 +80,13 @@
\stopmode
+% todo: startdocument
+
+\setupinteraction
+ [title=BibTeX,
+ subtitle=The ConTeXt Way,
+ author=Hans Hagen]
+
\loadsetups[publications-en.xml] \enablemode[interface:setup:defaults]
% \input publ-tmp.mkiv
@@ -1443,6 +1454,80 @@ suffix, you can do this:
\usebtxdataset[standard][myformat::myfile.txt]
\stoptyping
+If you want to add information to an entry at runtime you can pass so called user
+variables with the \type {\cite} command. The following example demonstrates
+this. First we define a dataset:
+
+\startbuffer
+\startbuffer [knuth]
+@Book{knuth-texbook,
+ title = {The TeXbook},
+ author = {Knuth, Donald Ervin},
+ isbn = {0-201-13447-0},
+ series = {Computers {\&} Typesetting},
+ volume = {A},
+ year = {1986},
+ publisher = {Addison Wesley},
+ address = {Reading, MA},
+}
+\stopbuffer
+
+\definebtxdataset[knuth]
+\usebtxdataset [knuth] [knuth.buffer]
+\definebtxrendering[knuth][dataset=knuth]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer[setup]
+\startsetups btx:apa:lefttext
+ \currentbtxlefttext
+ \btxspace
+ \btxdoifelseuservariable {notabene} {
+ {\bs \currentbtxuservariable{notabene}}
+ } {
+ % nothing
+ }
+ \btxspace
+\stopsetups
+\stopbuffer
+
+\getbuffer[setup]
+
+\startbuffer
+We all know the \TeX book by Don Knuth \citation [reference=knuth::knuth-texbook,
+lefttext={\bf >}] [notabene=Well known to \TEX\ users:].
+\stopbuffer
+
+We use this example where we use \type {\citation} instead of \type {\cite} because
+it is more tolerant with spaces. Because we pass user variables as second argument
+the first argument also has to be a key|/|value set.
+
+\typebuffer
+
+\blank \getbuffer \blank
+
+The list is typeset using:
+
+\startbuffer
+\placelistofpublications [knuth] [criterium=all]
+\stopbuffer
+
+\typebuffer
+
+and looks like this:
+
+\blank \getbuffer
+
+The injection of the user variables is up to you. Here we hooked it into an
+existing setup that we overload:
+
+\typebuffer[setup]
+
+The \type {lefttext} and \type {righttext} variables are also kept with the
+entry but these are checked for automatically. In this case it means that
+when no \type {lefttext} is specified, the \type {notabene} doesn't show up.
+
\stopchapter
\startchapter[title=Searching]
@@ -1612,6 +1697,9 @@ efficient.
The advantage of the more verbose ones is that you can use manipulators to
process them. This might come in handy when a database is inconsistent.
+The two parameters \type {etallimit} and \type {etaldisplay} control the
+maximum number of authors displayed ({\em these names can change}).
+
\stopchapter
\startchapter[title=Journals]
@@ -1727,19 +1815,19 @@ which shows the two entries pasted together:
As demonstration we also specified the separator although that one is already
set up by default.
-You can combine citations with additional text before and|/|or after it. This can
-be done per citation. This feature is of course not that useful, as one can
-put text before and after a citation anyway.
-
-\startbuffer
-foo bar \citation [before=<<,after=>>] [graph::Cleveland1993] foo bar
-\stopbuffer
-
-\typebuffer
-
-Gives:
-
-\blank \getbuffer \blank
+% You can combine citations with additional text before and|/|or after it. This can
+% be done per citation. This feature is of course not that useful, as one can
+% put text before and after a citation anyway.
+%
+% \startbuffer
+% foo bar \citation [before=<<,after=>>] [graph::Cleveland1993] foo bar
+% \stopbuffer
+%
+% \typebuffer
+%
+% Gives:
+%
+% \blank \getbuffer \blank
\stopchapter
@@ -1832,7 +1920,7 @@ categrories are rendered with a setup we can do the following:
\egroup
\stopsetups
-\placebtxrendering[duane]
+\placebtxrendering[duane][criterium=all]
\stopbuffer
\typebuffer \getbuffer
@@ -1995,16 +2083,20 @@ some benefits but also some drawbacks.
\startchapter[title=APA files]
-Here are the possible fields per category for APA:
+Here are the possible fields per category for APA: \footnote{Currently we show
+\type {publ-imp-test.bib} as we need to check things first.}
\definebtxdataset[apadef]
-\usebtxdataset[apadef][publ-imp-apa.bib]
+% \usebtxdataset[apadef][publ-imp-apa.bib]
+\usebtxdataset[apadef][\cldcontext{resolvers.findfile("publ-imp-test.bib")}]
\showbtxdatasetcompleteness[apadef]
\stopchapter
\stopbodymatter
+\writestatus{!!!!!!}{CHECK HYPHENS}
+
\stoptext
Todo:
diff --git a/doc/context/scripts/mkiv/mtx-epub.html b/doc/context/scripts/mkiv/mtx-epub.html
deleted file mode 100644
index 69d927b1d..000000000
--- a/doc/context/scripts/mkiv/mtx-epub.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<!-- compare with lmx framework variant -->
-
-<!--
- filename : context-base.xml
- comment : companion to mtx-server-ctx-startup.tex
- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
- copyright: PRAGMA ADE / ConTeXt Development Team
- license : see context related readme files
--->
-
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <title>ConTeXt EPUB Helpers 1.00</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <style type="text/css">
- body { color: #FFFFFF; background-color: #808080; font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans; font-size: 12px; line-height: 18px; } a:link, a:active, a:visited { color: #FFFFFF; } a.dir-view:link, a.dir-view:active, a.dir-view:visited { color: #FFFFFF; text-decoration: underline; } .valid { color: #00FF00; } .invalid { color: #FF0000; } button, .commonlink, .smallbutton { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; border-color: #7F7F7F; border-style: solid; border-width: .125ex; background-color: #FFFFFF; padding: .5ex; } .smallbutton { width: 1em; } a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; } h1, .title { font-style: normal; font-weight: normal; font-size: 18px; line-height: 18px; margin-bottom: 20px; } h2, .subtitle { font-style: normal; font-weight: normal; font-size: 12px; margin-top: 18px; margin-bottom: 18px; } table { line-height: 18px; font-size: 12px; margin: 0; } th { font-weight: bold; text-align: left; padding-bottom: 6px; } .tc { font-weight: bold; text-align: left; } p, li { max-width: 60em; } .empty-line { margin-top: 4px; } .more-room { margin-right: 1.5em; } .much-more-room { margin-right: 3em; } #main { position: absolute; left: 10%; top: 10%; right: 10%; bottom: 10%; z-index: 2; width: 80%; height: 80%; padding: 0%; margin: 0%; overflow: auto; border-style: none; border-width: 0; background-color: #3F3F3F; } #main-settings { margin: 12px; x_max-width: 60em; line-height: 18px; font-size: 12px; } #left { position: absolute; top : 10%; left: 0%; bottom: 0%; right: 90%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; } #right { position: absolute; top : 0%; left: 90%; bottom: 10%; right: 0%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; _margin-left: -15px; } #bottom { position: absolute; left: 10%; right: 0%; top: 90%; bottom: 0%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top { position: absolute; left: 0%; right: 10%; top: 0%; bottom: 90%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #top-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: right; vertical-align: middle; } #bottom-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #bottom-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: left; vertical-align: middle; } #left-one { position: absolute; width: 100%; buggedheight: 100%; } #left-two { position: relative; margin-top: 12px; line-height: 18px; text-align: center; vertical-align: top; } #right-one { display: table; height: 100%; width: 100%; } #right-two { display: table-row; height: 100%; width: 100%; } #right-three { display: table-cell; width: 100%; vertical-align: bottom; _position: absolute; _top: 100%; } #right-four { text-align: center; margin-bottom: 2ex; _position: relative; _top: -100%; } #more-top { position: absolute; top: 0%; left: 90%; bottom: 90%; right: 0%; z-index: 3; width: 10%; height: 10%; padding: 0%; margin: 0%; border-style: none; border-width: 0; } #more-top-settings { text-align: center; } #more-right-settings { margin-right: 12px; margin-left: 12px; line-height: 18px; font-size: 10px; text-align: center; } #right-safari { _display: table; width: 100%; height: 100%; }
- </style>
- <style type="text/css">
- </style>
- </head>
- <body>
- <div id="top"> <div id="top-one">
- <div id="top-two">ConTeXt EPUB Helpers 1.00 </div>
- </div>
- </div>
- <div id="bottom"> <div id="bottom-one">
- <div id="bottom-two">wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl</div>
- </div>
- </div>
- <div id="left"></div>
- <div id="right"></div>
- <div id="main">
- <div id='main-settings'>
- <h1>Command line options</h1>
-<table>
- <tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr>
- <tr><th/><td/><td/></tr>
- <tr><th>--make</th><td></td><td>create epub zip file</td></tr>
- </table>
-<br/>
-<h1>Example</h1>
-<tt>mtxrun --script epub --make mydocument</tt>
-<br/><br/> </div>
- </div>
- </body>
- </html>
diff --git a/doc/context/scripts/mkiv/mtx-epub.man b/doc/context/scripts/mkiv/mtx-epub.man
deleted file mode 100644
index 4d42523fe..000000000
--- a/doc/context/scripts/mkiv/mtx-epub.man
+++ /dev/null
@@ -1,27 +0,0 @@
-.TH "mtx-epub" "1" "01-01-2014" "version 1.00" "ConTeXt EPUB Helpers"
-.SH NAME
-.B mtx-epub
-.SH SYNOPSIS
-.B mtxrun --script epub [
-.I OPTIONS ...
-.B ] [
-.I FILENAMES
-.B ]
-.SH DESCRIPTION
-.B ConTeXt EPUB Helpers
-.SH OPTIONS
-.TP
-.B --make
-create epub zip file
-.SH AUTHOR
-More information about ConTeXt and the tools that come with it can be found at:
-
-
-.B "maillist:"
-ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
-
-.B "webpage:"
-http://www.pragma-ade.nl / http://tex.aanhet.net
-
-.B "wiki:"
-http://contextgarden.net
diff --git a/doc/context/scripts/mkiv/mtx-epub.xml b/doc/context/scripts/mkiv/mtx-epub.xml
deleted file mode 100644
index 4a9160fbc..000000000
--- a/doc/context/scripts/mkiv/mtx-epub.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-<application>
- <metadata>
- <entry name="name">mtx-epub</entry>
- <entry name="detail">ConTeXt EPUB Helpers</entry>
- <entry name="version">1.00</entry>
- </metadata>
- <flags>
- <category name="basic">
- <subcategory>
- <flag name="make"><short>create epub zip file</short></flag>
- </subcategory>
- </category>
- </flags>
- <examples>
- <category>
- <title>Example</title>
- <subcategory>
- <example><command>mtxrun --script epub --make mydocument</command></example>
- </subcategory>
- </category>
- </examples>
-</application>
diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua
index a15058e4d..094d589b5 100644
--- a/scripts/context/lua/mtx-epub.lua
+++ b/scripts/context/lua/mtx-epub.lua
@@ -248,18 +248,26 @@ local idmakers = {
-- }
-- }
-local function locateimages(oldname,newname,subpath)
+local function relocateimages(imagedata,oldname,newname,subpath)
local data = io.loaddata(oldname)
local images = { }
- local done = gsub(data,"(background%-image *: * url%()(.-)(%))", function(before,name,after)
- if subpath then
- name = file.join(subpath,name)
+ local done = gsub(data,[[(id=")(.-)(".-background%-image *: * url%()(.-)(%))]], function(s1,id,s2,name,s3)
+ local newname = imagedata[id].newname
+ if newname then
+ if subpath then
+ name = file.join(subpath,file.basename(new name))
+ else
+ name = file.basename(newname)
+ end
+ -- name = url.addscheme(name)
end
images[#images+1] = name
- return before .. name .. after
+ if newname then
+ return s1 .. id .. s2 .. name .. s3
+ end
end)
if newname then
- io.savedata(done,newname)
+ io.savedata(newname,done)
end
return images
end
@@ -267,11 +275,13 @@ end
local zippers = {
{
name = "zip",
+ binary = "zip",
uncompressed = "zip %s -X -0 %s",
compressed = "zip %s -X -9 -r %s",
},
{
- name = "7zip (7z)",
+ name = "7z (7zip)",
+ binary = "7z",
uncompressed = "7z a -tzip -mx0 %s %s",
compressed = "7z a -tzip %s %s",
},
@@ -302,16 +312,25 @@ function scripts.epub.make()
return
end
+ -- images: { ... url = location ... }
+
local name = specification.name or file.removesuffix(filename)
local identifier = specification.identifier or ""
local files = specification.files or { file.addsuffix(filename,"xhtml") }
local images = specification.images or { }
local root = specification.root or files[1]
local language = specification.language or "en"
- local creator = specification.author or "context"
+ local creator = "context mkiv"
+ local author = specification.author or "anonymous"
local title = specification.title or name
+ local subtitle = specification.subtitle or ""
local firstpage = specification.firstpage or ""
local lastpage = specification.lastpage or ""
+ local imagefile = specification.imagefile or ""
+
+ if subtitle ~= "" then
+ title = format("%s, %s",title,subtitle)
+ end
-- identifier = gsub(identifier,"[^a-zA-z0-9]","")
@@ -413,15 +432,31 @@ function scripts.epub.make()
copythem(files)
- local theimages = { }
+ -- ["image-1"]={
+ -- ["height"]="7.056cm",
+ -- ["name"]="file:///t:/sources/cow.svg",
+ -- ["page"]="1",
+ -- ["width"]="9.701cm",
+ -- }
- for k, v in table.sortedpairs(images) do
- theimages[#theimages+1] = k
- if not lfs.isfile(k) and file.suffix(k) == "svg" and file.suffix(v) == "pdf" then
- local command = format("inkscape --export-plain-svg=%s %s",k,v)
+ local theimages = { }
+ local pdftosvg = string.formatters[ [[mudraw -o "%s" "%s" %s]] ]
+
+ for id, data in table.sortedpairs(images) do
+ local name = url.filename(data.name)
+ local used = url.filename(data.used)
+ local base = file.basename(used)
+ local page = data.page or ""
+ if file.suffix(used) == "pdf" then
+ -- todo : check timestamp and prefix, rename to image-*
+ local command = pdftosvg(name,used,page)
application.report("running command %a\n\n",command)
os.execute(command)
+ else
+ name = used
end
+ data.newname = name
+ theimages[#theimages+1] = name
end
used[#used+1] = replace(t_nav, {
@@ -474,41 +509,63 @@ function scripts.epub.make()
end
+ if imagefile ~= "" then
+ local target = file.join(epubpath,"OEBPS",imagefile)
+ application.report("relocating images")
+ relocateimages(images,imagefile,target) -- ,file.join(epubpath,"OEBPS"))
+ end
+
application.report("creating archive\n\n")
lfs.chdir(epubpath)
os.remove(epubfile)
- local done = false
+ local usedzipper = false
- for i=1,#zippers do
- local zipper = zippers[i]
- if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then
+ local function zipped(zipper)
+ local ok = os.execute(format(zipper.uncompressed,epubfile,"mimetype"))
+ if ok == 0 then
os.execute(format(zipper.compressed,epubfile,"META-INF"))
os.execute(format(zipper.compressed,epubfile,"OEBPS"))
- done = zipper.name
- break
+ usedzipper = zipper.name
+ return true
end
end
- lfs.chdir("..")
+ -- nice way
- local treefile = file.join(epubpath,epubfile)
+ for i=1,#zippers do
+ if os.which(zippers[i].binary) and zipped(zippers[i]) then
+ break
+ end
+ end
- os.remove(epubfile)
- file.copy(treefile,epubfile)
- if lfs.isfile(epubfile) then
- os.remove(treefile)
+ -- trial and error
+
+ if not usedzipper then
+ for i=1,#zippers do
+ if zipped(zippers[i]) then
+ break
+ end
+ end
end
- if done then
- application.report("epub archive made using %s: %s",done,epubfile)
+ lfs.chdir("..")
+
+ if usedzipper then
+ local treefile = file.join(epubpath,epubfile)
+ os.remove(epubfile)
+ file.copy(treefile,epubfile)
+ if lfs.isfile(epubfile) then
+ os.remove(treefile)
+ end
+ application.report("epub archive made using %s: %s",usedzipper,epubfile)
else
local list = { }
for i=1,#zippers do
- list[#list+1] = zipper.name
+ list[#list+1] = zippers[i].name
end
- application.report("no epub archive made, install one of: %s",concat(list," "))
+ application.report("no epub archive made, install one of: % | t",list)
end
end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index eae3060bf..b169309a6 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -3644,7 +3644,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-url"] = package.loaded["l-url"] or true
--- original size: 12465, stripped down to: 5710
+-- original size: 12531, stripped down to: 5721
if not modules then modules={} end modules ['l-url']={
version=1.001,
@@ -3813,7 +3813,7 @@ function url.construct(hash)
end
return lpegmatch(escaper,concat(fullurl))
end
-local pattern=Cs(noslash*R("az","AZ")*(S(":|")/":")*noslash*P(1)^0)
+local pattern=Cs(slash^-1/""*R("az","AZ")*((S(":|")/":")+P(":"))*slash*P(1)^0)
function url.filename(filename)
local spec=hashed(filename)
local path=spec.path
@@ -5064,7 +5064,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-str"] = package.loaded["util-str"] or true
--- original size: 34326, stripped down to: 18774
+-- original size: 34327, stripped down to: 18775
if not modules then modules={} end modules ['util-str']={
version=1.001,
@@ -5378,7 +5378,7 @@ local format_f=function(f)
n=n+1
return format("format('%%%sf',a%s)",f,n)
end
-local format_F=function()
+local format_F=function(f)
n=n+1
if not f or f=="" then
return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or format((a%s %% 1 == 0) and '%%i' or '%%.9f',a%s))",n,n,n,n)
@@ -7408,7 +7408,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 25730, stripped down to: 16725
+-- original size: 29350, stripped down to: 20475
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -7417,17 +7417,18 @@ if not modules then modules={} end modules ['trac-log']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+local next,type,select,print=next,type,select,print
local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write
local format,gmatch,find=string.format,string.gmatch,string.find
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
local texgetcount=tex and tex.getcount
+local variant="default"
logs=logs or {}
local logs=logs
local moreinfo=[[
@@ -7437,11 +7438,11 @@ maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
wiki : http://contextgarden.net
]]
-utilities.strings.formatters.add (
+formatters.add (
formatters,"unichr",
[["U+" .. format("%%05X",%s) .. " (" .. utfchar(%s) .. ")"]]
)
-utilities.strings.formatters.add (
+formatters.add (
formatters,"chruni",
[[utfchar(%s) .. " (U+" .. format("%%05X",%s) .. ")"]]
)
@@ -7450,19 +7451,109 @@ setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters
if tex and (tex.jobname or tex.formatname) then
- local valueiskey={ __index=function(t,k) t[k]=k return k end }
- local target="term and log"
+ local function useluawrites()
+ local texio_write_nl=texio.write_nl
+ local texio_write=texio.write
+ local io_write=io.write
+ write_nl=function(target,...)
+ if not io_write then
+ io_write=io.write
+ end
+ if target=="term and log" then
+ texio_write_nl("log",...)
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target=="log" then
+ texio_write_nl("log",...)
+ elseif target=="term" then
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target~="none" then
+ texio_write_nl("log",target,...)
+ texio_write_nl("term","")
+ io_write(target,...)
+ end
+ end
+ write=function(target,...)
+ if not io_write then
+ io_write=io.write
+ end
+ if target=="term and log" then
+ texio_write("log",...)
+ io_write(...)
+ elseif target=="log" then
+ texio_write("log",...)
+ elseif target=="term" then
+ io_write(...)
+ elseif target~="none" then
+ texio_write("log",target,...)
+ io_write(target,...)
+ end
+ end
+ texio.write=write
+ texio.write_nl=write_nl
+ useluawrites=ignore
+ end
+ local whereto="both"
+ local target=nil
+ local targets=nil
+ local formats=table.setmetatableindex("self")
+ local translations=table.setmetatableindex("self")
+ local report_yes,subreport_yes,direct_yes,subdirect_yes,status_yes
+ local report_nop,subreport_nop,direct_nop,subdirect_nop,status_nop
+ local variants={
+ default={
+ formats={
+ report_yes=formatters["%-15s > %s\n"],
+ report_nop=formatters["%-15s >\n"],
+ direct_yes=formatters["%-15s > %s"],
+ direct_nop=formatters["%-15s >"],
+ subreport_yes=formatters["%-15s > %s > %s\n"],
+ subreport_nop=formatters["%-15s > %s >\n"],
+ subdirect_yes=formatters["%-15s > %s > %s"],
+ subdirect_nop=formatters["%-15s > %s >"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ targets={
+ logfile="log",
+ log="log",
+ file="log",
+ console="term",
+ terminal="term",
+ both="term and log",
+ },
+ },
+ ansi={
+ formats={
+ report_yes=formatters["%-15s > %s\n"],
+ report_nop=formatters["%-15s >\n"],
+ direct_yes=formatters["%-15s > %s"],
+ direct_nop=formatters["%-15s >"],
+ subreport_yes=formatters["%-15s > %s > %s\n"],
+ subreport_nop=formatters["%-15s > %s >\n"],
+ subdirect_yes=formatters["%-15s > %s > %s"],
+ subdirect_nop=formatters["%-15s > %s >"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ targets={
+ logfile="none",
+ log="none",
+ file="none",
+ console="term",
+ terminal="term",
+ both="term",
+ },
+ }
+ }
logs.flush=io.flush
- local formats={} setmetatable(formats,valueiskey)
- local translations={} setmetatable(translations,valueiskey)
writer=function(...)
write_nl(target,...)
end
newline=function()
write_nl(target,"\n")
end
- local report_yes=formatters["%-15s > %s\n"]
- local report_nop=formatters["%-15s >\n"]
report=function(a,b,c,...)
if c then
write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
@@ -7474,8 +7565,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local direct_yes=formatters["%-15s > %s"]
- local direct_nop=formatters["%-15s >"]
direct=function(a,b,c,...)
if c then
return direct_yes(translations[a],formatters[formats[b]](c,...))
@@ -7487,8 +7576,6 @@ if tex and (tex.jobname or tex.formatname) then
return ""
end
end
- local subreport_yes=formatters["%-15s > %s > %s\n"]
- local subreport_nop=formatters["%-15s > %s >\n"]
subreport=function(a,s,b,c,...)
if c then
write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
@@ -7500,8 +7587,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local subdirect_yes=formatters["%-15s > %s > %s"]
- local subdirect_nop=formatters["%-15s > %s >"]
subdirect=function(a,s,b,c,...)
if c then
return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
@@ -7513,8 +7598,6 @@ if tex and (tex.jobname or tex.formatname) then
return ""
end
end
- local status_yes=formatters["%-15s : %s\n"]
- local status_nop=formatters["%-15s :\n"]
status=function(a,b,c,...)
if c then
write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
@@ -7526,16 +7609,13 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local targets={
- logfile="log",
- log="log",
- file="log",
- console="term",
- terminal="term",
- both="term and log",
- }
- settarget=function(whereto)
- target=targets[whereto or "both"] or targets.both
+ settarget=function(askedwhereto)
+ whereto=askedwhereto or whereto or "both"
+ target=targets[whereto]
+ if not target then
+ whereto="both"
+ target=targets[whereto]
+ end
if target=="term" or target=="term and log" then
logs.flush=io.flush
else
@@ -7564,21 +7644,74 @@ if tex and (tex.jobname or tex.formatname) then
writeline(target,f(...))
end
end
- setformatters=function(f)
- report_yes=f.report_yes or report_yes
- report_nop=f.report_nop or report_nop
- subreport_yes=f.subreport_yes or subreport_yes
- subreport_nop=f.subreport_nop or subreport_nop
- direct_yes=f.direct_yes or direct_yes
- direct_nop=f.direct_nop or direct_nop
- subdirect_yes=f.subdirect_yes or subdirect_yes
- subdirect_nop=f.subdirect_nop or subdirect_nop
- status_yes=f.status_yes or status_yes
- status_nop=f.status_nop or status_nop
- end
+ setformatters=function(specification)
+ local t=nil
+ local f=nil
+ local d=variants.default
+ if not specification then
+ elseif type(specification)=="table" then
+ t=specification.targets
+ f=specification.formats or specification
+ else
+ local v=variants[specification]
+ if v then
+ t=v.targets
+ f=v.formats
+ variant=specification
+ end
+ end
+ targets=t or d.targets
+ target=targets[whereto] or target
+ if f then
+ d=d.formats
+ else
+ f=d.formats
+ d=f
+ end
+ setmetatableindex(f,d)
+ report_yes=f.report_yes
+ report_nop=f.report_nop
+ subreport_yes=f.subreport_yes
+ subreport_nop=f.subreport_nop
+ direct_yes=f.direct_yes
+ direct_nop=f.direct_nop
+ subdirect_yes=f.subdirect_yes
+ subdirect_nop=f.subdirect_nop
+ status_yes=f.status_yes
+ status_nop=f.status_nop
+ if variant=="ansi" then
+ useluawrites()
+ end
+ settarget(whereto)
+ end
+ setformatters(variant)
setlogfile=ignore
settimedlog=ignore
else
+ local report_yes,subreport_yes,status_yes
+ local report_nop,subreport_nop,status_nop
+ local variants={
+ default={
+ formats={
+ report_yes=formatters["%-15s | %s"],
+ report_nop=formatters["%-15s |"],
+ subreport_yes=formatters["%-15s | %s | %s"],
+ subreport_nop=formatters["%-15s | %s |"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ },
+ ansi={
+ formats={
+ report_yes=formatters["%-15s | %s"],
+ report_nop=formatters["%-15s |"],
+ subreport_yes=formatters["%-15s | %s | %s"],
+ subreport_nop=formatters["%-15s | %s |"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ },
+ }
logs.flush=ignore
writer=function(s)
write_nl(s)
@@ -7586,8 +7719,6 @@ else
newline=function()
write_nl("\n")
end
- local report_yes=formatters["%-15s | %s"]
- local report_nop=formatters["%-15s |"]
report=function(a,b,c,...)
if c then
write_nl(report_yes(a,formatters[b](c,...)))
@@ -7599,8 +7730,6 @@ else
write_nl("")
end
end
- local subreport_yes=formatters["%-15s | %s | %s"]
- local subreport_nop=formatters["%-15s | %s |"]
subreport=function(a,sub,b,c,...)
if c then
write_nl(subreport_yes(a,sub,formatters[b](c,...)))
@@ -7612,8 +7741,6 @@ else
write_nl("")
end
end
- local status_yes=formatters["%-15s : %s\n"]
- local status_nop=formatters["%-15s :\n"]
status=function(a,b,c,...)
if c then
write_nl(status_yes(a,formatters[b](c,...)))
@@ -7638,14 +7765,34 @@ else
writeline(f(s))
end
end
- setformatters=function(f)
- report_yes=f.report_yes or report_yes
- report_nop=f.report_nop or report_nop
- subreport_yes=f.subreport_yes or subreport_yes
- subreport_nop=f.subreport_nop or subreport_nop
- status_yes=f.status_yes or status_yes
- status_nop=f.status_nop or status_nop
- end
+ setformatters=function(specification)
+ local f=nil
+ local d=variants.default
+ if specification then
+ if type(specification)=="table" then
+ f=specification.formats or specification
+ else
+ local v=variants[specification]
+ if v then
+ f=v.formats
+ end
+ end
+ end
+ if f then
+ d=d.formats
+ else
+ f=d.formats
+ d=f
+ end
+ setmetatableindex(f,d)
+ report_yes=f.report_yes
+ report_nop=f.report_nop
+ subreport_yes=f.subreport_yes
+ subreport_nop=f.subreport_nop
+ status_yes=f.status_yes
+ status_nop=f.status_nop
+ end
+ setformatters(variant)
setlogfile=function(name,keepopen)
if name and name~="" then
local localtime=os.localtime
@@ -7898,13 +8045,13 @@ end
local simple=logs.reporter("comment")
logs.simple=simple
logs.simpleline=simple
-function logs.setprogram () end
-function logs.extendbanner() end
-function logs.reportlines () end
-function logs.reportbanner() end
-function logs.reportline () end
-function logs.simplelines () end
-function logs.help () end
+logs.setprogram=ignore
+logs.extendbanner=ignore
+logs.reportlines=ignore
+logs.reportbanner=ignore
+logs.reportline=ignore
+logs.simplelines=ignore
+logs.help=ignore
local Carg,C,lpegmatch=lpeg.Carg,lpeg.C,lpeg.match
local p_newline=lpeg.patterns.newline
local linewise=(
@@ -17430,8 +17577,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 720496
--- stripped bytes : 257447
+-- original bytes : 724183
+-- stripped bytes : 257372
-- end library merge
@@ -18447,16 +18594,7 @@ end
if e_argument("ansi") then
- local formatters = string.formatters
-
- logs.setformatters {
- report_yes = formatters["%-15s | %s"],
- report_nop = formatters["%-15s |"],
- subreport_yes = formatters["%-15s | %s | %s"],
- subreport_nop = formatters["%-15s | %s |"],
- status_yes = formatters["%-15s : %s\n"],
- status_nop = formatters["%-15s :\n"],
- }
+ logs.setformatters("ansi")
local script = e_argument("script") or e_argument("scripts")
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index eae3060bf..b169309a6 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -3644,7 +3644,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-url"] = package.loaded["l-url"] or true
--- original size: 12465, stripped down to: 5710
+-- original size: 12531, stripped down to: 5721
if not modules then modules={} end modules ['l-url']={
version=1.001,
@@ -3813,7 +3813,7 @@ function url.construct(hash)
end
return lpegmatch(escaper,concat(fullurl))
end
-local pattern=Cs(noslash*R("az","AZ")*(S(":|")/":")*noslash*P(1)^0)
+local pattern=Cs(slash^-1/""*R("az","AZ")*((S(":|")/":")+P(":"))*slash*P(1)^0)
function url.filename(filename)
local spec=hashed(filename)
local path=spec.path
@@ -5064,7 +5064,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-str"] = package.loaded["util-str"] or true
--- original size: 34326, stripped down to: 18774
+-- original size: 34327, stripped down to: 18775
if not modules then modules={} end modules ['util-str']={
version=1.001,
@@ -5378,7 +5378,7 @@ local format_f=function(f)
n=n+1
return format("format('%%%sf',a%s)",f,n)
end
-local format_F=function()
+local format_F=function(f)
n=n+1
if not f or f=="" then
return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or format((a%s %% 1 == 0) and '%%i' or '%%.9f',a%s))",n,n,n,n)
@@ -7408,7 +7408,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 25730, stripped down to: 16725
+-- original size: 29350, stripped down to: 20475
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -7417,17 +7417,18 @@ if not modules then modules={} end modules ['trac-log']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+local next,type,select,print=next,type,select,print
local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write
local format,gmatch,find=string.format,string.gmatch,string.find
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
local texgetcount=tex and tex.getcount
+local variant="default"
logs=logs or {}
local logs=logs
local moreinfo=[[
@@ -7437,11 +7438,11 @@ maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
wiki : http://contextgarden.net
]]
-utilities.strings.formatters.add (
+formatters.add (
formatters,"unichr",
[["U+" .. format("%%05X",%s) .. " (" .. utfchar(%s) .. ")"]]
)
-utilities.strings.formatters.add (
+formatters.add (
formatters,"chruni",
[[utfchar(%s) .. " (U+" .. format("%%05X",%s) .. ")"]]
)
@@ -7450,19 +7451,109 @@ setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters
if tex and (tex.jobname or tex.formatname) then
- local valueiskey={ __index=function(t,k) t[k]=k return k end }
- local target="term and log"
+ local function useluawrites()
+ local texio_write_nl=texio.write_nl
+ local texio_write=texio.write
+ local io_write=io.write
+ write_nl=function(target,...)
+ if not io_write then
+ io_write=io.write
+ end
+ if target=="term and log" then
+ texio_write_nl("log",...)
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target=="log" then
+ texio_write_nl("log",...)
+ elseif target=="term" then
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target~="none" then
+ texio_write_nl("log",target,...)
+ texio_write_nl("term","")
+ io_write(target,...)
+ end
+ end
+ write=function(target,...)
+ if not io_write then
+ io_write=io.write
+ end
+ if target=="term and log" then
+ texio_write("log",...)
+ io_write(...)
+ elseif target=="log" then
+ texio_write("log",...)
+ elseif target=="term" then
+ io_write(...)
+ elseif target~="none" then
+ texio_write("log",target,...)
+ io_write(target,...)
+ end
+ end
+ texio.write=write
+ texio.write_nl=write_nl
+ useluawrites=ignore
+ end
+ local whereto="both"
+ local target=nil
+ local targets=nil
+ local formats=table.setmetatableindex("self")
+ local translations=table.setmetatableindex("self")
+ local report_yes,subreport_yes,direct_yes,subdirect_yes,status_yes
+ local report_nop,subreport_nop,direct_nop,subdirect_nop,status_nop
+ local variants={
+ default={
+ formats={
+ report_yes=formatters["%-15s > %s\n"],
+ report_nop=formatters["%-15s >\n"],
+ direct_yes=formatters["%-15s > %s"],
+ direct_nop=formatters["%-15s >"],
+ subreport_yes=formatters["%-15s > %s > %s\n"],
+ subreport_nop=formatters["%-15s > %s >\n"],
+ subdirect_yes=formatters["%-15s > %s > %s"],
+ subdirect_nop=formatters["%-15s > %s >"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ targets={
+ logfile="log",
+ log="log",
+ file="log",
+ console="term",
+ terminal="term",
+ both="term and log",
+ },
+ },
+ ansi={
+ formats={
+ report_yes=formatters["%-15s > %s\n"],
+ report_nop=formatters["%-15s >\n"],
+ direct_yes=formatters["%-15s > %s"],
+ direct_nop=formatters["%-15s >"],
+ subreport_yes=formatters["%-15s > %s > %s\n"],
+ subreport_nop=formatters["%-15s > %s >\n"],
+ subdirect_yes=formatters["%-15s > %s > %s"],
+ subdirect_nop=formatters["%-15s > %s >"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ targets={
+ logfile="none",
+ log="none",
+ file="none",
+ console="term",
+ terminal="term",
+ both="term",
+ },
+ }
+ }
logs.flush=io.flush
- local formats={} setmetatable(formats,valueiskey)
- local translations={} setmetatable(translations,valueiskey)
writer=function(...)
write_nl(target,...)
end
newline=function()
write_nl(target,"\n")
end
- local report_yes=formatters["%-15s > %s\n"]
- local report_nop=formatters["%-15s >\n"]
report=function(a,b,c,...)
if c then
write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
@@ -7474,8 +7565,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local direct_yes=formatters["%-15s > %s"]
- local direct_nop=formatters["%-15s >"]
direct=function(a,b,c,...)
if c then
return direct_yes(translations[a],formatters[formats[b]](c,...))
@@ -7487,8 +7576,6 @@ if tex and (tex.jobname or tex.formatname) then
return ""
end
end
- local subreport_yes=formatters["%-15s > %s > %s\n"]
- local subreport_nop=formatters["%-15s > %s >\n"]
subreport=function(a,s,b,c,...)
if c then
write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
@@ -7500,8 +7587,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local subdirect_yes=formatters["%-15s > %s > %s"]
- local subdirect_nop=formatters["%-15s > %s >"]
subdirect=function(a,s,b,c,...)
if c then
return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
@@ -7513,8 +7598,6 @@ if tex and (tex.jobname or tex.formatname) then
return ""
end
end
- local status_yes=formatters["%-15s : %s\n"]
- local status_nop=formatters["%-15s :\n"]
status=function(a,b,c,...)
if c then
write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
@@ -7526,16 +7609,13 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local targets={
- logfile="log",
- log="log",
- file="log",
- console="term",
- terminal="term",
- both="term and log",
- }
- settarget=function(whereto)
- target=targets[whereto or "both"] or targets.both
+ settarget=function(askedwhereto)
+ whereto=askedwhereto or whereto or "both"
+ target=targets[whereto]
+ if not target then
+ whereto="both"
+ target=targets[whereto]
+ end
if target=="term" or target=="term and log" then
logs.flush=io.flush
else
@@ -7564,21 +7644,74 @@ if tex and (tex.jobname or tex.formatname) then
writeline(target,f(...))
end
end
- setformatters=function(f)
- report_yes=f.report_yes or report_yes
- report_nop=f.report_nop or report_nop
- subreport_yes=f.subreport_yes or subreport_yes
- subreport_nop=f.subreport_nop or subreport_nop
- direct_yes=f.direct_yes or direct_yes
- direct_nop=f.direct_nop or direct_nop
- subdirect_yes=f.subdirect_yes or subdirect_yes
- subdirect_nop=f.subdirect_nop or subdirect_nop
- status_yes=f.status_yes or status_yes
- status_nop=f.status_nop or status_nop
- end
+ setformatters=function(specification)
+ local t=nil
+ local f=nil
+ local d=variants.default
+ if not specification then
+ elseif type(specification)=="table" then
+ t=specification.targets
+ f=specification.formats or specification
+ else
+ local v=variants[specification]
+ if v then
+ t=v.targets
+ f=v.formats
+ variant=specification
+ end
+ end
+ targets=t or d.targets
+ target=targets[whereto] or target
+ if f then
+ d=d.formats
+ else
+ f=d.formats
+ d=f
+ end
+ setmetatableindex(f,d)
+ report_yes=f.report_yes
+ report_nop=f.report_nop
+ subreport_yes=f.subreport_yes
+ subreport_nop=f.subreport_nop
+ direct_yes=f.direct_yes
+ direct_nop=f.direct_nop
+ subdirect_yes=f.subdirect_yes
+ subdirect_nop=f.subdirect_nop
+ status_yes=f.status_yes
+ status_nop=f.status_nop
+ if variant=="ansi" then
+ useluawrites()
+ end
+ settarget(whereto)
+ end
+ setformatters(variant)
setlogfile=ignore
settimedlog=ignore
else
+ local report_yes,subreport_yes,status_yes
+ local report_nop,subreport_nop,status_nop
+ local variants={
+ default={
+ formats={
+ report_yes=formatters["%-15s | %s"],
+ report_nop=formatters["%-15s |"],
+ subreport_yes=formatters["%-15s | %s | %s"],
+ subreport_nop=formatters["%-15s | %s |"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ },
+ ansi={
+ formats={
+ report_yes=formatters["%-15s | %s"],
+ report_nop=formatters["%-15s |"],
+ subreport_yes=formatters["%-15s | %s | %s"],
+ subreport_nop=formatters["%-15s | %s |"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ },
+ }
logs.flush=ignore
writer=function(s)
write_nl(s)
@@ -7586,8 +7719,6 @@ else
newline=function()
write_nl("\n")
end
- local report_yes=formatters["%-15s | %s"]
- local report_nop=formatters["%-15s |"]
report=function(a,b,c,...)
if c then
write_nl(report_yes(a,formatters[b](c,...)))
@@ -7599,8 +7730,6 @@ else
write_nl("")
end
end
- local subreport_yes=formatters["%-15s | %s | %s"]
- local subreport_nop=formatters["%-15s | %s |"]
subreport=function(a,sub,b,c,...)
if c then
write_nl(subreport_yes(a,sub,formatters[b](c,...)))
@@ -7612,8 +7741,6 @@ else
write_nl("")
end
end
- local status_yes=formatters["%-15s : %s\n"]
- local status_nop=formatters["%-15s :\n"]
status=function(a,b,c,...)
if c then
write_nl(status_yes(a,formatters[b](c,...)))
@@ -7638,14 +7765,34 @@ else
writeline(f(s))
end
end
- setformatters=function(f)
- report_yes=f.report_yes or report_yes
- report_nop=f.report_nop or report_nop
- subreport_yes=f.subreport_yes or subreport_yes
- subreport_nop=f.subreport_nop or subreport_nop
- status_yes=f.status_yes or status_yes
- status_nop=f.status_nop or status_nop
- end
+ setformatters=function(specification)
+ local f=nil
+ local d=variants.default
+ if specification then
+ if type(specification)=="table" then
+ f=specification.formats or specification
+ else
+ local v=variants[specification]
+ if v then
+ f=v.formats
+ end
+ end
+ end
+ if f then
+ d=d.formats
+ else
+ f=d.formats
+ d=f
+ end
+ setmetatableindex(f,d)
+ report_yes=f.report_yes
+ report_nop=f.report_nop
+ subreport_yes=f.subreport_yes
+ subreport_nop=f.subreport_nop
+ status_yes=f.status_yes
+ status_nop=f.status_nop
+ end
+ setformatters(variant)
setlogfile=function(name,keepopen)
if name and name~="" then
local localtime=os.localtime
@@ -7898,13 +8045,13 @@ end
local simple=logs.reporter("comment")
logs.simple=simple
logs.simpleline=simple
-function logs.setprogram () end
-function logs.extendbanner() end
-function logs.reportlines () end
-function logs.reportbanner() end
-function logs.reportline () end
-function logs.simplelines () end
-function logs.help () end
+logs.setprogram=ignore
+logs.extendbanner=ignore
+logs.reportlines=ignore
+logs.reportbanner=ignore
+logs.reportline=ignore
+logs.simplelines=ignore
+logs.help=ignore
local Carg,C,lpegmatch=lpeg.Carg,lpeg.C,lpeg.match
local p_newline=lpeg.patterns.newline
local linewise=(
@@ -17430,8 +17577,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 720496
--- stripped bytes : 257447
+-- original bytes : 724183
+-- stripped bytes : 257372
-- end library merge
@@ -18447,16 +18594,7 @@ end
if e_argument("ansi") then
- local formatters = string.formatters
-
- logs.setformatters {
- report_yes = formatters["%-15s | %s"],
- report_nop = formatters["%-15s |"],
- subreport_yes = formatters["%-15s | %s | %s"],
- subreport_nop = formatters["%-15s | %s |"],
- status_yes = formatters["%-15s : %s\n"],
- status_nop = formatters["%-15s :\n"],
- }
+ logs.setformatters("ansi")
local script = e_argument("script") or e_argument("scripts")
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index eae3060bf..b169309a6 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -3644,7 +3644,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-url"] = package.loaded["l-url"] or true
--- original size: 12465, stripped down to: 5710
+-- original size: 12531, stripped down to: 5721
if not modules then modules={} end modules ['l-url']={
version=1.001,
@@ -3813,7 +3813,7 @@ function url.construct(hash)
end
return lpegmatch(escaper,concat(fullurl))
end
-local pattern=Cs(noslash*R("az","AZ")*(S(":|")/":")*noslash*P(1)^0)
+local pattern=Cs(slash^-1/""*R("az","AZ")*((S(":|")/":")+P(":"))*slash*P(1)^0)
function url.filename(filename)
local spec=hashed(filename)
local path=spec.path
@@ -5064,7 +5064,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-str"] = package.loaded["util-str"] or true
--- original size: 34326, stripped down to: 18774
+-- original size: 34327, stripped down to: 18775
if not modules then modules={} end modules ['util-str']={
version=1.001,
@@ -5378,7 +5378,7 @@ local format_f=function(f)
n=n+1
return format("format('%%%sf',a%s)",f,n)
end
-local format_F=function()
+local format_F=function(f)
n=n+1
if not f or f=="" then
return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or format((a%s %% 1 == 0) and '%%i' or '%%.9f',a%s))",n,n,n,n)
@@ -7408,7 +7408,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 25730, stripped down to: 16725
+-- original size: 29350, stripped down to: 20475
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -7417,17 +7417,18 @@ if not modules then modules={} end modules ['trac-log']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+local next,type,select,print=next,type,select,print
local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write
local format,gmatch,find=string.format,string.gmatch,string.find
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
local texgetcount=tex and tex.getcount
+local variant="default"
logs=logs or {}
local logs=logs
local moreinfo=[[
@@ -7437,11 +7438,11 @@ maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
wiki : http://contextgarden.net
]]
-utilities.strings.formatters.add (
+formatters.add (
formatters,"unichr",
[["U+" .. format("%%05X",%s) .. " (" .. utfchar(%s) .. ")"]]
)
-utilities.strings.formatters.add (
+formatters.add (
formatters,"chruni",
[[utfchar(%s) .. " (U+" .. format("%%05X",%s) .. ")"]]
)
@@ -7450,19 +7451,109 @@ setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters
if tex and (tex.jobname or tex.formatname) then
- local valueiskey={ __index=function(t,k) t[k]=k return k end }
- local target="term and log"
+ local function useluawrites()
+ local texio_write_nl=texio.write_nl
+ local texio_write=texio.write
+ local io_write=io.write
+ write_nl=function(target,...)
+ if not io_write then
+ io_write=io.write
+ end
+ if target=="term and log" then
+ texio_write_nl("log",...)
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target=="log" then
+ texio_write_nl("log",...)
+ elseif target=="term" then
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target~="none" then
+ texio_write_nl("log",target,...)
+ texio_write_nl("term","")
+ io_write(target,...)
+ end
+ end
+ write=function(target,...)
+ if not io_write then
+ io_write=io.write
+ end
+ if target=="term and log" then
+ texio_write("log",...)
+ io_write(...)
+ elseif target=="log" then
+ texio_write("log",...)
+ elseif target=="term" then
+ io_write(...)
+ elseif target~="none" then
+ texio_write("log",target,...)
+ io_write(target,...)
+ end
+ end
+ texio.write=write
+ texio.write_nl=write_nl
+ useluawrites=ignore
+ end
+ local whereto="both"
+ local target=nil
+ local targets=nil
+ local formats=table.setmetatableindex("self")
+ local translations=table.setmetatableindex("self")
+ local report_yes,subreport_yes,direct_yes,subdirect_yes,status_yes
+ local report_nop,subreport_nop,direct_nop,subdirect_nop,status_nop
+ local variants={
+ default={
+ formats={
+ report_yes=formatters["%-15s > %s\n"],
+ report_nop=formatters["%-15s >\n"],
+ direct_yes=formatters["%-15s > %s"],
+ direct_nop=formatters["%-15s >"],
+ subreport_yes=formatters["%-15s > %s > %s\n"],
+ subreport_nop=formatters["%-15s > %s >\n"],
+ subdirect_yes=formatters["%-15s > %s > %s"],
+ subdirect_nop=formatters["%-15s > %s >"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ targets={
+ logfile="log",
+ log="log",
+ file="log",
+ console="term",
+ terminal="term",
+ both="term and log",
+ },
+ },
+ ansi={
+ formats={
+ report_yes=formatters["%-15s > %s\n"],
+ report_nop=formatters["%-15s >\n"],
+ direct_yes=formatters["%-15s > %s"],
+ direct_nop=formatters["%-15s >"],
+ subreport_yes=formatters["%-15s > %s > %s\n"],
+ subreport_nop=formatters["%-15s > %s >\n"],
+ subdirect_yes=formatters["%-15s > %s > %s"],
+ subdirect_nop=formatters["%-15s > %s >"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ targets={
+ logfile="none",
+ log="none",
+ file="none",
+ console="term",
+ terminal="term",
+ both="term",
+ },
+ }
+ }
logs.flush=io.flush
- local formats={} setmetatable(formats,valueiskey)
- local translations={} setmetatable(translations,valueiskey)
writer=function(...)
write_nl(target,...)
end
newline=function()
write_nl(target,"\n")
end
- local report_yes=formatters["%-15s > %s\n"]
- local report_nop=formatters["%-15s >\n"]
report=function(a,b,c,...)
if c then
write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
@@ -7474,8 +7565,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local direct_yes=formatters["%-15s > %s"]
- local direct_nop=formatters["%-15s >"]
direct=function(a,b,c,...)
if c then
return direct_yes(translations[a],formatters[formats[b]](c,...))
@@ -7487,8 +7576,6 @@ if tex and (tex.jobname or tex.formatname) then
return ""
end
end
- local subreport_yes=formatters["%-15s > %s > %s\n"]
- local subreport_nop=formatters["%-15s > %s >\n"]
subreport=function(a,s,b,c,...)
if c then
write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
@@ -7500,8 +7587,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local subdirect_yes=formatters["%-15s > %s > %s"]
- local subdirect_nop=formatters["%-15s > %s >"]
subdirect=function(a,s,b,c,...)
if c then
return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
@@ -7513,8 +7598,6 @@ if tex and (tex.jobname or tex.formatname) then
return ""
end
end
- local status_yes=formatters["%-15s : %s\n"]
- local status_nop=formatters["%-15s :\n"]
status=function(a,b,c,...)
if c then
write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
@@ -7526,16 +7609,13 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local targets={
- logfile="log",
- log="log",
- file="log",
- console="term",
- terminal="term",
- both="term and log",
- }
- settarget=function(whereto)
- target=targets[whereto or "both"] or targets.both
+ settarget=function(askedwhereto)
+ whereto=askedwhereto or whereto or "both"
+ target=targets[whereto]
+ if not target then
+ whereto="both"
+ target=targets[whereto]
+ end
if target=="term" or target=="term and log" then
logs.flush=io.flush
else
@@ -7564,21 +7644,74 @@ if tex and (tex.jobname or tex.formatname) then
writeline(target,f(...))
end
end
- setformatters=function(f)
- report_yes=f.report_yes or report_yes
- report_nop=f.report_nop or report_nop
- subreport_yes=f.subreport_yes or subreport_yes
- subreport_nop=f.subreport_nop or subreport_nop
- direct_yes=f.direct_yes or direct_yes
- direct_nop=f.direct_nop or direct_nop
- subdirect_yes=f.subdirect_yes or subdirect_yes
- subdirect_nop=f.subdirect_nop or subdirect_nop
- status_yes=f.status_yes or status_yes
- status_nop=f.status_nop or status_nop
- end
+ setformatters=function(specification)
+ local t=nil
+ local f=nil
+ local d=variants.default
+ if not specification then
+ elseif type(specification)=="table" then
+ t=specification.targets
+ f=specification.formats or specification
+ else
+ local v=variants[specification]
+ if v then
+ t=v.targets
+ f=v.formats
+ variant=specification
+ end
+ end
+ targets=t or d.targets
+ target=targets[whereto] or target
+ if f then
+ d=d.formats
+ else
+ f=d.formats
+ d=f
+ end
+ setmetatableindex(f,d)
+ report_yes=f.report_yes
+ report_nop=f.report_nop
+ subreport_yes=f.subreport_yes
+ subreport_nop=f.subreport_nop
+ direct_yes=f.direct_yes
+ direct_nop=f.direct_nop
+ subdirect_yes=f.subdirect_yes
+ subdirect_nop=f.subdirect_nop
+ status_yes=f.status_yes
+ status_nop=f.status_nop
+ if variant=="ansi" then
+ useluawrites()
+ end
+ settarget(whereto)
+ end
+ setformatters(variant)
setlogfile=ignore
settimedlog=ignore
else
+ local report_yes,subreport_yes,status_yes
+ local report_nop,subreport_nop,status_nop
+ local variants={
+ default={
+ formats={
+ report_yes=formatters["%-15s | %s"],
+ report_nop=formatters["%-15s |"],
+ subreport_yes=formatters["%-15s | %s | %s"],
+ subreport_nop=formatters["%-15s | %s |"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ },
+ ansi={
+ formats={
+ report_yes=formatters["%-15s | %s"],
+ report_nop=formatters["%-15s |"],
+ subreport_yes=formatters["%-15s | %s | %s"],
+ subreport_nop=formatters["%-15s | %s |"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ },
+ }
logs.flush=ignore
writer=function(s)
write_nl(s)
@@ -7586,8 +7719,6 @@ else
newline=function()
write_nl("\n")
end
- local report_yes=formatters["%-15s | %s"]
- local report_nop=formatters["%-15s |"]
report=function(a,b,c,...)
if c then
write_nl(report_yes(a,formatters[b](c,...)))
@@ -7599,8 +7730,6 @@ else
write_nl("")
end
end
- local subreport_yes=formatters["%-15s | %s | %s"]
- local subreport_nop=formatters["%-15s | %s |"]
subreport=function(a,sub,b,c,...)
if c then
write_nl(subreport_yes(a,sub,formatters[b](c,...)))
@@ -7612,8 +7741,6 @@ else
write_nl("")
end
end
- local status_yes=formatters["%-15s : %s\n"]
- local status_nop=formatters["%-15s :\n"]
status=function(a,b,c,...)
if c then
write_nl(status_yes(a,formatters[b](c,...)))
@@ -7638,14 +7765,34 @@ else
writeline(f(s))
end
end
- setformatters=function(f)
- report_yes=f.report_yes or report_yes
- report_nop=f.report_nop or report_nop
- subreport_yes=f.subreport_yes or subreport_yes
- subreport_nop=f.subreport_nop or subreport_nop
- status_yes=f.status_yes or status_yes
- status_nop=f.status_nop or status_nop
- end
+ setformatters=function(specification)
+ local f=nil
+ local d=variants.default
+ if specification then
+ if type(specification)=="table" then
+ f=specification.formats or specification
+ else
+ local v=variants[specification]
+ if v then
+ f=v.formats
+ end
+ end
+ end
+ if f then
+ d=d.formats
+ else
+ f=d.formats
+ d=f
+ end
+ setmetatableindex(f,d)
+ report_yes=f.report_yes
+ report_nop=f.report_nop
+ subreport_yes=f.subreport_yes
+ subreport_nop=f.subreport_nop
+ status_yes=f.status_yes
+ status_nop=f.status_nop
+ end
+ setformatters(variant)
setlogfile=function(name,keepopen)
if name and name~="" then
local localtime=os.localtime
@@ -7898,13 +8045,13 @@ end
local simple=logs.reporter("comment")
logs.simple=simple
logs.simpleline=simple
-function logs.setprogram () end
-function logs.extendbanner() end
-function logs.reportlines () end
-function logs.reportbanner() end
-function logs.reportline () end
-function logs.simplelines () end
-function logs.help () end
+logs.setprogram=ignore
+logs.extendbanner=ignore
+logs.reportlines=ignore
+logs.reportbanner=ignore
+logs.reportline=ignore
+logs.simplelines=ignore
+logs.help=ignore
local Carg,C,lpegmatch=lpeg.Carg,lpeg.C,lpeg.match
local p_newline=lpeg.patterns.newline
local linewise=(
@@ -17430,8 +17577,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 720496
--- stripped bytes : 257447
+-- original bytes : 724183
+-- stripped bytes : 257372
-- end library merge
@@ -18447,16 +18594,7 @@ end
if e_argument("ansi") then
- local formatters = string.formatters
-
- logs.setformatters {
- report_yes = formatters["%-15s | %s"],
- report_nop = formatters["%-15s |"],
- subreport_yes = formatters["%-15s | %s | %s"],
- subreport_nop = formatters["%-15s | %s |"],
- status_yes = formatters["%-15s : %s\n"],
- status_nop = formatters["%-15s :\n"],
- }
+ logs.setformatters("ansi")
local script = e_argument("script") or e_argument("scripts")
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index eae3060bf..b169309a6 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -3644,7 +3644,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-url"] = package.loaded["l-url"] or true
--- original size: 12465, stripped down to: 5710
+-- original size: 12531, stripped down to: 5721
if not modules then modules={} end modules ['l-url']={
version=1.001,
@@ -3813,7 +3813,7 @@ function url.construct(hash)
end
return lpegmatch(escaper,concat(fullurl))
end
-local pattern=Cs(noslash*R("az","AZ")*(S(":|")/":")*noslash*P(1)^0)
+local pattern=Cs(slash^-1/""*R("az","AZ")*((S(":|")/":")+P(":"))*slash*P(1)^0)
function url.filename(filename)
local spec=hashed(filename)
local path=spec.path
@@ -5064,7 +5064,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-str"] = package.loaded["util-str"] or true
--- original size: 34326, stripped down to: 18774
+-- original size: 34327, stripped down to: 18775
if not modules then modules={} end modules ['util-str']={
version=1.001,
@@ -5378,7 +5378,7 @@ local format_f=function(f)
n=n+1
return format("format('%%%sf',a%s)",f,n)
end
-local format_F=function()
+local format_F=function(f)
n=n+1
if not f or f=="" then
return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or format((a%s %% 1 == 0) and '%%i' or '%%.9f',a%s))",n,n,n,n)
@@ -7408,7 +7408,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 25730, stripped down to: 16725
+-- original size: 29350, stripped down to: 20475
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -7417,17 +7417,18 @@ if not modules then modules={} end modules ['trac-log']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+local next,type,select,print=next,type,select,print
local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write
local format,gmatch,find=string.format,string.gmatch,string.find
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
local texgetcount=tex and tex.getcount
+local variant="default"
logs=logs or {}
local logs=logs
local moreinfo=[[
@@ -7437,11 +7438,11 @@ maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
wiki : http://contextgarden.net
]]
-utilities.strings.formatters.add (
+formatters.add (
formatters,"unichr",
[["U+" .. format("%%05X",%s) .. " (" .. utfchar(%s) .. ")"]]
)
-utilities.strings.formatters.add (
+formatters.add (
formatters,"chruni",
[[utfchar(%s) .. " (U+" .. format("%%05X",%s) .. ")"]]
)
@@ -7450,19 +7451,109 @@ setmetatableindex(logs,function(t,k) t[k]=ignore;return ignore end)
local report,subreport,status,settarget,setformats,settranslations
local direct,subdirect,writer,pushtarget,poptarget,setlogfile,settimedlog,setprocessor,setformatters
if tex and (tex.jobname or tex.formatname) then
- local valueiskey={ __index=function(t,k) t[k]=k return k end }
- local target="term and log"
+ local function useluawrites()
+ local texio_write_nl=texio.write_nl
+ local texio_write=texio.write
+ local io_write=io.write
+ write_nl=function(target,...)
+ if not io_write then
+ io_write=io.write
+ end
+ if target=="term and log" then
+ texio_write_nl("log",...)
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target=="log" then
+ texio_write_nl("log",...)
+ elseif target=="term" then
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target~="none" then
+ texio_write_nl("log",target,...)
+ texio_write_nl("term","")
+ io_write(target,...)
+ end
+ end
+ write=function(target,...)
+ if not io_write then
+ io_write=io.write
+ end
+ if target=="term and log" then
+ texio_write("log",...)
+ io_write(...)
+ elseif target=="log" then
+ texio_write("log",...)
+ elseif target=="term" then
+ io_write(...)
+ elseif target~="none" then
+ texio_write("log",target,...)
+ io_write(target,...)
+ end
+ end
+ texio.write=write
+ texio.write_nl=write_nl
+ useluawrites=ignore
+ end
+ local whereto="both"
+ local target=nil
+ local targets=nil
+ local formats=table.setmetatableindex("self")
+ local translations=table.setmetatableindex("self")
+ local report_yes,subreport_yes,direct_yes,subdirect_yes,status_yes
+ local report_nop,subreport_nop,direct_nop,subdirect_nop,status_nop
+ local variants={
+ default={
+ formats={
+ report_yes=formatters["%-15s > %s\n"],
+ report_nop=formatters["%-15s >\n"],
+ direct_yes=formatters["%-15s > %s"],
+ direct_nop=formatters["%-15s >"],
+ subreport_yes=formatters["%-15s > %s > %s\n"],
+ subreport_nop=formatters["%-15s > %s >\n"],
+ subdirect_yes=formatters["%-15s > %s > %s"],
+ subdirect_nop=formatters["%-15s > %s >"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ targets={
+ logfile="log",
+ log="log",
+ file="log",
+ console="term",
+ terminal="term",
+ both="term and log",
+ },
+ },
+ ansi={
+ formats={
+ report_yes=formatters["%-15s > %s\n"],
+ report_nop=formatters["%-15s >\n"],
+ direct_yes=formatters["%-15s > %s"],
+ direct_nop=formatters["%-15s >"],
+ subreport_yes=formatters["%-15s > %s > %s\n"],
+ subreport_nop=formatters["%-15s > %s >\n"],
+ subdirect_yes=formatters["%-15s > %s > %s"],
+ subdirect_nop=formatters["%-15s > %s >"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ targets={
+ logfile="none",
+ log="none",
+ file="none",
+ console="term",
+ terminal="term",
+ both="term",
+ },
+ }
+ }
logs.flush=io.flush
- local formats={} setmetatable(formats,valueiskey)
- local translations={} setmetatable(translations,valueiskey)
writer=function(...)
write_nl(target,...)
end
newline=function()
write_nl(target,"\n")
end
- local report_yes=formatters["%-15s > %s\n"]
- local report_nop=formatters["%-15s >\n"]
report=function(a,b,c,...)
if c then
write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
@@ -7474,8 +7565,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local direct_yes=formatters["%-15s > %s"]
- local direct_nop=formatters["%-15s >"]
direct=function(a,b,c,...)
if c then
return direct_yes(translations[a],formatters[formats[b]](c,...))
@@ -7487,8 +7576,6 @@ if tex and (tex.jobname or tex.formatname) then
return ""
end
end
- local subreport_yes=formatters["%-15s > %s > %s\n"]
- local subreport_nop=formatters["%-15s > %s >\n"]
subreport=function(a,s,b,c,...)
if c then
write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
@@ -7500,8 +7587,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local subdirect_yes=formatters["%-15s > %s > %s"]
- local subdirect_nop=formatters["%-15s > %s >"]
subdirect=function(a,s,b,c,...)
if c then
return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
@@ -7513,8 +7598,6 @@ if tex and (tex.jobname or tex.formatname) then
return ""
end
end
- local status_yes=formatters["%-15s : %s\n"]
- local status_nop=formatters["%-15s :\n"]
status=function(a,b,c,...)
if c then
write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
@@ -7526,16 +7609,13 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
end
- local targets={
- logfile="log",
- log="log",
- file="log",
- console="term",
- terminal="term",
- both="term and log",
- }
- settarget=function(whereto)
- target=targets[whereto or "both"] or targets.both
+ settarget=function(askedwhereto)
+ whereto=askedwhereto or whereto or "both"
+ target=targets[whereto]
+ if not target then
+ whereto="both"
+ target=targets[whereto]
+ end
if target=="term" or target=="term and log" then
logs.flush=io.flush
else
@@ -7564,21 +7644,74 @@ if tex and (tex.jobname or tex.formatname) then
writeline(target,f(...))
end
end
- setformatters=function(f)
- report_yes=f.report_yes or report_yes
- report_nop=f.report_nop or report_nop
- subreport_yes=f.subreport_yes or subreport_yes
- subreport_nop=f.subreport_nop or subreport_nop
- direct_yes=f.direct_yes or direct_yes
- direct_nop=f.direct_nop or direct_nop
- subdirect_yes=f.subdirect_yes or subdirect_yes
- subdirect_nop=f.subdirect_nop or subdirect_nop
- status_yes=f.status_yes or status_yes
- status_nop=f.status_nop or status_nop
- end
+ setformatters=function(specification)
+ local t=nil
+ local f=nil
+ local d=variants.default
+ if not specification then
+ elseif type(specification)=="table" then
+ t=specification.targets
+ f=specification.formats or specification
+ else
+ local v=variants[specification]
+ if v then
+ t=v.targets
+ f=v.formats
+ variant=specification
+ end
+ end
+ targets=t or d.targets
+ target=targets[whereto] or target
+ if f then
+ d=d.formats
+ else
+ f=d.formats
+ d=f
+ end
+ setmetatableindex(f,d)
+ report_yes=f.report_yes
+ report_nop=f.report_nop
+ subreport_yes=f.subreport_yes
+ subreport_nop=f.subreport_nop
+ direct_yes=f.direct_yes
+ direct_nop=f.direct_nop
+ subdirect_yes=f.subdirect_yes
+ subdirect_nop=f.subdirect_nop
+ status_yes=f.status_yes
+ status_nop=f.status_nop
+ if variant=="ansi" then
+ useluawrites()
+ end
+ settarget(whereto)
+ end
+ setformatters(variant)
setlogfile=ignore
settimedlog=ignore
else
+ local report_yes,subreport_yes,status_yes
+ local report_nop,subreport_nop,status_nop
+ local variants={
+ default={
+ formats={
+ report_yes=formatters["%-15s | %s"],
+ report_nop=formatters["%-15s |"],
+ subreport_yes=formatters["%-15s | %s | %s"],
+ subreport_nop=formatters["%-15s | %s |"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ },
+ ansi={
+ formats={
+ report_yes=formatters["%-15s | %s"],
+ report_nop=formatters["%-15s |"],
+ subreport_yes=formatters["%-15s | %s | %s"],
+ subreport_nop=formatters["%-15s | %s |"],
+ status_yes=formatters["%-15s : %s\n"],
+ status_nop=formatters["%-15s :\n"],
+ },
+ },
+ }
logs.flush=ignore
writer=function(s)
write_nl(s)
@@ -7586,8 +7719,6 @@ else
newline=function()
write_nl("\n")
end
- local report_yes=formatters["%-15s | %s"]
- local report_nop=formatters["%-15s |"]
report=function(a,b,c,...)
if c then
write_nl(report_yes(a,formatters[b](c,...)))
@@ -7599,8 +7730,6 @@ else
write_nl("")
end
end
- local subreport_yes=formatters["%-15s | %s | %s"]
- local subreport_nop=formatters["%-15s | %s |"]
subreport=function(a,sub,b,c,...)
if c then
write_nl(subreport_yes(a,sub,formatters[b](c,...)))
@@ -7612,8 +7741,6 @@ else
write_nl("")
end
end
- local status_yes=formatters["%-15s : %s\n"]
- local status_nop=formatters["%-15s :\n"]
status=function(a,b,c,...)
if c then
write_nl(status_yes(a,formatters[b](c,...)))
@@ -7638,14 +7765,34 @@ else
writeline(f(s))
end
end
- setformatters=function(f)
- report_yes=f.report_yes or report_yes
- report_nop=f.report_nop or report_nop
- subreport_yes=f.subreport_yes or subreport_yes
- subreport_nop=f.subreport_nop or subreport_nop
- status_yes=f.status_yes or status_yes
- status_nop=f.status_nop or status_nop
- end
+ setformatters=function(specification)
+ local f=nil
+ local d=variants.default
+ if specification then
+ if type(specification)=="table" then
+ f=specification.formats or specification
+ else
+ local v=variants[specification]
+ if v then
+ f=v.formats
+ end
+ end
+ end
+ if f then
+ d=d.formats
+ else
+ f=d.formats
+ d=f
+ end
+ setmetatableindex(f,d)
+ report_yes=f.report_yes
+ report_nop=f.report_nop
+ subreport_yes=f.subreport_yes
+ subreport_nop=f.subreport_nop
+ status_yes=f.status_yes
+ status_nop=f.status_nop
+ end
+ setformatters(variant)
setlogfile=function(name,keepopen)
if name and name~="" then
local localtime=os.localtime
@@ -7898,13 +8045,13 @@ end
local simple=logs.reporter("comment")
logs.simple=simple
logs.simpleline=simple
-function logs.setprogram () end
-function logs.extendbanner() end
-function logs.reportlines () end
-function logs.reportbanner() end
-function logs.reportline () end
-function logs.simplelines () end
-function logs.help () end
+logs.setprogram=ignore
+logs.extendbanner=ignore
+logs.reportlines=ignore
+logs.reportbanner=ignore
+logs.reportline=ignore
+logs.simplelines=ignore
+logs.help=ignore
local Carg,C,lpegmatch=lpeg.Carg,lpeg.C,lpeg.match
local p_newline=lpeg.patterns.newline
local linewise=(
@@ -17430,8 +17577,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 720496
--- stripped bytes : 257447
+-- original bytes : 724183
+-- stripped bytes : 257372
-- end library merge
@@ -18447,16 +18594,7 @@ end
if e_argument("ansi") then
- local formatters = string.formatters
-
- logs.setformatters {
- report_yes = formatters["%-15s | %s"],
- report_nop = formatters["%-15s |"],
- subreport_yes = formatters["%-15s | %s | %s"],
- subreport_nop = formatters["%-15s | %s |"],
- status_yes = formatters["%-15s : %s\n"],
- status_nop = formatters["%-15s :\n"],
- }
+ logs.setformatters("ansi")
local script = e_argument("script") or e_argument("scripts")
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua
index 223f492c1..74640ad08 100644
--- a/tex/context/base/back-exp.lua
+++ b/tex/context/base/back-exp.lua
@@ -38,6 +38,7 @@ local fromunicode16 = fonts.mappings.fromunicode16
local sortedhash = table.sortedhash
local formatters = string.formatters
local todimen = number.todimen
+local replacetemplate = utilities.templates.replace
local trace_export = false trackers.register ("export.trace", function(v) trace_export = v end)
local trace_spacing = false trackers.register ("export.trace.spacing", function(v) trace_spacing = v end)
@@ -336,23 +337,24 @@ do
-- /* padding : ; */
-- /* text-justify : inter-word ; */
-local f_document = formatters [ [[
+local documenttemplate = [[
document {
- font-size : %s !important ;
- max-width : %s !important ;
- text-align : %s !important ;
- hyphens : %s !important ;
+ font-size : %size% !important ;
+ max-width : %width% !important ;
+ text-width : %align% !important ;
+ hyphens : %hyphens% !important ;
}
-]] ]
+]]
-local f_style = formatters [ [[
-%s[detail="%s"] {
- font-style : %s ;
- font-variant : %s ;
- font-weight : %s ;
- font-family : %s ;
- color : %s ;
-}]] ]
+local styletemplate = [[
+%element%[detail="%detail%"], div.%element%.detail-%detail% {
+ display : inline ;
+ font-style : %style% ;
+ font-variant : %variant% ;
+ font-weight : %weight% ;
+ font-family : %family% ;
+ color : %color% ;
+}]]
function wrapups.allusedstyles(xmlfile)
local result = { formatters["/* %s for file %s */"]("styles",xmlfile) }
@@ -384,7 +386,12 @@ local f_style = formatters [ [[
align = hyphens and "justify" or "inherited"
end
--
- result[#result+1] = f_document(bodyfont,width,align,hyphen)
+ result[#result+1] = replacetemplate(documenttemplate,{
+ size = bodyfont,
+ width = width,
+ align = align,
+ hyphens = hyphen
+ })
--
local colorspecification = xml.css.colorspecification
local fontspecification = xml.css.fontspecification
@@ -392,12 +399,15 @@ local f_style = formatters [ [[
for detail, data in sortedhash(details) do
local s = fontspecification(data.style)
local c = colorspecification(data.color)
- result[#result+1] = f_style(element,detail,
- s.style or "inherit",
- s.variant or "inherit",
- s.weight or "inherit",
- s.family or "inherit",
- c or "inherit")
+ result[#result+1] = replacetemplate(styletemplate,{
+ element = element,
+ detail = detail,
+ style = s.style or "inherit",
+ variant = s.variant or "inherit",
+ weight = s.weight or "inherit",
+ family = s.family or "inherit",
+ color = c or "inherit",
+ })
end
end
return concat(result,"\n\n")
@@ -409,44 +419,56 @@ local usedimages = { }
do
-local f_image = formatters [ [[
-%s[id="%s"] {
+local imagetemplate = [[
+%element%[id="%detail%"], div.%element%[id="%detail%"] {
display : block ;
- background-image : url(%s) ;
+ background-image : url(%name%) ;
background-size : 100%% auto ;
background-repeat : no-repeat ;
- width : %s ;
- height : %s ;
-}]] ]
+ width : %width% ;
+ height : %height% ;
+}]]
+
+
+ local function substitute(name)
+ if file.suffix(name) == "pdf" then
+ -- temp hack .. we will have a remapper
+ return file.replacesuffix(name,"svg")
+ else
+ return name
+ end
+ end
+
+ local f_images = formatters["/* %s for file %s */"]
+ local collected = { }
function wrapups.allusedimages(xmlfile)
- local result = { formatters["/* %s for file %s */"]("images",xmlfile) }
+ local result = { f_images("images",xmlfile) }
for element, details in sortedhash(usedimages) do
for detail, data in sortedhash(details) do
local name = data.name
- if file.suffix(name) == "pdf" then
- -- temp hack .. we will have a remapper
- name = file.replacesuffix(name,"svg")
- end
- result[#result+1] = f_image(element,detail,name,data.width,data.height)
+ local full = url.addscheme(substitute(name))
+ result[#result+1] = replacetemplate(imagetemplate,{
+ element = element,
+ detail = detail,
+ name = full,
+ width = data.width,
+ height = data.height,
+ })
+ collected[detail] = {
+ name = full,
+ width = data.width,
+ height = data.height,
+ page = data.page,
+ used = data.used,
+ }
end
end
return concat(result,"\n\n")
end
- function wrapups.uniqueusedimages()
- local unique = { }
- for element, details in next, usedimages do
- for detail, data in next, details do
- local name = data.name
- if file.suffix(name) == "pdf" then
- unique[file.replacesuffix(name,"svg")] = name
- else
- unique[name] = name
- end
- end
- end
- return unique
+ function wrapups.uniqueusedimages() -- todo: combine these two
+ return collected
end
end
@@ -710,9 +732,10 @@ do
local f_imagespec = formatters[' id="%s" width="%s" height="%s"']
local f_imagepage = formatters[' page="%s"']
- function structurestags.setfigure(name,page,width,height)
+ function structurestags.setfigure(name,used,page,width,height)
image[detailedtag("image")] = {
name = name,
+ used = used,
page = page,
width = todimen(width, "cm","%0.3Fcm"),
height = todimen(height,"cm","%0.3Fcm"),
@@ -1026,6 +1049,12 @@ do
return v
end)
+ local dummy_nucleus = {
+ element = "mtext",
+ data = { content = "" },
+ nature = "inline",
+ }
+
local function checkmath(root) -- we can provide utf.toentities as an option
local data = root.data
if data then
@@ -1055,6 +1084,14 @@ do
-- sub.__o__, sup.__o__ = subscript, superscript
sub.__i__, sup.__i__ = superscript, subscript
end
+-- elseif roottg == "msup" or roottg == "msub" then
+-- -- m$^2$
+-- if ndata == 1 then
+-- local d = data[1]
+-- data[2] = d
+-- d.__i__ = 2
+-- data[1] = dummy_nucleus
+-- end
elseif roottg == "mfenced" then
local new, n = { }, 0
local attributes = { }
@@ -1272,7 +1309,8 @@ do
}
-- can be option if needed:
if mode == "inline" then
- di.nature = "mixed" -- else spacing problem (maybe inline)
+ -- di.nature = "mixed" -- else spacing problem (maybe inline)
+ di.nature = "inline" -- we need to catch x$X$x and x $X$ x
else
di.nature = "display"
end
@@ -1300,6 +1338,19 @@ do
end
end
+ function extras.msub(result,element,detail,n,fulltag,di)
+ -- m$^2$
+ local data = di.data
+ if #data == 1 then
+ local d = data[1]
+ data[2] = d
+ d.__i__ = 2
+ data[1] = dummy_nucleus
+ end
+ end
+
+ extras.msup = extras.msub
+
end
do
@@ -2545,15 +2596,15 @@ local f_cssheadlink = formatters [ [[
return concat(result), concat(extras)
end
-local f_e_template = formatters [ [[
-%s {
- display: %s ;
-}]] ]
+local f_e_template = [[
+%element% {
+ display: %display% ;
+}]]
-local f_d_template = formatters [ [[
-%s[detail=%s] {
- display: %s ;
-}]] ]
+local f_d_template = [[
+%element%[detail=%detail%], div.detail-%detail% {
+ display: %display% ;
+}]]
local f_category = formatters["/* category: %s */"]
@@ -2575,6 +2626,8 @@ local htmltemplate = [[
</head>
<body>
+ <div class="warning">Rendering can be suboptimal because there is no default/fallback css loaded.</div>
+
%body%
</body>
@@ -2592,11 +2645,18 @@ local htmltemplate = [[
for element, details in sortedhash(used) do
result[#result+1] = f_category(element)
for detail, nature in sortedhash(details) do
- local d = displaymapping[nature or "display"] or "block"
+ local display = displaymapping[nature or "display"] or "block"
if detail == "" then
- result[#result+1] = f_e_template(element,d)
+ result[#result+1] = replacetemplate(f_e_template, {
+ element = element,
+ display = display,
+ })
else
- result[#result+1] = f_d_template(element,detail,d)
+ result[#result+1] = replacetemplate(f_d_template, {
+ element = element,
+ detail = detail,
+ display = display,
+ })
end
end
end
@@ -2685,6 +2745,8 @@ local htmltemplate = [[
end
end
+ -- maybe the reverse: be explicit about what is permitted
+
local private = {
destination = true,
prefix = true,
@@ -2700,6 +2762,13 @@ local htmltemplate = [[
file = true,
internal = true,
location = true,
+ --
+ name = true, -- image name
+ used = true, -- image name
+ page = true, -- image name
+ width = true,
+ height = true,
+ --
}
local addclicks = true
@@ -2872,6 +2941,8 @@ local htmltemplate = [[
name = file.removesuffix(v),
identifier = os.uuid(),
images = wrapups.uniqueusedimages(),
+ imagefile = imagefilename,
+ stylefile = stylefilename,
root = xhtmlfile,
files = files,
language = languagenames[texgetcount("mainlanguagenumber")],
@@ -2893,7 +2964,7 @@ local htmltemplate = [[
preamble = wholepreamble(false),
title = specification.title,
}
- io.savedata(resultfile,utilities.templates.replace(htmltemplate,variables,"xml"))
+ io.savedata(resultfile,replacetemplate(htmltemplate,variables,"xml"))
report_export("")
report_export([[create epub with: mtxrun --script epub --make "%s"]],file.nameonly(resultfile))
report_export("")
diff --git a/tex/context/base/back-exp.mkiv b/tex/context/base/back-exp.mkiv
index 7cae68f0e..bda056fac 100644
--- a/tex/context/base/back-exp.mkiv
+++ b/tex/context/base/back-exp.mkiv
@@ -98,7 +98,7 @@
\to \everyenableelements
\appendtoks % we can have differently scaled images
- \unexpanded\def\dotagfigure{\taggedctxcommand{settagfigure("\figurefileoriginal","\figurefilepage",\number\dimexpr\figurewidth,\number\dimexpr\figureheight)}}%
+ \unexpanded\def\dotagfigure{\taggedctxcommand{settagfigure("\figurefileoriginal","\figurefullname","\figurefilepage",\number\dimexpr\figurewidth,\number\dimexpr\figureheight)}}%
\to \everyenableelements
\appendtoks
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 5b27eb60b..37a9ead0f 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.06 20:59}
+\newcontextversion{2014.09.18 11:17}
%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 e6d7ad599..e0c719446 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 79b273b0a..f060a710b 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.06 20:59}
+\edef\contextversion{2014.09.18 11:17}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index 343485ed2..dd9f50dc8 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -983,7 +983,7 @@ end
local whitespace = lpeg.patterns.whitespace
local word = lpeg.patterns.utf8uppercharacter^-1 * (1-whitespace)^1
-local pattern_one = Cs(whitespace^0 * word^-1 * P(1)^1)
+local pattern_one = Cs( whitespace^0 * word^-1 * P(1)^0)
local pattern_all = Cs((whitespace^1 + word)^1)
function converters.word (s) return s end -- dummies for typos
diff --git a/tex/context/base/export-example.css b/tex/context/base/export-example.css
index 10db21982..f78014a5d 100644
--- a/tex/context/base/export-example.css
+++ b/tex/context/base/export-example.css
@@ -50,7 +50,7 @@ document, div.document {
}
document>metadata, div.document div.metadata {
- font-family : "Lucida Console", "DejaVu Sans Mono", monospace ;
+ font-family : "DejaVu Sans Mono", "Lucida Console", monospace ;
margin-bottom : 2em ;
}
@@ -312,7 +312,7 @@ verbatimblock, div.verbatimblock {
padding : 1em ;
margin-bottom : 1em ;
margin-top : 1em ;
- font-family : "Lucida Console", "DejaVu Sans Mono", monospace ;
+ font-family : "DejaVu Sans Mono", "Lucida Console", monospace ;
}
verbatimlines+verbatimlines, div.verbatimlines+div.verbatimlines {
@@ -329,7 +329,7 @@ verbatim, div.verbatim {
display : inline ;
white-space : pre-wrap ;
color : rgb(60%,60%,0%) ;
- font-family : "Lucida Console", "DejaVu Sans Mono", monospace ;
+ font-family : "DejaVu Sans Mono", "Lucida Console", monospace ;
}
/* lines : display */
@@ -773,7 +773,17 @@ comment, div.comment {
background-color : rgb(50%,75%,100%) ;
display : block ;
padding : 1em ;
- margin-bottom : 1em ;
- margin-top : 1em ;
- font-family : "Lucida Console", "DejaVu Sans Mono", monospace ;
+ margin-bottom : 2ex ;
+ margin-top : 2ex ;
+ font-family : "DejaVu Sans Mono", "Lucida Console", monospace ;
+}
+
+/* special */
+
+c, div.c {
+ display : inline ;
+}
+
+warning, div.warning {
+ display : none ;
}
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index 7e3ed6e69..d3b13a680 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -725,7 +725,7 @@ local function register(askedname,specification)
report_inclusion("format %a natively supported by backend",format)
end
else
- specification.found = false
+ -- specification.found = false -- needs checking
if trace_figures then
report_inclusion("format %a supported by output file format",format)
end
diff --git a/tex/context/base/l-url.lua b/tex/context/base/l-url.lua
index 8e96b4525..b189ec5bb 100644
--- a/tex/context/base/l-url.lua
+++ b/tex/context/base/l-url.lua
@@ -256,7 +256,7 @@ function url.construct(hash) -- dodo: we need to escape !
return lpegmatch(escaper,concat(fullurl))
end
-local pattern = Cs(noslash * R("az","AZ") * (S(":|")/":") * noslash * P(1)^0)
+local pattern = Cs(slash^-1/"" * R("az","AZ") * ((S(":|")/":") + P(":")) * slash * P(1)^0)
function url.filename(filename)
local spec = hashed(filename)
@@ -266,6 +266,7 @@ end
-- print(url.filename("/c|/test"))
-- print(url.filename("/c/test"))
+-- print(url.filename("file:///t:/sources/cow.svg"))
local function escapestring(str)
return lpegmatch(escaper,str)
diff --git a/tex/context/base/lpdf-epa.lua b/tex/context/base/lpdf-epa.lua
index 61d57b8d3..fd4d9eb7e 100644
--- a/tex/context/base/lpdf-epa.lua
+++ b/tex/context/base/lpdf-epa.lua
@@ -94,10 +94,17 @@ local function link_uri(x,y,w,h,document,annotation)
end
end
+-- The rules in PDF on what a 'file specification' is, is in fact quite elaborate
+-- (see section 3.10 in the 1.7 reference) so we need to test for string as well
+-- as a table. TH/20140916
+
local function link_file(x,y,w,h,document,annotation)
local a = annotation.A
if a then
local filename = a.F
+ if type(filename) == "table" then
+ filename = filename.F
+ end
if filename then
filename = escapetex(filename)
local destination = a.D
diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua
index e8bd82cb9..b58008e7f 100644
--- a/tex/context/base/lpdf-ini.lua
+++ b/tex/context/base/lpdf-ini.lua
@@ -12,6 +12,7 @@ local utfchar, utfvalues = utf.char, utf.values
local sind, cosd, floor, max, min = math.sind, math.cosd, math.floor, math.max, math.min
local lpegmatch, P, C, R, S, Cc, Cs = lpeg.match, lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc, lpeg.Cs
local formatters = string.formatters
+local isboolean = string.is_boolean
local report_objects = logs.reporter("backend","objects")
local report_finalizing = logs.reporter("backend","finalizing")
@@ -941,39 +942,59 @@ function lpdf.id()
return format("%s.%s",tex.jobname,timestamp)
end
+-- return nil is nicer in test prints
+
function lpdf.checkedkey(t,key,variant)
local pn = t and t[key]
- if pn then
+ if pn ~= nil then
local tn = type(pn)
if tn == variant then
if variant == "string" then
- return pn ~= "" and pn or nil
+ if pn ~= "" then
+ return pn
+ end
elseif variant == "table" then
- return next(pn) and pn or nil
+ if next(pn) then
+ return pn
+ end
else
return pn
end
- elseif tn == "string" and variant == "number" then
- return tonumber(pn)
+ elseif tn == "string" then
+ if variant == "number" then
+ return tonumber(pn)
+ elseif variant == "boolean" then
+ return isboolean(pn,nil,true)
+ end
end
end
+ -- return nil
end
function lpdf.checkedvalue(value,variant) -- code not shared
- if value then
+ if value ~= nil then
local tv = type(value)
if tv == variant then
if variant == "string" then
- return value ~= "" and value
+ if value ~= "" then
+ return value
+ end
elseif variant == "table" then
- return next(value) and value
+ if next(value) then
+ return value
+ end
else
return value
end
- elseif tv == "string" and variant == "number" then
- return tonumber(value)
+ elseif tv == "string" then
+ if variant == "number" then
+ return tonumber(value)
+ elseif variant == "boolean" then
+ return isboolean(value,nil,true)
+ end
end
end
+ -- return nil
end
function lpdf.limited(n,min,max,default)
diff --git a/tex/context/base/lxml-css.lua b/tex/context/base/lxml-css.lua
index 0deaea4d3..fa921b24f 100644
--- a/tex/context/base/lxml-css.lua
+++ b/tex/context/base/lxml-css.lua
@@ -146,7 +146,19 @@ local pattern = Cf( Ct("") * (
+ (C("sansserif") + C("sans")) / "sans-serif" -- match before serif
+ C("serif")
)
- ) + P(1)
+ )
+--+ P("\\") * (
+-- P("bf") * ( Cg ( Cc("weight") * Cc("bold") ) )
+-- + P("bi") * ( Cg ( Cc("weight") * Cc("bold") )
+-- * Cg ( Cc("style") * Cc("italic") ) )
+-- + P("bs") * ( Cg ( Cc("weight") * Cc("bold") )
+-- * Cg ( Cc("style") * Cc("oblique") ) )
+-- + P("it") * ( Cg ( Cc("style") * Cc("italic") ) )
+-- + P("sl") * ( Cg ( Cc("style") * Cc("oblique") ) )
+-- + P("sc") * ( Cg ( Cc("variant") * Cc("small-caps") ) )
+-- + P("tt") * ( Cg ( Cc("family") * Cc("monospace") ) )
+--)
+ + P(1)
)^0 , rawset)
function css.fontspecification(str)
diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua
index c27d4ed40..31381b0ca 100644
--- a/tex/context/base/lxml-tex.lua
+++ b/tex/context/base/lxml-tex.lua
@@ -1543,6 +1543,8 @@ function lxml.att(id,a,default)
end
elseif str ~= "" then
contextsprint(notcatcodes,str)
+ else
+ -- explicit empty is valid
end
elseif default and default ~= "" then
contextsprint(notcatcodes,default)
diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv
index f7a2357bf..c85565703 100644
--- a/tex/context/base/page-sid.mkiv
+++ b/tex/context/base/page-sid.mkiv
@@ -764,7 +764,7 @@
\def\checksidefloat {\page_sides_check_floats}
\def\flushsidefloats {\page_sides_flush_floats}
\def\flushsidefloatsafterpar{\page_sides_flush_floats_after_par}
-%def\forgetsidefloats {\page_sides_forget_floats}
+\def\forgetsidefloats {\page_sides_forget_floats}
%def\synchronizesidefloats {\page_sides_synchronize_floats}
\protect \endinput
diff --git a/tex/context/base/publ-fnd.lua b/tex/context/base/publ-fnd.lua
index f9afd5fd0..ba60bdca0 100644
--- a/tex/context/base/publ-fnd.lua
+++ b/tex/context/base/publ-fnd.lua
@@ -11,6 +11,10 @@ if not characters then
dofile(resolvers.findfile("char-utf.lua"))
end
+-- this tracker is only for real debugging and not for the average user
+
+local trace_match = false trackers.register("publications.cite.match", function(v) trace_match = v end)
+
if not publications then
publications = { }
end
@@ -23,7 +27,7 @@ local concat = table.concat
local formatters = string.formatters
local lowercase = characters.lower
-local report = logs.reporter("publications")
+local report = logs.reporter("publications","match")
local colon = P(":")
local dash = P("-")
@@ -67,9 +71,9 @@ end
----- pattern = Cs(b_match * ((field + range + match + space + P(1))-e_match)^1 * e_match)
local b_match = lparent
-local e_match = rparent * space^0 * (P(-1) + P(",")/" or ")
+local e_match = rparent * space^0 * (#P(-1) + P(",")/" or ") -- maybe also + -> and
local p_match = b_match * ((field + range + match + space + P(1))-e_match)^1 * e_match
-local pattern = Cs(Cc("(") * (P("match")/"" * p_match)^1 * Cc(")"))
+local pattern = Cs(Cc("(") * (P("match")/"" * space^0 * p_match)^1 * Cc(")"))
-- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- --
@@ -93,7 +97,7 @@ local find = string.find
local lower = characters.lower
return function(entry)
%s
-return %s and true or false
+ return %s and true or false
end
]] ]
@@ -102,14 +106,25 @@ local function compile(expr)
local keys = { }
-- local expression = lpegmatch(pattern,expr,start,keys)
local expression = lpegmatch(pattern,expr,1,keys)
- -- report("compiling expression: %s",expr)
+ if trace_match then
+ report("compiling expression: %s",expr)
+ end
local definitions = { }
for k, v in next, keys do
definitions[#definitions+1] = v
end
+ if #definitions == 0 then
+ report("invalid expression: %s",expr)
+ elseif trace_match then
+ for i=1,#definitions do
+ report("% 3i : %s",i,definitions[i])
+ end
+ end
definitions = concat(definitions,"\n")
local code = f_template(definitions,expression)
- -- report("generated code: %s",code)
+ if trace_match then
+ report("generated code: %s",code)
+ end
code = loadstring(code)
if type(code) == "function" then
code = code()
@@ -121,6 +136,8 @@ local function compile(expr)
return false
end
+-- print(lpegmatch(pattern,"match ( author:cleveland and year:1993 ) "),1,{})
+
-- compile([[match(key:"foo bar")]])
-- compile([[match(key:'foo bar')]])
-- compile([[match(key:{foo bar})]])
diff --git a/tex/context/base/publ-imp-aps.mkvi b/tex/context/base/publ-imp-aps.mkvi
index 7af8efead..49f5eaf73 100644
--- a/tex/context/base/publ-imp-aps.mkvi
+++ b/tex/context/base/publ-imp-aps.mkvi
@@ -153,7 +153,7 @@
\stoptexdefinition
\starttexdefinition btx:aps:pages
- \btxif {pages} {
+ \btxdoif {pages} {
\btxcomma
\btxoneorrange {pages} {
\btxlabeltext{aps:p}
@@ -319,7 +319,7 @@
\btxflush{series}
}
}
- \btxif {chapter} {
+ \btxdoif {chapter} {
\btxcomma
\btxflush{chapter}
}
@@ -376,7 +376,7 @@
\texdefinition{btx:aps:publisher}
\btxflush{year}
\btxrparent
- \btxif {edition} {
+ \btxdoif {edition} {
\btxcomma
\btxflush{edition}
\btxspace
@@ -410,7 +410,7 @@
}
} {
\btxdoifelse {crossref} {
- \btxif {chapter} {
+ \btxdoif {chapter} {
\btxcomma
\btxflush{chapter}
}
@@ -432,7 +432,7 @@
\btxlabeltext{aps:volume}% vol.
\btxnbsp
\btxflush{volume}
- \btxif {series} {
+ \btxdoif {series} {
\btxnbsp
\btxlabeltext{aps:of}
\btxnbsp
@@ -499,11 +499,11 @@
\stopsetups
\startsetups btx:aps:manual
- \btxif {title} {
+ \btxdoif {title} {
\texdefinition {btx:aps:italic} {
\btxflush{title}
}
- \btxif {series} {
+ \btxdoif {series} {
\btxlparent
\btxflush{series}
\btxrparent
@@ -512,18 +512,18 @@
}
\btxdoifelse {year} {
\btxlparent
- \btxif {organization} {
+ \btxdoif {organization} {
\btxflush{organization}
\btxcomma
}
- \btxif {city} {
+ \btxdoif {city} {
\btxflush{organization}
\btxcomma
}
\btxflush{year}
\btxrparent
% st\or nd\or rd\else th\fi
- \btxif {edition} {
+ \btxdoif {edition} {
\btxcomma
\btxflush{edition}
\btxspace
@@ -543,7 +543,7 @@
\btxdoifelse {author} {
\btxflushauthor {author}
} {
- \btxif {key} {
+ \btxdoif {key} {
\btxsetup{ntx:format:key}
\btxcomma
}
@@ -573,17 +573,17 @@
\btxflush{series}
}
}
- \btxif {chapter} {
+ \btxdoif {chapter} {
\btxcomma
\btxflush{chapter}
}
\btxspace
- \btxif {year} {
+ \btxdoif {year} {
\btxlparent
\btxflush{year}
\btxrparent
\texdefinition{btx:aps:publisher}
- \btxif {edition} {
+ \btxdoif {edition} {
\btxcomma
\btxflush{edition}
\btxlabeltext{aps:edition}% ed.
@@ -593,10 +593,10 @@
\btxperiod
} {
\btxlabeltext{aps:In}
- \btxif {crossref} {
+ \btxdoif {crossref} {
\btxflush{crossref}
}
- \btxif {chapter} {
+ \btxdoif {chapter} {
\btxcomma
\btxflush{chapter}
\btxspace
@@ -719,7 +719,7 @@
\btxrparent
}
\texdefinition{btx:aps:pages}
- \btxif {city} {
+ \btxdoif {city} {
\btxcomma
\btxflush{city}
}
@@ -835,16 +835,16 @@
\btxflush{year}
\btxrparent
} {
- \btxif {published} {
+ \btxdoif {published} {
\btxcomma
\btxflush{published}
}
}
- \btxif {pages} {
+ \btxdoif {pages} {
\btxcomma
\btxflush{pages}
}
- \btxif {print} {
+ \btxdoif {print} {
% eprint
\btxcomma
\btxflush{print}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index e75a657d3..9dc680772 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 564b9ee68..3936e2e7c 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-def.mkiv b/tex/context/base/strc-def.mkiv
index 0738bdf29..2f5116459 100644
--- a/tex/context/base/strc-def.mkiv
+++ b/tex/context/base/strc-def.mkiv
@@ -220,19 +220,19 @@
[\c!before={\blank[\v!preference,\v!big]}, % sort of mkii compatible, watch columns
\c!after=\blank,
\c!label=\v!yes,
- \c!distance=1em]
+ \c!distance=\emwidth]
\setuplist
[\v!chapter]
[\c!before={\blank[\v!preference,\v!big]}, % sort of mkii compatible, watch columns
\c!after=]
-\setuplist [\v!part] [\c!width=0em]
-\setuplist [\v!chapter] [\c!width=2em]
-\setuplist [\v!section] [\c!width=3em]
-\setuplist [\v!subsection] [\c!width=4em]
-\setuplist [\v!subsubsection] [\c!width=5em]
-\setuplist [\v!subsubsubsection] [\c!width=6em]
-\setuplist [\v!subsubsubsubsection] [\c!width=7em]
+\setuplist [\v!part] [\c!width=0\emwidth]
+\setuplist [\v!chapter] [\c!width=2\emwidth]
+\setuplist [\v!section] [\c!width=3\emwidth]
+\setuplist [\v!subsection] [\c!width=4\emwidth]
+\setuplist [\v!subsubsection] [\c!width=5\emwidth]
+\setuplist [\v!subsubsubsection] [\c!width=6\emwidth]
+\setuplist [\v!subsubsubsubsection] [\c!width=7\emwidth]
\protect \endinput
diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua
index 8e83bbafa..90da5cfe4 100644
--- a/tex/context/base/trac-log.lua
+++ b/tex/context/base/trac-log.lua
@@ -9,69 +9,11 @@ if not modules then modules = { } end modules ['trac-log'] = {
-- In fact all writes could go through lua and we could write the console and
-- terminal handler in lua then. Ok, maybe it's slower then, so a no-go.
--- if tex and (tex.jobname or tex.formatname) then
---
--- -- quick hack, awaiting speedup in engine (8 -> 6.4 sec for --make with console2)
--- -- still needed for luajittex
---
--- local texio_write_nl = texio.write_nl
--- local texio_write = texio.write
--- local io_write = io.write
---
--- local write_nl = function(target,...)
--- if not io_write then
--- io_write = io.write
--- end
--- if target == "term and log" then
--- texio_write_nl("log",...)
--- texio_write_nl("term","")
--- io_write(...)
--- elseif target == "log" then
--- texio_write_nl("log",...)
--- elseif target == "term" then
--- texio_write_nl("term","")
--- io_write(...)
--- else
--- texio_write_nl("log",target,...)
--- texio_write_nl("term","")
--- io_write(target,...)
--- end
--- end
---
--- local write = function(target,...)
--- if not io_write then
--- io_write = io.write
--- end
--- if target == "term and log" then
--- texio_write("log",...)
--- io_write(...)
--- elseif target == "log" then
--- texio_write("log",...)
--- elseif target == "term" then
--- io_write(...)
--- else
--- texio_write("log",target,...)
--- io_write(target,...)
--- end
--- end
---
--- texio.write = write
--- texio.write_nl = write_nl
---
--- else
---
--- -- texlua or just lua
---
--- end
-
--- todo: less categories, more subcategories (e.g. nodes)
--- todo: split into basics and ctx specific
-
+local next, type, select, print = next, type, select, print
local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write
local format, gmatch, find = string.format, string.gmatch, string.find
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
@@ -81,6 +23,14 @@ local formatters = string.formatters
local texgetcount = tex and tex.getcount
+-- variant is set now
+
+local variant = "default"
+-- local variant = "ansi"
+
+-- todo: less categories, more subcategories (e.g. nodes)
+-- todo: split into basics and ctx specific
+
--[[ldx--
<p>This is a prelude to a more extensive logging module. We no longer
provide <l n='xml'/> based logging as parsing is relatively easy anyway.</p>
@@ -114,12 +64,12 @@ wiki : http://contextgarden.net
-- [[local chruni = utilities.strings.chruni]]
-- )
-utilities.strings.formatters.add (
+formatters.add (
formatters, "unichr",
[["U+" .. format("%%05X",%s) .. " (" .. utfchar(%s) .. ")"]]
)
-utilities.strings.formatters.add (
+formatters.add (
formatters, "chruni",
[[utfchar(%s) .. " (U+" .. format("%%05X",%s) .. ")"]]
)
@@ -154,18 +104,125 @@ local report, subreport, status, settarget, setformats, settranslations
local direct, subdirect, writer, pushtarget, poptarget, setlogfile, settimedlog, setprocessor, setformatters
+-- we use formatters but best check for % then because for simple messages but
+-- we don't want this overhead for single messages (not that there are that
+-- many; we could have a special weak table)
+
if tex and (tex.jobname or tex.formatname) then
- -- local format = string.formatter
+ local function useluawrites()
+
+ -- quick hack, awaiting speedup in engine (8 -> 6.4 sec for --make with console2)
+ -- still needed for luajittex .. luatex should not have that ^^ mess
+
+ local texio_write_nl = texio.write_nl
+ local texio_write = texio.write
+ local io_write = io.write
+
+ write_nl = function(target,...)
+ if not io_write then
+ io_write = io.write
+ end
+ if target == "term and log" then
+ texio_write_nl("log",...)
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target == "log" then
+ texio_write_nl("log",...)
+ elseif target == "term" then
+ texio_write_nl("term","")
+ io_write(...)
+ elseif target ~= "none" then
+ texio_write_nl("log",target,...)
+ texio_write_nl("term","")
+ io_write(target,...)
+ end
+ end
+
+ write = function(target,...)
+ if not io_write then
+ io_write = io.write
+ end
+ if target == "term and log" then
+ texio_write("log",...)
+ io_write(...)
+ elseif target == "log" then
+ texio_write("log",...)
+ elseif target == "term" then
+ io_write(...)
+ elseif target ~= "none" then
+ texio_write("log",target,...)
+ io_write(target,...)
+ end
+ end
- local valueiskey = { __index = function(t,k) t[k] = k return k end } -- will be helper
+ texio.write = write
+ texio.write_nl = write_nl
- local target = "term and log"
+ useluawrites = ignore
- logs.flush = io.flush
+ end
+
+ -- local format = string.formatter
+
+ local whereto = "both"
+ local target = nil
+ local targets = nil
+
+ local formats = table.setmetatableindex("self")
+ local translations = table.setmetatableindex("self")
+
+ local report_yes, subreport_yes, direct_yes, subdirect_yes, status_yes
+ local report_nop, subreport_nop, direct_nop, subdirect_nop, status_nop
+
+ local variants = {
+ default = {
+ formats = {
+ report_yes = formatters["%-15s > %s\n"],
+ report_nop = formatters["%-15s >\n"],
+ direct_yes = formatters["%-15s > %s"],
+ direct_nop = formatters["%-15s >"],
+ subreport_yes = formatters["%-15s > %s > %s\n"],
+ subreport_nop = formatters["%-15s > %s >\n"],
+ subdirect_yes = formatters["%-15s > %s > %s"],
+ subdirect_nop = formatters["%-15s > %s >"],
+ status_yes = formatters["%-15s : %s\n"],
+ status_nop = formatters["%-15s :\n"],
+ },
+ targets = {
+ logfile = "log",
+ log = "log",
+ file = "log",
+ console = "term",
+ terminal = "term",
+ both = "term and log",
+ },
+ },
+ ansi = {
+ formats = {
+ report_yes = formatters["%-15s > %s\n"],
+ report_nop = formatters["%-15s >\n"],
+ direct_yes = formatters["%-15s > %s"],
+ direct_nop = formatters["%-15s >"],
+ subreport_yes = formatters["%-15s > %s > %s\n"],
+ subreport_nop = formatters["%-15s > %s >\n"],
+ subdirect_yes = formatters["%-15s > %s > %s"],
+ subdirect_nop = formatters["%-15s > %s >"],
+ status_yes = formatters["%-15s : %s\n"],
+ status_nop = formatters["%-15s :\n"],
+ },
+ targets = {
+ logfile = "none",
+ log = "none",
+ file = "none",
+ console = "term",
+ terminal = "term",
+ both = "term",
+ },
+ }
+ }
- local formats = { } setmetatable(formats, valueiskey)
- local translations = { } setmetatable(translations,valueiskey)
+ logs.flush = io.flush
writer = function(...)
write_nl(target,...)
@@ -175,13 +232,6 @@ if tex and (tex.jobname or tex.formatname) then
write_nl(target,"\n")
end
- local report_yes = formatters["%-15s > %s\n"]
- local report_nop = formatters["%-15s >\n"]
-
- -- we can use formatters but best check for % then because for simple messages
- -- we con't want this overhead for single messages (not that there are that
- -- many; we could have a special weak table)
-
report = function(a,b,c,...)
if c then
write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
@@ -194,9 +244,6 @@ if tex and (tex.jobname or tex.formatname) then
end
end
- local direct_yes = formatters["%-15s > %s"]
- local direct_nop = formatters["%-15s >"]
-
direct = function(a,b,c,...)
if c then
return direct_yes(translations[a],formatters[formats[b]](c,...))
@@ -209,9 +256,6 @@ if tex and (tex.jobname or tex.formatname) then
end
end
- local subreport_yes = formatters["%-15s > %s > %s\n"]
- local subreport_nop = formatters["%-15s > %s >\n"]
-
subreport = function(a,s,b,c,...)
if c then
write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
@@ -224,9 +268,6 @@ if tex and (tex.jobname or tex.formatname) then
end
end
- local subdirect_yes = formatters["%-15s > %s > %s"]
- local subdirect_nop = formatters["%-15s > %s >"]
-
subdirect = function(a,s,b,c,...)
if c then
return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
@@ -239,9 +280,6 @@ if tex and (tex.jobname or tex.formatname) then
end
end
- local status_yes = formatters["%-15s : %s\n"]
- local status_nop = formatters["%-15s :\n"]
-
status = function(a,b,c,...)
if c then
write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
@@ -254,17 +292,13 @@ if tex and (tex.jobname or tex.formatname) then
end
end
- local targets = {
- logfile = "log",
- log = "log",
- file = "log",
- console = "term",
- terminal = "term",
- both = "term and log",
- }
-
- settarget = function(whereto)
- target = targets[whereto or "both"] or targets.both
+ settarget = function(askedwhereto)
+ whereto = askedwhereto or whereto or "both"
+ target = targets[whereto]
+ if not target then
+ whereto = "both"
+ target = targets[whereto]
+ end
if target == "term" or target == "term and log" then
logs.flush = io.flush
else
@@ -300,24 +334,81 @@ if tex and (tex.jobname or tex.formatname) then
end
end
- setformatters = function(f)
- report_yes = f.report_yes or report_yes
- report_nop = f.report_nop or report_nop
- subreport_yes = f.subreport_yes or subreport_yes
- subreport_nop = f.subreport_nop or subreport_nop
- direct_yes = f.direct_yes or direct_yes
- direct_nop = f.direct_nop or direct_nop
- subdirect_yes = f.subdirect_yes or subdirect_yes
- subdirect_nop = f.subdirect_nop or subdirect_nop
- status_yes = f.status_yes or status_yes
- status_nop = f.status_nop or status_nop
+ setformatters = function(specification)
+ local t = nil
+ local f = nil
+ local d = variants.default
+ if not specification then
+ --
+ elseif type(specification) == "table" then
+ t = specification.targets
+ f = specification.formats or specification
+ else
+ local v = variants[specification]
+ if v then
+ t = v.targets
+ f = v.formats
+ variant = specification
+ end
+ end
+ targets = t or d.targets
+ target = targets[whereto] or target
+ if f then
+ d = d.formats
+ else
+ f = d.formats
+ d = f
+ end
+ setmetatableindex(f,d)
+ report_yes = f.report_yes
+ report_nop = f.report_nop
+ subreport_yes = f.subreport_yes
+ subreport_nop = f.subreport_nop
+ direct_yes = f.direct_yes
+ direct_nop = f.direct_nop
+ subdirect_yes = f.subdirect_yes
+ subdirect_nop = f.subdirect_nop
+ status_yes = f.status_yes
+ status_nop = f.status_nop
+ if variant == "ansi" then
+ useluawrites() -- because tex escapes ^^
+ end
+ settarget(whereto)
end
+ setformatters(variant)
+
setlogfile = ignore
settimedlog = ignore
else
+ local report_yes, subreport_yes, status_yes
+ local report_nop, subreport_nop, status_nop
+
+ local variants = {
+ default = {
+ formats = {
+ report_yes = formatters["%-15s | %s"],
+ report_nop = formatters["%-15s |"],
+ subreport_yes = formatters["%-15s | %s | %s"],
+ subreport_nop = formatters["%-15s | %s |"],
+ status_yes = formatters["%-15s : %s\n"],
+ status_nop = formatters["%-15s :\n"],
+ },
+ },
+ ansi = {
+ formats = {
+ report_yes = formatters["%-15s | %s"],
+ report_nop = formatters["%-15s |"],
+ subreport_yes = formatters["%-15s | %s | %s"],
+ subreport_nop = formatters["%-15s | %s |"],
+ status_yes = formatters["%-15s : %s\n"],
+ status_nop = formatters["%-15s :\n"],
+ },
+ },
+ }
+
logs.flush = ignore
writer = function(s)
@@ -328,9 +419,6 @@ else
write_nl("\n")
end
- local report_yes = formatters["%-15s | %s"]
- local report_nop = formatters["%-15s |"]
-
report = function(a,b,c,...)
if c then
write_nl(report_yes(a,formatters[b](c,...)))
@@ -343,9 +431,6 @@ else
end
end
- local subreport_yes = formatters["%-15s | %s | %s"]
- local subreport_nop = formatters["%-15s | %s |"]
-
subreport = function(a,sub,b,c,...)
if c then
write_nl(subreport_yes(a,sub,formatters[b](c,...)))
@@ -358,9 +443,6 @@ else
end
end
- local status_yes = formatters["%-15s : %s\n"]
- local status_nop = formatters["%-15s :\n"]
-
status = function(a,b,c,...) -- not to be used in lua anyway
if c then
write_nl(status_yes(a,formatters[b](c,...)))
@@ -389,15 +471,36 @@ else
end
end
- setformatters = function(f)
- report_yes = f.report_yes or report_yes
- report_nop = f.report_nop or report_nop
- subreport_yes = f.subreport_yes or subreport_yes
- subreport_nop = f.subreport_nop or subreport_nop
- status_yes = f.status_yes or status_yes
- status_nop = f.status_nop or status_nop
+ setformatters = function(specification)
+ local f = nil
+ local d = variants.default
+ if specification then
+ if type(specification) == "table" then
+ f = specification.formats or specification
+ else
+ local v = variants[specification]
+ if v then
+ f = v.formats
+ end
+ end
+ end
+ if f then
+ d = d.formats
+ else
+ f = d.formats
+ d = f
+ end
+ setmetatableindex(f,d)
+ report_yes = f.report_yes
+ report_nop = f.report_nop
+ subreport_yes = f.subreport_yes
+ subreport_nop = f.subreport_nop
+ status_yes = f.status_yes
+ status_nop = f.status_nop
end
+ setformatters(variant)
+
setlogfile = function(name,keepopen)
if name and name ~= "" then
local localtime = os.localtime
@@ -728,13 +831,13 @@ logs.simpleline = simple
-- obsolete
-function logs.setprogram () end -- obsolete
-function logs.extendbanner() end -- obsolete
-function logs.reportlines () end -- obsolete
-function logs.reportbanner() end -- obsolete
-function logs.reportline () end -- obsolete
-function logs.simplelines () end -- obsolete
-function logs.help () end -- obsolete
+logs.setprogram = ignore -- obsolete
+logs.extendbanner = ignore -- obsolete
+logs.reportlines = ignore -- obsolete
+logs.reportbanner = ignore -- obsolete
+logs.reportline = ignore -- obsolete
+logs.simplelines = ignore -- obsolete
+logs.help = ignore -- obsolete
-- applications
diff --git a/tex/context/base/util-str.lua b/tex/context/base/util-str.lua
index fd6fc4d91..8529c3ad0 100644
--- a/tex/context/base/util-str.lua
+++ b/tex/context/base/util-str.lua
@@ -537,7 +537,7 @@ end
-- We could probably use just %s with integers but who knows what Lua 5.3 will do? So let's
-- for the moment use %i.
-local format_F = function() -- beware, no cast to number
+local format_F = function(f) -- beware, no cast to number
n = n + 1
if not f or f == "" then
return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or format((a%s %% 1 == 0) and '%%i' or '%%.9f',a%s))",n,n,n,n)
diff --git a/tex/context/base/x-cals.lua b/tex/context/base/x-cals.lua
index 36bc1aaba..13f0e2bbe 100644
--- a/tex/context/base/x-cals.lua
+++ b/tex/context/base/x-cals.lua
@@ -65,8 +65,10 @@ end
local function getspecs(root, pattern, names, widths)
-- here, but actually we need this in core-ntb.tex
-- but ideally we need an mkiv enhanced core-ntb.tex
- local ignore_widths = cals.ignore_widths
- local shrink_widths = cals.shrink_widths
+ local ignore_widths = cals.ignore_widths
+-- local shrink_widths = at.option == "shrink" or cals.shrink_widths
+-- local stretch_widths = at.option == "stretch" or cals.stretch_widths
+ local shrink_widths = cals.shrink_widths
local stretch_widths = cals.stretch_widths
for e in xmlcollected(root,pattern) do
local at = e.at
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 5f4d5c1dd..d58fa5f1c 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/06/14 20:59:58
+-- merge date : 09/18/14 11:17:09
do -- begin closure to overcome local limits and interference
@@ -2940,7 +2940,7 @@ local format_f=function(f)
n=n+1
return format("format('%%%sf',a%s)",f,n)
end
-local format_F=function()
+local format_F=function(f)
n=n+1
if not f or f=="" then
return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or format((a%s %% 1 == 0) and '%%i' or '%%.9f',a%s))",n,n,n,n)