diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-02-25 20:49:38 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-02-25 20:49:38 +0100 |
commit | 2d50de713c23ec150dab395dcbce69b854db2d58 (patch) | |
tree | 7f071526a9f838d07b66837ef15864c17628b03a | |
parent | 661fb34ced40815e1e5e9073de9c8475127da094 (diff) | |
download | context-2d50de713c23ec150dab395dcbce69b854db2d58.tar.gz |
2018-02-25 19:57:00
50 files changed, 500 insertions, 142 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 0d929224b..c2e8696bb 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex 3e27696a7..eb930b5a2 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex 320425cce..ae9a39d06 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex 7e223100f..489ca3bc3 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex dbf1c98e1..2a7cc118d 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf Binary files differindex 7a4e48567..b6d141d2e 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf Binary files differindex 48ba62868..afa91c4b9 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf Binary files differindex f022b0450..19dda0007 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf Binary files differindex 71704b5fc..0e9dc1e55 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf Binary files differindex 5024c50ef..60d0349d8 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf Binary files differindex 5898f674d..487b218c1 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf Binary files differindex c3a148d00..65b3ecd8f 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex ccff57ad6..103ef368d 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex 8fdb83307..ec7796d6c 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/doc/context/scripts/mkiv/mtx-modules.html b/doc/context/scripts/mkiv/mtx-modules.html index 5bbed809e..279b728b0 100644 --- a/doc/context/scripts/mkiv/mtx-modules.html +++ b/doc/context/scripts/mkiv/mtx-modules.html @@ -42,6 +42,7 @@ <tr><th>--convert</th><td></td><td>convert source files (tex, mkii, mkiv, mp) to 'ted' files</td></tr> <tr><th>--process</th><td></td><td>process source files (tex, mkii, mkiv, mp) to 'pdf' files</td></tr> <tr><th>--prep</th><td></td><td>use original name with suffix 'prep' appended</td></tr> + <tr><th>--direct</th><td></td><td>use old method instead of extra</td></tr> </table> <br/> </div> diff --git a/doc/context/scripts/mkiv/mtx-modules.man b/doc/context/scripts/mkiv/mtx-modules.man index c0441a93d..2ca40f90f 100644 --- a/doc/context/scripts/mkiv/mtx-modules.man +++ b/doc/context/scripts/mkiv/mtx-modules.man @@ -19,6 +19,9 @@ process source files (tex, mkii, mkiv, mp) to 'pdf' files .TP .B --prep use original name with suffix 'prep' appended +.TP +.B --direct +use old method instead of extra .SH AUTHOR More information about ConTeXt and the tools that come with it can be found at: diff --git a/doc/context/scripts/mkiv/mtx-modules.xml b/doc/context/scripts/mkiv/mtx-modules.xml index fe0311d16..4016c8158 100644 --- a/doc/context/scripts/mkiv/mtx-modules.xml +++ b/doc/context/scripts/mkiv/mtx-modules.xml @@ -11,6 +11,7 @@ <flag name="convert"><short>convert source files (tex, mkii, mkiv, mp) to 'ted' files</short></flag> <flag name="process"><short>process source files (tex, mkii, mkiv, mp) to 'pdf' files</short></flag> <flag name="prep"><short>use original name with suffix 'prep' appended</short></flag> + <flag name="direct"><short>use old method instead of extra</short></flag> </subcategory> </category> </flags> diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index f4fd87119..daa583cbd 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -39,7 +39,8 @@ The \type {node.values} function reports some used values. Valid arguments are \type {dir}, \type {direction}, \type {glue}, \type {pdf_literal}, \type {pdf_action}, \type {pdf_window} and \type {color_stack}. Keep in mind that the setters normally expect a number, but this helper gives you a list of what -numbers matter. +numbers matter. For practical reason the \type {pagestate} values are also +reported with this helper. \subsection{Attributes} diff --git a/scripts/context/lua/mtx-modules.lua b/scripts/context/lua/mtx-modules.lua index 572e6a304..e791c204c 100644 --- a/scripts/context/lua/mtx-modules.lua +++ b/scripts/context/lua/mtx-modules.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['mtx-modules'] = { license = "see context related readme files" } +-- should be an extra + scripts = scripts or { } scripts.modules = scripts.modules or { } @@ -23,6 +25,7 @@ local helpinfo = [[ <flag name="convert"><short>convert source files (tex, mkii, mkiv, mp) to 'ted' files</short></flag> <flag name="process"><short>process source files (tex, mkii, mkiv, mp) to 'pdf' files</short></flag> <flag name="prep"><short>use original name with suffix 'prep' appended</short></flag> + <flag name="direct"><short>use old method instead of extra</short></flag> </subcategory> </category> </flags> @@ -160,32 +163,51 @@ local function source_to_ted(inpname,outname,filetype) return true end -local suffixes = table.tohash { 'tex','mkii','mkiv', 'mkvi', 'mp' } +local suffixes = table.tohash { 'tex', 'mkii', 'mkiv', 'mkvi', 'mp', 'mpii', 'mpiv' } function scripts.modules.process(runtex) local processed = { } - local prep = environment.argument("prep") - local files = environment.files - for i=1,#files do - local shortname = files[i] - local suffix = file.suffix(shortname) - if suffixes[suffix] then - local longname - if prep then - longname = shortname .. ".prep" - else - longname = file.removesuffix(shortname) .. "-" .. suffix .. ".ted" - end - local done = source_to_ted(shortname,longname) - if done and runtex then - os.execute(format("mtxrun --script context --usemodule=mod-01 --purge %s",longname)) - processed[#processed+1] = longname + local files = environment.files + if environment.arguments.direct then + local prep = environment.argument("prep") + for i=1,#files do + local shortname = files[i] + local suffix = file.suffix(shortname) + if suffixes[suffix] then + local longname + if prep then + longname = shortname .. ".prep" + else + longname = file.removesuffix(shortname) .. "-" .. suffix .. ".ted" + end + local done = source_to_ted(shortname,longname) + if done and runtex then + local command = format("mtxrun --script context --usemodule=modules-basics --purge %s",longname) + report() + report("running: %s",command) + report() + os.execute(command) + processed[#processed+1] = longname + end end end + else + for i=1,#files do + local name = files[i] + local only = file.nameonly(name) + local command = format("mtxrun --script context --extra=module --result=%s %s",only,name) + report() + report("running: %s",command) + report() + os.execute(command) + processed[#processed+1] = command + end end - for i=1,#processed do - local name = processed[i] - report("modules","processed: %s",name) + if #processed > 0 then + report() + for i=1,#processed do + report("processed: %s",processed[i]) + end end end diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 0ae066a63..ccba6be79 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.02.23 22:11} +\newcontextversion{2018.02.25 19:48} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 4e584f125..4c8a44aac 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.02.23 22:11} +\edef\contextversion{2018.02.25 19:48} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii index 19ec32e10..38fb2de40 100644 --- a/tex/context/base/mkii/mult-it.mkii +++ b/tex/context/base/mkii/mult-it.mkii @@ -1077,6 +1077,7 @@ \setinterfaceconstant{preview}{anteprima} \setinterfaceconstant{previous}{precedente} \setinterfaceconstant{previousnumber}{numeroprecedente} +\setinterfaceconstant{print}{print} \setinterfaceconstant{printable}{stampabile} \setinterfaceconstant{process}{process} \setinterfaceconstant{profile}{profile} diff --git a/tex/context/base/mkiv/cont-fil.mkiv b/tex/context/base/mkiv/cont-fil.mkiv index efadd8ca4..ed1a873f3 100644 --- a/tex/context/base/mkiv/cont-fil.mkiv +++ b/tex/context/base/mkiv/cont-fil.mkiv @@ -139,6 +139,8 @@ \definefilesynonym [syn-01] [syntax] +\definefilesynonym [mod-01] [modules-basics] + \definefilesynonym [reg-01] [regimes-list] \definefilesynonym [set-11] [setups-basics] diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index d0dc335c9..f88f14fa6 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.02.23 22:11} +\newcontextversion{2018.02.25 19:48} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 2f889f572..c5122398c 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.02.23 22:11} +\edef\contextversion{2018.02.25 19:48} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/lang-url.lua b/tex/context/base/mkiv/lang-url.lua index 24a5b9863..651c6bd52 100644 --- a/tex/context/base/mkiv/lang-url.lua +++ b/tex/context/base/mkiv/lang-url.lua @@ -194,7 +194,6 @@ local function action(hyphenatedurl,str,left,right,disc) end end list = concat(list) - print(list) context(list) end diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua index 5fe064030..4ccbd0e4f 100644 --- a/tex/context/base/mkiv/lpdf-mis.lua +++ b/tex/context/base/mkiv/lpdf-mis.lua @@ -15,8 +15,9 @@ if not modules then modules = { } end modules ['lpdf-mis'] = { -- referencing and references had to be tracked in multiple passes. Of -- course there are a couple of more changes. -local next, tostring = next, tostring +local next, tostring, type = next, tostring, type local format, gsub, formatters = string.format, string.gsub, string.formatters +local flattened = table.flattened local texset, texget = tex.set, tex.get local backends, lpdf, nodes = backends, lpdf, nodes @@ -364,6 +365,7 @@ local pagespecs = { local pagespec, topoffset, leftoffset, height, width, doublesided = "default", 0, 0, 0, 0, false local cropoffset, bleedoffset, trimoffset, artoffset = 0, 0, 0, 0 +local marked = false local copies = false function codeinjections.setupcanvas(specification) @@ -381,6 +383,7 @@ function codeinjections.setupcanvas(specification) leftoffset = specification.leftoffset or 0 height = specification.height or texget("pageheight") width = specification.width or texget("pagewidth") + marked = specification.print -- copies = specification.copies if copies and copies < 2 then @@ -439,13 +442,23 @@ local function documentspecification() if mode then addtocatalog("PageMode",pdfconstant(mode)) end - if fit or fixed or duplex or copies or paper then + local prints = nil + if marked then + local pages = structures.pages + local marked = pages.allmarked(marked) + local nofmarked = marked and #marked or 0 + if nofmarked > 0 then + prints = pdfarray(flattened(pages.toranges(marked))) + end + end + if fit or fixed or duplex or copies or paper or marked then addtocatalog("ViewerPreferences",pdfdictionary { FitWindow = fit and true or nil, PrintScaling = fixed and pdfconstant("None") or nil, Duplex = duplex and pdfconstant(duplex) or nil, NumCopies = copies and copies or nil, PickTrayByPDFSize = paper and true or nil, + PrintPageRange = prints or nil, }) end addtoinfo ("Trapped", pdfconstant("False")) -- '/Trapped' in /Info, 'Trapped' in XMP diff --git a/tex/context/base/mkiv/mtx-context-module.tex b/tex/context/base/mkiv/mtx-context-module.tex new file mode 100644 index 000000000..d754f5305 --- /dev/null +++ b/tex/context/base/mkiv/mtx-context-module.tex @@ -0,0 +1,166 @@ +%D \module +%D [ file=mtx-context-modules, +%D version=2018.02.24, % very old stuff, now also as extra +%D title=\CONTEXT\ Extra Trickry, +%D subtitle=Module TYpesetting, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is a \TEXEXEC\ features that has been moved to \MKIV. + +% begin help +% +% usage: context --extra=listing [options] list-of-files +% +% end help + +\input mtx-context-common.tex + +\usemodule[scite] +\usemodule[modules-basics] + +\dontcomplain + +\starttext + +\startluacode + local find, gsub, match, sub = string.find, string.gsub, string.match, string.sub + local formatters, strip, splitlines, is_empty = string.formatters, string.strip, string.splitlines, string.is_empty + + local types = { + mkiv = "tex", + mkii = "tex", + cld = "lua", + lfg = "lua", + mpiv = "mp", + mpii = "mp", + } + + local function process(inpname,filetype) + local data = io.loaddata(inpname) + if data and data ~= "" then + local result = { } + local skiplevel = 0 + local indocument = false + local indefinition = false + local started = false + local settings = formatters["type=%s"](filetype) + local preamble, n = lpeg.match(lpeg.Cs((1-lpeg.patterns.newline^2)^1) * lpeg.Cp(),data) + local r = 0 + if preamble then + preamble = match(preamble,"\\module.-%[(.-)%]") + if preamble then + preamble = gsub(preamble,"%%D *","") + preamble = gsub(preamble,"%%(.-)[\n\r]","") + preamble = gsub(preamble,"[\n\r]","") + preamble = strip(preamble) + settings = formatters["%s,%s"](settings,preamble) + data = sub(data,n,#data) + end + end + local lines = splitlines(data) + r = r + 1 ; result[r] = formatters["\\startmoduledocumentation[%s]"](settings) + for i=1,#lines do + local line = lines[i] + if find(line,"^%%D ") or find(line,"^%%D$") then + if skiplevel == 0 then + local someline = #line < 3 and "" or sub(line,4,#line) + if indocument then + r = r + 1 ; result[r] = someline + else + if indefinition then + r = r + 1 ; result[r] = "\\stopdefinition" + indefinition = false + end + if not indocument then + r = r + 1 ; result[r] = "\\startdocumentation" + end + r = r + 1 ; result[r] = someline + indocument = true + end + end + elseif find(line,"^%%M ") or find(line,"^%%M$") then + if skiplevel == 0 then + local someline = (#line < 3 and "") or sub(line,4,#line) + r = r + 1 ; result[r] = someline + end + elseif find(line,"^%%S B") then + skiplevel = skiplevel + 1 + elseif find(line,"^%%S E") then + skiplevel = skiplevel - 1 + elseif find(line,"^%%") then + -- nothing + elseif skiplevel == 0 then + inlocaldocument = indocument + inlocaldocument = false + local someline = line + if indocument then + r = r + 1 ; result[r] = "\\stopdocumentation" + indocument = false + end + if indefinition then + if is_empty(someline) then + r = r + 1 ; result[r] = "\\stopdefinition" + indefinition = false + else + r = r + 1 ; result[r] = someline + end + elseif not is_empty(someline) then + r = r + 1 ; result[r] = "\\startdefinition" + indefinition = true + if inlocaldocument then + -- nothing + else + r = r + 1 ; result[r] = someline + end + end + end + end + if indocument then + r = r + 1 ; result[r] = "\\stopdocumentation" + end + if indefinition then + r = r + 1 ; result[r] = "\\stopdefinition" + end + r = r + 1 ; result[r] = "\\stopmoduledocumentation" + result = table.concat(result,"\r") + buffers.assign("module",result) + context.getbuffer { "module" } + end + end + + local pattern = document.arguments.pattern + + if pattern then + document.files = dir.glob(pattern) + end + + local done = false + local files = document.files + + if #files > 0 then + if document.arguments.sort then + table.sort(files) + end + for i=1,#files do + local filename = files[i] + if not find(filename,"^mtx%-context%-") then + local suffix = file.extname(filename) or "" + process(filename,types[suffix] or suffix) + done = true + end + end + end + + if not done then + context("no files given") + end + +\stopluacode + +\stoptext diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index e15306c7c..925c22cd2 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -9863,6 +9863,10 @@ return { ["pe"]="شمارهقبلی", ["ro"]="numarprecedent", }, + ["print"]={ + ["en"]="print", + ["nl"]="print", + }, ["printable"]={ ["cs"]="tisknutelne", ["de"]="druckbar", diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv index 9ad33642b..c208baaf0 100644 --- a/tex/context/base/mkiv/pack-rul.mkiv +++ b/tex/context/base/mkiv/pack-rul.mkiv @@ -2476,6 +2476,7 @@ %D \dontcomplain %D %D \startbuffer +%D \unprotect %D \vbox to \vsize %D \bgroup %D \startalignment[middle] @@ -2509,6 +2510,7 @@ %D \vss %D \stopalignment %D \egroup +%D \protect %D \stopbuffer %D %D \getbuffer \page diff --git a/tex/context/base/mkiv/page-ini.lua b/tex/context/base/mkiv/page-ini.lua index 1aeae8f09..a02bbc892 100644 --- a/tex/context/base/mkiv/page-ini.lua +++ b/tex/context/base/mkiv/page-ini.lua @@ -6,46 +6,195 @@ if not modules then modules = { } end modules ['page-ini'] = { license = "see context related readme files" } -local tonumber, rawget = tonumber, rawget -local gmatch = string.gmatch +local tonumber, rawget, type, next = tonumber, rawget, type, next +local match = string.match +local sort, tohash, insert, remove = table.sort, table.tohash, table.insert, table.remove +local settings_to_array, settings_to_hash = utilities.parsers.settings_to_array, utilities.parsers.settings_to_hash local texgetcount = tex.getcount +local context = context local ctx_testcase = commands.testcase -local data = table.setmetatableindex("table") -local last = 0 +local data = table.setmetatableindex("table") +local last = 0 +local pages = structures.pages +local autolist = { } +local report = logs.reporter("pages","mark") -interfaces.implement { - name = "markpage", - arguments = { "string", "string" }, - actions = function(name,list) - local realpage = texgetcount("realpageno") - if list and list ~= "" then - for sign, page in gmatch(list,"([%+%-])(%d+)") do - page = tonumber(page) - if page then - if sign == "+" then - page = realpage + page +local trace = false trackers.register("pages.mark",function(v) trace = v end) + +function pages.mark(name,list) + local realpage = texgetcount("realpageno") + if not list or list == "" then + if trace then + report("marking current page %i as %a",realpage,name) + end + data[realpage][name] = true + return + end + if type(list) == "string" then + list = settings_to_array(list) + end + if type(list) == "table" then + for i=1,#list do + local page = list[i] + local sign = false + if type(page) == "string" then + sign, page = match(page,"([%+%-])(%d+)") + end + page = tonumber(page) + if page then + if sign == "+" then + page = realpage + page + end + if sign == "-" then + report("negative page numbers are not supported") + else + if trace then + report("marking page %i as %a",page,name) end data[page][name] = true end end - else - data[realpage][name] = true end + else + if trace then + report("marking current page %i as %a",realpage,name) + end + data[realpage][name] = true end +end + +function pages.marked(name) + local realpage = texgetcount("realpageno") + for i=last,realpage-1 do + data[i] = nil + end + local pagedata = rawget(data,realpage) + return pagedata and pagedata[name] +end + +local function toranges(marked) + local list = { } + local size = #marked + if size > 0 then + local first = marked[1] + local last = first + for i=2,size do + local page = marked[i] + if page > last + 1 then + list[#list+1] = { first, last } + first = page + end + last = page + end + list[#list+1] = { first, last } + end + return list +end + +pages.toranges = toranges + +local function allmarked(list) + if list then + local collected = pages.collected + if collected then + if type(list) == "string" then + list = settings_to_hash(list) + elseif type(list) == "table" and #list > 0 then + list = tohash(list) + end + if type(list) == "table" then + local found = { } + for name in next, list do + for page, list in next, data do + if list[name] and collected[page] then + found[#found+1] = page + end + end + end + if #found > 0 then + sort(found) + if trace then + local ranges = toranges(found) + for i=1,#ranges do + local range = ranges[i] + local first = range[1] + local last = range[2] + if first == last then + report("marked page : %i",first) + else + report("marked range: %i upto %i",first,last) + end + end + end + return found + end + end + end + end +end + +pages.allmarked = allmarked + +-- An alternative is to use an attribute and identify the state by parsing the node +-- list but that's a bit overkill for a hardly used feature like this. + +luatex.registerpageactions(function() + local nofauto = #autolist + if nofauto > 0 then + local realpage = texgetcount("realpageno") + for i=1,nofauto do + local names = autolist[i] + for j=1,#names do + local name = names[j] + data[realpage][name] = true + if trace then + report("automatically marking page %i as %a",realpage,name) + end + end + end + end +end) + +interfaces.implement { + name = "markpage", + arguments = { "string", "string" }, + actions = pages.mark } interfaces.implement { name = "doifelsemarkedpage", arguments = "string", + actions = { marked, ctx_testcase } +} + +interfaces.implement { + name = "markedpages", + arguments = "string", actions = function(name) - local realpage = texgetcount("realpageno") - for i=last,realpage-1 do - data[i] = nil + local t = allmarked(name) + if t then + context("%,t",t) + end + end +} + +interfaces.implement { + name = "startmarkpages", + arguments = "string", + actions = function(name) + insert(autolist,settings_to_array(name)) + end +} + +interfaces.implement { + name = "stopmarkpages", + arguments = "string", + actions = function(name) + if #autolist > 0 then + remove(autolist) end - local pagedata = rawget(data,realpage) - ctx_testcase(pagedata and pagedata[name]) end } diff --git a/tex/context/base/mkiv/page-ini.mkiv b/tex/context/base/mkiv/page-ini.mkiv index a2559481a..dc94edf76 100644 --- a/tex/context/base/mkiv/page-ini.mkiv +++ b/tex/context/base/mkiv/page-ini.mkiv @@ -316,9 +316,18 @@ \def\page_mark[#1][#2]% {\clf_markpage{#1}{#2}} +\def\markedpages[#1]% expandable + {\clf_markedpages{#1}} + \unexpanded\def\doifelsemarkedpage#1% {\clf_doifelsemarkedpage{#1}} +\unexpanded\def\startmarkpages[#1]% + {\clf_startmarkpages{#1}} + +\unexpanded\def\stopmarkpages + {\clf_stopmarkpages} + %D Experimental: \newconstant\c_page_force_strut_depth_trace_mode diff --git a/tex/context/base/mkiv/scrn-pag.lua b/tex/context/base/mkiv/scrn-pag.lua index bd65e53d9..4f77a7d24 100644 --- a/tex/context/base/mkiv/scrn-pag.lua +++ b/tex/context/base/mkiv/scrn-pag.lua @@ -41,6 +41,7 @@ implement { { "artoffset", "dimen" }, { "trimoffset", "dimen" }, { "copies", "integer" }, + { "print", "string" }, -- , tohash } } } diff --git a/tex/context/base/mkiv/scrn-pag.mkvi b/tex/context/base/mkiv/scrn-pag.mkvi index 573b61696..d96d8d3c1 100644 --- a/tex/context/base/mkiv/scrn-pag.mkvi +++ b/tex/context/base/mkiv/scrn-pag.mkvi @@ -228,6 +228,7 @@ bleedoffset \canvasbleedoffset artoffset \canvasartoffset copies \numexpr\interactionscreenparameter\c!copies\relax + print {\interactionscreenparameter\c!print}% \relax %\global\let\scrn_canvas_synchronize_simple \relax \global\let\scrn_canvas_synchronize_complex\relax} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex ea587d3a0..4b3857135 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex d8c1b019b..fea1f2b83 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml index 73bc84465..da7970619 100644 --- a/tex/context/interface/mkii/keys-it.xml +++ b/tex/context/interface/mkii/keys-it.xml @@ -1083,6 +1083,7 @@ <cd:constant name='preview' value='anteprima'/> <cd:constant name='previous' value='precedente'/> <cd:constant name='previousnumber' value='numeroprecedente'/> + <cd:constant name='print' value='print'/> <cd:constant name='printable' value='stampabile'/> <cd:constant name='process' value='process'/> <cd:constant name='profile' value='profile'/> diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 84101f798..83ef9fb62 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -16461,6 +16461,9 @@ <cd:parameter name="copies"> <cd:constant type="cd:number"/> </cd:parameter> + <cd:parameter name="print"> + <cd:constant type="cd:list"/> + </cd:parameter> <cd:parameter name="delay"> <cd:constant default="yes" type="none"/> <cd:constant type="cd:number"/> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 320425cce..ae9a39d06 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-interactionscreen.xml b/tex/context/interface/mkiv/i-interactionscreen.xml index 79c15428b..bf26cd962 100644 --- a/tex/context/interface/mkiv/i-interactionscreen.xml +++ b/tex/context/interface/mkiv/i-interactionscreen.xml @@ -51,6 +51,9 @@ <cd:parameter name="copies"> <cd:constant type="cd:number"/> </cd:parameter> + <cd:parameter name="print"> + <cd:constant type="cd:list"/> + </cd:parameter> <cd:parameter name="delay"> <cd:constant type="none" default="yes"/> <cd:constant type="cd:number"/> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex be59353a2..95cb45722 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/common/s-mod.ctx b/tex/context/modules/common/s-mod.ctx index 09ecf714c..3a086d0ba 100644 --- a/tex/context/modules/common/s-mod.ctx +++ b/tex/context/modules/common/s-mod.ctx @@ -17,7 +17,7 @@ </ctx:flags> <ctx:process> <ctx:resources> - <ctx:module>mod-01</ctx:module> + <ctx:module>modules-basics</ctx:module> </ctx:resources> </ctx:process> </ctx:job> diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv index 4e8c07df5..12b54b9ac 100644 --- a/tex/context/modules/mkiv/m-scite.mkiv +++ b/tex/context/modules/mkiv/m-scite.mkiv @@ -57,11 +57,11 @@ buffers.scite = scite -- context output: local f_def_color = formatters["\\definecolor[slxc%s][h=%02X%02X%02X]%%"] -local f_fore_none = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s#1}}%%"] -local f_fore_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s\\bf#1}}%%"] -local f_none_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\bf#1}}%%"] -local f_none_none = formatters["\\unexpanded\\def\\slx%s#1{{#1}}%%"] -local f_texstyled = formatters["\\slx%s{%s}"] +local f_fore_none = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s#1}\\slxbreak}%%"] +local f_fore_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s\\bf#1}\\slxbreak}%%"] +local f_none_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\bf#1}\\slxbreak}%%"] +local f_none_none = formatters["\\unexpanded\\def\\slx%s#1{{#1}\\slxbreak}%%"] +local f_texstyled = formatters["\\slx%s{%s}\\slxbreak"] local f_hanging = formatters["\\slxb{%r}%s\\slxe"] -- we need to round: lua 5.3 local v_none = interfaces.variables.none @@ -449,6 +449,9 @@ visualizers.register("txt", visualizer) {\stoplines \endgroup} +\unexpanded\def\slxbreak + {\allowbreak} + \protect \continueifinputfile{m-scite.mkiv} diff --git a/tex/context/modules/mkiv/s-mod-00.mkiv b/tex/context/modules/mkiv/s-mod-00.mkiv deleted file mode 100644 index 7af56dc2d..000000000 --- a/tex/context/modules/mkiv/s-mod-00.mkiv +++ /dev/null @@ -1,24 +0,0 @@ -%D \module -%D [ file=s-mod-00, -%D version=very-old, -%D title=\CONTEXT\ Style File, -%D subtitle=Documentation Base Environment, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -\startmode[nocode] - - % \definieerbuffer[definition] % ignore - - \def\startdefinition#1\stopdefinition{} - -\stopmode - -\protect \endinput diff --git a/tex/context/modules/mkiv/s-mod-02.mkiv b/tex/context/modules/mkiv/s-mod-02.mkiv deleted file mode 100644 index 37e3d2f14..000000000 --- a/tex/context/modules/mkiv/s-mod-02.mkiv +++ /dev/null @@ -1,24 +0,0 @@ -%D \module -%D [ file=s-mod-02, -%D version=very-old, -%D title=\CONTEXT\ Style File, -%D subtitle=Documentation Screen Environment, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -\startmode[nocode] - - % \definieerbuffer[definition] % ignore - - \def\startdefinition#1\stopdefinition{} - -\stopmode - -\protect \endinput diff --git a/tex/context/modules/mkiv/s-mod-01.mkiv b/tex/context/modules/mkiv/s-modules-basics.mkiv index f1c8d4258..74621b2a3 100644 --- a/tex/context/modules/mkiv/s-mod-01.mkiv +++ b/tex/context/modules/mkiv/s-modules-basics.mkiv @@ -25,11 +25,13 @@ %D him when you run into problems. Bugs in this style can be sent to %D Hans. -\usemodule - [abr-00] +\showframe -\setvariables - [document] +\usemodule[abbreviations-words] + +\startmodule[modules-basics] + +\setupdocument [ file=\jobname, type=unknown, version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, @@ -120,6 +122,11 @@ \setuppalet [module:\documentvariable{type}] + \setuptyping + [definition] + [lines=yes, + option=\documentvariable{type}] + \startTEXpage \useMPgraphic{page} \stopTEXpage @@ -181,20 +188,32 @@ \endgroup \stoptexdefinition -\definetyping [PL] [\c!option=PL] -\definetyping [JV] [\c!option=JV] -\definetyping [MP] [\c!option=MP] -\definetyping [TEX] [\c!option=TEX] -\definetyping [LUA] [\c!option=LUA] +% \definetyping [PL] [\c!option=PL] +% \definetyping [JV] [\c!option=JV] +% \definetyping [MP] [\c!option=MP] +% \definetyping [TEX] [\c!option=TEX] +% \definetyping [LUA] [\c!option=LUA] -\setuptyping [\v!typing] [\c!margin=\v!standard] -\setuptyping [\v!file] [\c!margin=\v!standard] -\setuptyping [definition] [\c!margin=0pt,\c!numbering=\v!line,\c!continue=\v!yes] % this continue wins +\setuptyping + [\v!typing] + [\c!margin=\v!standard, + \c!lines=\v!yes] + +\setuptyping + [\v!file] + [\c!margin=\v!standard, + \c!lines=\v!yes] + +\setuptyping + [definition] + [\c!margin=0pt, + \c!numbering=\v!line, + \c!continue=\v!yes, + \c!lines=\v!yes] \setuplinenumbering [definition] [\c!style=\ttx, - \c!distance=\leftmargindistance, \c!align=\v!flushright] % This will be cleaned up. @@ -206,7 +225,7 @@ \else \index{#1{#2}}% \fi - #1{\doboundtext{#2}{\leftmarginwidth}{..}}}} + \dontleavehmode#1{\doboundtext{#2}{\leftmarginwidth}{..}}}} \unexpanded\def\modulemarginstuff#1#2% to be renamed {\processcommalist[#2]{\domodulemarginstuff#1}} @@ -216,7 +235,7 @@ [left] [stack=yes, hoffset=2em, - style=\ttxx] + style=\ttxx\setstrut] \unexpanded\def\macros {\modulemarginstuff\tex } \unexpanded\def\extras {\modulemarginstuff\relax} @@ -257,11 +276,11 @@ % style (we use dejavu as it supports more characters) -\switchtobodyfont - [dejavu-condensed,10pt] % preload +\usebodyfont + [dejavu-condensed,9pt] % preload \setupbodyfont - [dejavu,10pt] % main font + [dejavu,9pt] % main font \mainlanguage [en] @@ -379,13 +398,6 @@ } -% bonus - -\usemodule - [abr-02] - -% another one - -\dontcomplain +\protect -\protect \endinput +\stopmodule diff --git a/tex/context/sample/common/greenfield.tex b/tex/context/sample/common/greenfield.tex new file mode 100644 index 000000000..3f832f98a --- /dev/null +++ b/tex/context/sample/common/greenfield.tex @@ -0,0 +1,9 @@ +But if you place a human brain, with its evolutionary mandate to adapt to its +environment, in an environment where there is no obvious linear sequence, where +facts can be accessed at random, where everything is reversible, where the gap +between stimulus and response is minimal, and above all where time is short, then +your train of thought could be derailed. Add in the sensory distractions of an +all|-|encompassing and vivid audio|-|visual universe encouraging shorter spans +for sustained attention, and you might become, as it were, a computer yourself: a +system responding efficiently and processing information very well, but devoid of +deeper thought. diff --git a/tex/context/sample/common/samples.tex b/tex/context/sample/common/samples.tex index a02e64e24..bf2cf4cfd 100644 --- a/tex/context/sample/common/samples.tex +++ b/tex/context/sample/common/samples.tex @@ -55,6 +55,9 @@ used in testing bibliographic references and citations. MO Black, fall 2016. \NC \NR \NC klein.tex \NC Naomi Klein \NC No is not enough, defeating the new shock politics, Allen Lane, 2017. \NC \NR +\NC greenfield.tex \NC Susan Greenfield \NC Mind Change, how digital technologies are leaving + their mark on the brain, + Rider, London, 2014. \NC \NR \stoptabulate % Tufte: This quote will always produce hyphenated text, apart from the content, diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index f274c4319..b741295b6 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 02/23/18 22:11:13 +-- merge date : 02/25/18 19:48:01 do -- begin closure to overcome local limits and interference diff --git a/tex/generic/context/luatex/luatex-gadgets.lua b/tex/generic/context/luatex/luatex-gadgets.lua index 8c835babb..60c21427d 100644 --- a/tex/generic/context/luatex/luatex-gadgets.lua +++ b/tex/generic/context/luatex/luatex-gadgets.lua @@ -16,14 +16,13 @@ gadgets = gadgets or { } -- global namespace -- marking content for optional removal -local marking = { } -gadgets.marking = marking +local marking = { } +gadgets.marking = marking -local marksignal = 5001 -- will be set in the tex module -local lastmarked = 0 -local marked = { } -local local_par = 6 -local whatsit_node = 8 +local marksignal = 5001 -- will be set in the tex module +local lastmarked = 0 +local marked = { } +local local_par_code = 9 function marking.setsignal(n) marksignal = tonumber(n) or marksignal @@ -53,9 +52,7 @@ function marking.remove(str) local first = last while true do local prev = first.prev - if not prev - or prev[marksignal] ~= attr - or (prev.id == whatsit_node and prev.subtype == local_par) then + if not prev or prev[marksignal] ~= attr or prev.id == local_par_code then break else first = prev |