From 2d50de713c23ec150dab395dcbce69b854db2d58 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 25 Feb 2018 20:49:38 +0100 Subject: 2018-02-25 19:57:00 --- doc/context/documents/general/qrcs/setup-cs.pdf | Bin 844335 -> 844369 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 844081 -> 844123 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 848652 -> 848659 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 840065 -> 840102 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 845852 -> 845879 bytes .../documents/general/qrcs/setup-mapping-cs.pdf | Bin 359152 -> 359143 bytes .../documents/general/qrcs/setup-mapping-de.pdf | Bin 438449 -> 438444 bytes .../documents/general/qrcs/setup-mapping-en.pdf | Bin 356655 -> 356665 bytes .../documents/general/qrcs/setup-mapping-fr.pdf | Bin 359403 -> 359404 bytes .../documents/general/qrcs/setup-mapping-it.pdf | Bin 358192 -> 358199 bytes .../documents/general/qrcs/setup-mapping-nl.pdf | Bin 357853 -> 357848 bytes .../documents/general/qrcs/setup-mapping-ro.pdf | Bin 624635 -> 624633 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 837182 -> 837206 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 840149 -> 840166 bytes doc/context/scripts/mkiv/mtx-modules.html | 1 + doc/context/scripts/mkiv/mtx-modules.man | 3 + doc/context/scripts/mkiv/mtx-modules.xml | 1 + .../general/manuals/luatex/luatex-nodes.tex | 3 +- scripts/context/lua/mtx-modules.lua | 62 +++- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-it.mkii | 1 + tex/context/base/mkiv/cont-fil.mkiv | 2 + tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/lang-url.lua | 1 - tex/context/base/mkiv/lpdf-mis.lua | 17 +- tex/context/base/mkiv/mtx-context-module.tex | 166 +++++++++ tex/context/base/mkiv/mult-def.lua | 4 + tex/context/base/mkiv/pack-rul.mkiv | 2 + tex/context/base/mkiv/page-ini.lua | 193 ++++++++-- tex/context/base/mkiv/page-ini.mkiv | 9 + tex/context/base/mkiv/scrn-pag.lua | 1 + tex/context/base/mkiv/scrn-pag.mkvi | 1 + tex/context/base/mkiv/status-files.pdf | Bin 25807 -> 25818 bytes tex/context/base/mkiv/status-lua.pdf | Bin 251734 -> 252080 bytes tex/context/interface/mkii/keys-it.xml | 1 + tex/context/interface/mkiv/context-en.xml | 3 + tex/context/interface/mkiv/i-context.pdf | Bin 848652 -> 848659 bytes tex/context/interface/mkiv/i-interactionscreen.xml | 3 + tex/context/interface/mkiv/i-readme.pdf | Bin 60774 -> 60792 bytes tex/context/modules/common/s-mod.ctx | 2 +- tex/context/modules/mkiv/m-scite.mkiv | 13 +- tex/context/modules/mkiv/s-mod-00.mkiv | 24 -- tex/context/modules/mkiv/s-mod-01.mkiv | 391 -------------------- tex/context/modules/mkiv/s-mod-02.mkiv | 24 -- tex/context/modules/mkiv/s-modules-basics.mkiv | 403 +++++++++++++++++++++ tex/context/sample/common/greenfield.tex | 9 + tex/context/sample/common/samples.tex | 3 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- tex/generic/context/luatex/luatex-gadgets.lua | 17 +- 51 files changed, 864 insertions(+), 506 deletions(-) create mode 100644 tex/context/base/mkiv/mtx-context-module.tex delete mode 100644 tex/context/modules/mkiv/s-mod-00.mkiv delete mode 100644 tex/context/modules/mkiv/s-mod-01.mkiv delete mode 100644 tex/context/modules/mkiv/s-mod-02.mkiv create mode 100644 tex/context/modules/mkiv/s-modules-basics.mkiv create mode 100644 tex/context/sample/common/greenfield.tex diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index 0d929224b..c2e8696bb 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index 3e27696a7..eb930b5a2 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index 320425cce..ae9a39d06 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index 7e223100f..489ca3bc3 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index dbf1c98e1..2a7cc118d 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf index 7a4e48567..b6d141d2e 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf and b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf index 48ba62868..afa91c4b9 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-de.pdf and b/doc/context/documents/general/qrcs/setup-mapping-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf index f022b0450..19dda0007 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-en.pdf and b/doc/context/documents/general/qrcs/setup-mapping-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf index 71704b5fc..0e9dc1e55 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf and b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf index 5024c50ef..60d0349d8 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-it.pdf and b/doc/context/documents/general/qrcs/setup-mapping-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf index 5898f674d..487b218c1 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf and b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf index c3a148d00..65b3ecd8f 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf and b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index ccff57ad6..103ef368d 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index 8fdb83307..ec7796d6c 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ 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 @@ --convertconvert source files (tex, mkii, mkiv, mp) to 'ted' files --processprocess source files (tex, mkii, mkiv, mp) to 'pdf' files --prepuse original name with suffix 'prep' appended + --directuse old method instead of extra
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 @@ convert source files (tex, mkii, mkiv, mp) to 'ted' files process source files (tex, mkii, mkiv, mp) to 'pdf' files use original name with suffix 'prep' appended + use old method instead of extra 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 = [[ convert source files (tex, mkii, mkiv, mp) to 'ted' files process source files (tex, mkii, mkiv, mp) to 'pdf' files use original name with suffix 'prep' appended + use old method instead of extra @@ -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 index ea587d3a0..4b3857135 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index d8c1b019b..fea1f2b83 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ 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 @@ + 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 @@ + + + diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 320425cce..ae9a39d06 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ 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 @@ + + + diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index be59353a2..95cb45722 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ 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 @@ - mod-01 + modules-basics 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-01.mkiv b/tex/context/modules/mkiv/s-mod-01.mkiv deleted file mode 100644 index f1c8d4258..000000000 --- a/tex/context/modules/mkiv/s-mod-01.mkiv +++ /dev/null @@ -1,391 +0,0 @@ -%D \module -%D [ file=s-mod-01, -%D version=very-old, -%D title=\CONTEXT\ Style File, -%D subtitle=Module Documentation, -%D author={Hans Hagen \& Luigi Scarso}, -%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 - -%D Usage: -%D -%D \starttyping -%D context --ctx=s-mod somefile.mkiv -%D \stoptyping -%D -%D In due time there will be a \type {mtx-context-module} as well. -%D -%D Luigi Scarso coordinates the processing of modules so best contact -%D him when you run into problems. Bugs in this style can be sent to -%D Hans. - -\usemodule - [abr-00] - -\setvariables - [document] - [ file=\jobname, - type=unknown, - version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, - system=\CONTEXT, - title=Unknown Title, - subtitle=, - author=Unknown Author, - date=\currentdate, - copyright=Unknown Copyright, - suggestions=] - -\let\module\setupdocument - -\definepalet [module:unknown] [localone=black,localtwo=white] - -\definepalet [module:tex] [localone=blue,localtwo=green] -\definepalet [module:mkii] [localone=blue,localtwo=green] -\definepalet [module:mkiv] [localone=blue,localtwo=green] -\definepalet [module:mkvi] [localone=blue,localtwo=green] - -\definepalet [module:lua] [localone=red,localtwo=green] -\definepalet [module:cld] [localone=red,localtwo=green] - -\definepalet [module:mp] [localone=red,localtwo=blue] -\definepalet [module:mpii] [localone=red,localtwo=blue] -\definepalet [module:mpiv] [localone=red,localtwo=blue] -\definepalet [module:metapost][localone=red,localtwo=blue] - -\setuppalet - [module:unknown] - -\startuseMPgraphic{page} - - StartPage ; - - color local_white ; local_white := .8white ; - color local_one ; local_one := \MPcolor{localone} randomized (.6,.8) ; - color local_two ; local_two := \MPcolor{localtwo} randomized (.3,.4) ; - - color local_one ; local_one := .75[\MPcolor{localone},white] ; - color local_two ; local_two := .75[\MPcolor{localtwo},white] ; - - numeric width ; width := bbwidth Page ; - numeric height ; height := bbheight Page ; - - u := width/400 ; - - def a_module (expr dx, dy) = - picture p ; p := image ( - ddy := 0 ; sx := 60u ; - for i=1 upto (4 randomized 2) : - sy := 7u randomized 3u ; - fill unitsquare xyscaled(sx,sy) shifted (0,ddy) withcolor local_two ; - ddy := ddy + sy + 4u ; - endfor ; - ) ; - p := p shifted (dx,dy) shifted - center p ; - fill boundingbox p enlarged 8u withcolor local_white ; - fill boundingbox p enlarged 4u withcolor local_one ; - draw p ; - enddef ; - - set_grid(width, height, width/15, height/15) ; - - forever: - if new_on_grid(uniformdeviate width,uniformdeviate height): - a_module(dx,dy) ; - fi ; - exitif grid_full ; - endfor ; - - picture p ; - - draw image ( - draw anchored.urt(textext("\bf\strut\documentvariable{system}") ysized 5.0cm,urcorner Page shifted (-1cm,- 1cm)) ; - draw anchored.urt(textext("\bf\strut\documentvariable{title}") ysized 1.5cm,urcorner Page shifted (-1cm,- 8cm)) ; - draw anchored.urt(textext("\bf\strut\documentvariable{subtitle}") ysized 1.5cm,urcorner Page shifted (-1cm,-10cm)) ; - draw anchored.urt(textext("\bf\strut\documentvariable{author}") ysized 1.5cm,lrcorner Page shifted (-1cm, 5cm)) ; - draw anchored.urt(textext("\bf\strut\currentdate") ysized 1.5cm,lrcorner Page shifted (-1cm, 3cm)) ; - ) withcolor .25white ; - - StopPage ; - -\stopuseMPgraphic - -\startsetups[document:start] - - \setuppalet - [module:\documentvariable{type}] - - \startTEXpage - \useMPgraphic{page} - \stopTEXpage - - \page[right] - -\stopsetups - -\startsetups[document:stop] - - \page - - \placeregister - [\v!index] - [\c!balance=\v!yes, - \c!indicator=\v!no, - \c!criterium=\v!text] - -\stopsetups - -% In order to be able to typeset this one too, we need to avoid -% direct backslashed names. - -\starttexdefinition startmoduledocumentation - \starttext - \page - \begingroup - \startdocument -\stoptexdefinition - -\starttexdefinition stopmoduledocumentation - \stopdocument - \page - \endgroup - \stoptext -\stoptexdefinition - -\starttexdefinition startdocumentation - \par - \bgroup -\stoptexdefinition - -\starttexdefinition stopdocumentation - \par - \egroup -\stoptexdefinition - -\definetyping - [definition] - -\starttexdefinition startcompressdefinitions - \blank - \begingroup - \setuptyping[definition][bodyfont=small] -\stoptexdefinition - -\starttexdefinition stopcompressdefinitions - \blank - \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] - -\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 - -\setuplinenumbering - [definition] - [\c!style=\ttx, - \c!distance=\leftmargindistance, - \c!align=\v!flushright] - -% This will be cleaned up. - -\unexpanded\def\domodulemarginstuff#1#2% - {\marginstuff - {\ifx#1\relax - \index{#2}% - \else - \index{#1{#2}}% - \fi - #1{\doboundtext{#2}{\leftmarginwidth}{..}}}} - -\unexpanded\def\modulemarginstuff#1#2% to be renamed - {\processcommalist[#2]{\domodulemarginstuff#1}} - -\definemargindata - [marginstuff] - [left] - [stack=yes, - hoffset=2em, - style=\ttxx] - -\unexpanded\def\macros {\modulemarginstuff\tex } -\unexpanded\def\extras {\modulemarginstuff\relax} -\unexpanded\def\elements{\modulemarginstuff\someelement} - -\unexpanded\def\someelement#1{\type{<#1>}} - -% [index]{command} - -% \macros{a,b} -% \macros{a,b}{b} -% \macros[a]{a,b}{b} - -% weg ermee (indeed): -% -% \defineparagraphs [interface] [\c!n=2] -% \setupparagraphs [interface] [1] [\c!width=4cm] - -\starttexdefinition startexample - \par - \startnarrower -\stoptexdefinition - -\starttexdefinition stopexample - \stopnarrower -\stoptexdefinition - -%D Command references: - -\usemodule[int-load] \loadsetups - -\let\showsetup\setup - -\setupframedtexts - [setuptext] - [\c!background=\v!screen, - \c!frame=\v!off] - -% style (we use dejavu as it supports more characters) - -\switchtobodyfont - [dejavu-condensed,10pt] % preload - -\setupbodyfont - [dejavu,10pt] % main font - -\mainlanguage - [en] - -\setuptyping - [\v!typing] - [\c!bodyfont=dejavu-condensed] - -\setupwhitespace - [\v!big] - -\setuptolerance - [\v!verytolerant,\v!stretch] - -\setuplayout - [\c!backspace=3.5cm, - \c!cutspace=2cm, - \c!leftmargin=1.75cm, - \c!rightmargin=0cm, - \c!margindistance=.5cm, - \c!leftedgedistance=.25cm, - \c!rightedgedistance=.5cm, - \c!edge=1.5cm, - \c!width=middle, - \c!topspace=2cm, - \c!header=1.25cm, - \c!footer=1.25cm, - \c!height=middle, - \c!style=\ss] - -\setuppagenumbering - [\c!location=] - -\setuppagenumbering - [\c!alternative={\v!doublesided,\v!singlesided}] - -\setupfootertexts - [\v!edge] - [][\pagenumber] - -\setupfootertexts - [\v!margin] - [\filename{\documentvariable{file}}][] - [\filename{\documentvariable{file}}][] - -\setupfootertexts - [\v!text] - [\CONTEXT] - [\documentvariable{title}] - -\setupheadertexts - [\v!text] - [] - [\documentvariable{subtitle}] - -\setupinmargin - [\c!location=\v!left] - -\setupheads - [\c!alternative=\v!inmargin] - -\setuphead - [\v!chapter] - [\c!style=\bfc, - \c!page=\v!right, - \c!header=\v!empty] - -\setuphead - [\v!section] - [\c!style=\bfb, - \c!page=\v!right] - -\setuphead - [\v!subsection] - [\c!style=\bfa] - -\setuplist - [\v!chapter] - [\c!style=\v!bold, - \c!after=\blank] - -\setupcombinedlist - [\v!content] - [\c!width=3em, - \c!aligntitle=\v!yes] - -\setupregister - [\v!index] - [\c!balance=\v!yes, - \c!indicator=\v!no] - -\setupinteraction - [\c!state=\v!start, - \c!color=, - \c!contrastcolor=, - \c!style=] - -% modes - -\doifmode {nocolor} { - - \setupcolors - [\c!conversion=\v!always] - -} - -\doifmode {singlesided} { - - \setuppagenumbering - [\c!alternative=\v!singlesided] - - \setupfootertexts - [\v!margin] - [\filename{\documentvariable{file}}][] - -} - -% bonus - -\usemodule - [abr-02] - -% another one - -\dontcomplain - -\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-modules-basics.mkiv b/tex/context/modules/mkiv/s-modules-basics.mkiv new file mode 100644 index 000000000..74621b2a3 --- /dev/null +++ b/tex/context/modules/mkiv/s-modules-basics.mkiv @@ -0,0 +1,403 @@ +%D \module +%D [ file=s-mod-01, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Module Documentation, +%D author={Hans Hagen \& Luigi Scarso}, +%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 + +%D Usage: +%D +%D \starttyping +%D context --ctx=s-mod somefile.mkiv +%D \stoptyping +%D +%D In due time there will be a \type {mtx-context-module} as well. +%D +%D Luigi Scarso coordinates the processing of modules so best contact +%D him when you run into problems. Bugs in this style can be sent to +%D Hans. + +\showframe + +\usemodule[abbreviations-words] + +\startmodule[modules-basics] + +\setupdocument + [ file=\jobname, + type=unknown, + version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, + system=\CONTEXT, + title=Unknown Title, + subtitle=, + author=Unknown Author, + date=\currentdate, + copyright=Unknown Copyright, + suggestions=] + +\let\module\setupdocument + +\definepalet [module:unknown] [localone=black,localtwo=white] + +\definepalet [module:tex] [localone=blue,localtwo=green] +\definepalet [module:mkii] [localone=blue,localtwo=green] +\definepalet [module:mkiv] [localone=blue,localtwo=green] +\definepalet [module:mkvi] [localone=blue,localtwo=green] + +\definepalet [module:lua] [localone=red,localtwo=green] +\definepalet [module:cld] [localone=red,localtwo=green] + +\definepalet [module:mp] [localone=red,localtwo=blue] +\definepalet [module:mpii] [localone=red,localtwo=blue] +\definepalet [module:mpiv] [localone=red,localtwo=blue] +\definepalet [module:metapost][localone=red,localtwo=blue] + +\setuppalet + [module:unknown] + +\startuseMPgraphic{page} + + StartPage ; + + color local_white ; local_white := .8white ; + color local_one ; local_one := \MPcolor{localone} randomized (.6,.8) ; + color local_two ; local_two := \MPcolor{localtwo} randomized (.3,.4) ; + + color local_one ; local_one := .75[\MPcolor{localone},white] ; + color local_two ; local_two := .75[\MPcolor{localtwo},white] ; + + numeric width ; width := bbwidth Page ; + numeric height ; height := bbheight Page ; + + u := width/400 ; + + def a_module (expr dx, dy) = + picture p ; p := image ( + ddy := 0 ; sx := 60u ; + for i=1 upto (4 randomized 2) : + sy := 7u randomized 3u ; + fill unitsquare xyscaled(sx,sy) shifted (0,ddy) withcolor local_two ; + ddy := ddy + sy + 4u ; + endfor ; + ) ; + p := p shifted (dx,dy) shifted - center p ; + fill boundingbox p enlarged 8u withcolor local_white ; + fill boundingbox p enlarged 4u withcolor local_one ; + draw p ; + enddef ; + + set_grid(width, height, width/15, height/15) ; + + forever: + if new_on_grid(uniformdeviate width,uniformdeviate height): + a_module(dx,dy) ; + fi ; + exitif grid_full ; + endfor ; + + picture p ; + + draw image ( + draw anchored.urt(textext("\bf\strut\documentvariable{system}") ysized 5.0cm,urcorner Page shifted (-1cm,- 1cm)) ; + draw anchored.urt(textext("\bf\strut\documentvariable{title}") ysized 1.5cm,urcorner Page shifted (-1cm,- 8cm)) ; + draw anchored.urt(textext("\bf\strut\documentvariable{subtitle}") ysized 1.5cm,urcorner Page shifted (-1cm,-10cm)) ; + draw anchored.urt(textext("\bf\strut\documentvariable{author}") ysized 1.5cm,lrcorner Page shifted (-1cm, 5cm)) ; + draw anchored.urt(textext("\bf\strut\currentdate") ysized 1.5cm,lrcorner Page shifted (-1cm, 3cm)) ; + ) withcolor .25white ; + + StopPage ; + +\stopuseMPgraphic + +\startsetups[document:start] + + \setuppalet + [module:\documentvariable{type}] + + \setuptyping + [definition] + [lines=yes, + option=\documentvariable{type}] + + \startTEXpage + \useMPgraphic{page} + \stopTEXpage + + \page[right] + +\stopsetups + +\startsetups[document:stop] + + \page + + \placeregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no, + \c!criterium=\v!text] + +\stopsetups + +% In order to be able to typeset this one too, we need to avoid +% direct backslashed names. + +\starttexdefinition startmoduledocumentation + \starttext + \page + \begingroup + \startdocument +\stoptexdefinition + +\starttexdefinition stopmoduledocumentation + \stopdocument + \page + \endgroup + \stoptext +\stoptexdefinition + +\starttexdefinition startdocumentation + \par + \bgroup +\stoptexdefinition + +\starttexdefinition stopdocumentation + \par + \egroup +\stoptexdefinition + +\definetyping + [definition] + +\starttexdefinition startcompressdefinitions + \blank + \begingroup + \setuptyping[definition][bodyfont=small] +\stoptexdefinition + +\starttexdefinition stopcompressdefinitions + \blank + \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] + +\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!align=\v!flushright] + +% This will be cleaned up. + +\unexpanded\def\domodulemarginstuff#1#2% + {\marginstuff + {\ifx#1\relax + \index{#2}% + \else + \index{#1{#2}}% + \fi + \dontleavehmode#1{\doboundtext{#2}{\leftmarginwidth}{..}}}} + +\unexpanded\def\modulemarginstuff#1#2% to be renamed + {\processcommalist[#2]{\domodulemarginstuff#1}} + +\definemargindata + [marginstuff] + [left] + [stack=yes, + hoffset=2em, + style=\ttxx\setstrut] + +\unexpanded\def\macros {\modulemarginstuff\tex } +\unexpanded\def\extras {\modulemarginstuff\relax} +\unexpanded\def\elements{\modulemarginstuff\someelement} + +\unexpanded\def\someelement#1{\type{<#1>}} + +% [index]{command} + +% \macros{a,b} +% \macros{a,b}{b} +% \macros[a]{a,b}{b} + +% weg ermee (indeed): +% +% \defineparagraphs [interface] [\c!n=2] +% \setupparagraphs [interface] [1] [\c!width=4cm] + +\starttexdefinition startexample + \par + \startnarrower +\stoptexdefinition + +\starttexdefinition stopexample + \stopnarrower +\stoptexdefinition + +%D Command references: + +\usemodule[int-load] \loadsetups + +\let\showsetup\setup + +\setupframedtexts + [setuptext] + [\c!background=\v!screen, + \c!frame=\v!off] + +% style (we use dejavu as it supports more characters) + +\usebodyfont + [dejavu-condensed,9pt] % preload + +\setupbodyfont + [dejavu,9pt] % main font + +\mainlanguage + [en] + +\setuptyping + [\v!typing] + [\c!bodyfont=dejavu-condensed] + +\setupwhitespace + [\v!big] + +\setuptolerance + [\v!verytolerant,\v!stretch] + +\setuplayout + [\c!backspace=3.5cm, + \c!cutspace=2cm, + \c!leftmargin=1.75cm, + \c!rightmargin=0cm, + \c!margindistance=.5cm, + \c!leftedgedistance=.25cm, + \c!rightedgedistance=.5cm, + \c!edge=1.5cm, + \c!width=middle, + \c!topspace=2cm, + \c!header=1.25cm, + \c!footer=1.25cm, + \c!height=middle, + \c!style=\ss] + +\setuppagenumbering + [\c!location=] + +\setuppagenumbering + [\c!alternative={\v!doublesided,\v!singlesided}] + +\setupfootertexts + [\v!edge] + [][\pagenumber] + +\setupfootertexts + [\v!margin] + [\filename{\documentvariable{file}}][] + [\filename{\documentvariable{file}}][] + +\setupfootertexts + [\v!text] + [\CONTEXT] + [\documentvariable{title}] + +\setupheadertexts + [\v!text] + [] + [\documentvariable{subtitle}] + +\setupinmargin + [\c!location=\v!left] + +\setupheads + [\c!alternative=\v!inmargin] + +\setuphead + [\v!chapter] + [\c!style=\bfc, + \c!page=\v!right, + \c!header=\v!empty] + +\setuphead + [\v!section] + [\c!style=\bfb, + \c!page=\v!right] + +\setuphead + [\v!subsection] + [\c!style=\bfa] + +\setuplist + [\v!chapter] + [\c!style=\v!bold, + \c!after=\blank] + +\setupcombinedlist + [\v!content] + [\c!width=3em, + \c!aligntitle=\v!yes] + +\setupregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no] + +\setupinteraction + [\c!state=\v!start, + \c!color=, + \c!contrastcolor=, + \c!style=] + +% modes + +\doifmode {nocolor} { + + \setupcolors + [\c!conversion=\v!always] + +} + +\doifmode {singlesided} { + + \setuppagenumbering + [\c!alternative=\v!singlesided] + + \setupfootertexts + [\v!margin] + [\filename{\documentvariable{file}}][] + +} + +\protect + +\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 -- cgit v1.2.3