From dc4ced1347aa0ca2966f201121102c22a52e1d4e Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Mon, 13 Apr 2015 20:15:04 +0200 Subject: 2015-04-13 19:32:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4189 -> 4185 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-ctx.lua | 21 ++-- tex/context/base/mult-de.mkii | 1 + tex/context/base/mult-def.lua | 4 + tex/context/base/mult-en.mkii | 1 + tex/context/base/mult-fr.mkii | 1 + tex/context/base/mult-it.mkii | 1 + tex/context/base/mult-nl.mkii | 1 + tex/context/base/mult-pe.mkii | 1 + tex/context/base/mult-ro.mkii | 1 + tex/context/base/node-ref.lua | 122 +++++++++++++++++-- tex/context/base/page-lin.mkvi | 2 - tex/context/base/publ-imp-aps.mkvi | 10 +- tex/context/base/s-references-show.mkiv | 132 +++++++++++++++++++++ tex/context/base/status-files.pdf | Bin 24514 -> 24488 bytes tex/context/base/status-lua.pdf | Bin 249907 -> 249967 bytes tex/context/base/strc-doc.mkiv | 2 +- tex/context/base/strc-flt.mkvi | 1 + tex/context/base/strc-itm.mkvi | 2 - tex/context/base/strc-lst.mkvi | 10 +- tex/context/base/strc-num.mkiv | 18 ++- tex/context/base/strc-ref.lua | 120 +++++++++++++++---- tex/context/base/strc-ref.mkvi | 12 +- tex/context/base/trac-vis.lua | 9 +- tex/context/base/trac-vis.mkiv | 2 +- tex/context/base/typo-chr.lua | 48 +++++++- tex/context/base/typo-chr.mkiv | 4 +- tex/context/interface/keys-cs.xml | 1 + tex/context/interface/keys-de.xml | 1 + tex/context/interface/keys-en.xml | 1 + tex/context/interface/keys-fr.xml | 1 + tex/context/interface/keys-it.xml | 1 + tex/context/interface/keys-nl.xml | 1 + tex/context/interface/keys-pe.xml | 1 + tex/context/interface/keys-ro.xml | 1 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 38 files changed, 465 insertions(+), 75 deletions(-) create mode 100644 tex/context/base/s-references-show.mkiv (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 6b601c87b..0990b3a1a 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.04.12 15:41} +\newcontextversion{2015.04.13 19:30} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index cc3d19460..8c31fb183 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index e6ea8f7c6..11b25503e 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.04.12 15:41} +\edef\contextversion{2015.04.13 19:30} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index a58a3b9d6..2c96e9ac2 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -1292,13 +1292,9 @@ do -- else too many locals end end -end - --- local id, cs = fonts.definers.internal { } --- local id, cs = fonts.definers.internal { number = 2 } --- local id, cs = fonts.definers.internal { name = "dejavusans" } - -do + -- local id, cs = fonts.definers.internal { } + -- local id, cs = fonts.definers.internal { number = 2 } + -- local id, cs = fonts.definers.internal { name = "dejavusans" } local n = 0 @@ -1334,6 +1330,17 @@ do return id, csnames[id] end + -- here + + local infofont = 0 + + function fonts.infofont() + if infofont == 0 then + infofont = definers.define { name = "dejavusansmono", size = tex.sp("6pt") } + end + return infofont + end + end local enable_auto_r_scale = false diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index f3582e33c..90aae390e 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -862,6 +862,7 @@ \setinterfaceconstant{nright}{nrechts} \setinterfaceconstant{ntop}{noben} \setinterfaceconstant{number}{nummer} +\setinterfaceconstant{numberalign}{numberalign} \setinterfaceconstant{numbercolor}{nummernfarbe} \setinterfaceconstant{numbercommand}{nummerbefehl} \setinterfaceconstant{numberconversion}{numberconversion} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index c3d50d83d..c0831de2d 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -6580,6 +6580,10 @@ return { ["en"]="headalign", ["nl"]="kopuitlijnen", }, + ["numberalign"]={ + ["en"]="numberalign", + ["nl"]="nummeruitlijnen", + }, ["alignsymbol"]={ ["en"]="alignsymbol", }, diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index b5b8f94b6..b08070ba0 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -862,6 +862,7 @@ \setinterfaceconstant{nright}{nright} \setinterfaceconstant{ntop}{ntop} \setinterfaceconstant{number}{number} +\setinterfaceconstant{numberalign}{numberalign} \setinterfaceconstant{numbercolor}{numbercolor} \setinterfaceconstant{numbercommand}{numbercommand} \setinterfaceconstant{numberconversion}{numberconversion} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index 898f81875..d76da18d9 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -862,6 +862,7 @@ \setinterfaceconstant{nright}{ndroite} \setinterfaceconstant{ntop}{nsup} \setinterfaceconstant{number}{numero} +\setinterfaceconstant{numberalign}{numberalign} \setinterfaceconstant{numbercolor}{couleurnumero} \setinterfaceconstant{numbercommand}{commandenumero} \setinterfaceconstant{numberconversion}{numberconversion} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 9b0ea7b15..6474d93c4 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -862,6 +862,7 @@ \setinterfaceconstant{nright}{ndestra} \setinterfaceconstant{ntop}{ncima} \setinterfaceconstant{number}{numero} +\setinterfaceconstant{numberalign}{numberalign} \setinterfaceconstant{numbercolor}{colorenumero} \setinterfaceconstant{numbercommand}{comandonumero} \setinterfaceconstant{numberconversion}{numberconversion} diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index a84494cfb..22350dc50 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -862,6 +862,7 @@ \setinterfaceconstant{nright}{nrechts} \setinterfaceconstant{ntop}{nboven} \setinterfaceconstant{number}{nummer} +\setinterfaceconstant{numberalign}{nummeruitlijnen} \setinterfaceconstant{numbercolor}{nummerkleur} \setinterfaceconstant{numbercommand}{nummercommando} \setinterfaceconstant{numberconversion}{numberconversion} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 2aa8372ff..32cf32db1 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -862,6 +862,7 @@ \setinterfaceconstant{nright}{nright} \setinterfaceconstant{ntop}{ntop} \setinterfaceconstant{number}{شماره} +\setinterfaceconstant{numberalign}{numberalign} \setinterfaceconstant{numbercolor}{رنگ‌شماره} \setinterfaceconstant{numbercommand}{فرمان‌شماره} \setinterfaceconstant{numberconversion}{numberconversion} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index 77b498dc9..a5d90033f 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -862,6 +862,7 @@ \setinterfaceconstant{nright}{ndreapta} \setinterfaceconstant{ntop}{nsus} \setinterfaceconstant{number}{numar} +\setinterfaceconstant{numberalign}{numberalign} \setinterfaceconstant{numbercolor}{culoarenumar} \setinterfaceconstant{numbercommand}{comandanumar} \setinterfaceconstant{numberconversion}{numberconversion} diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua index f4c9866f5..863dbb07c 100644 --- a/tex/context/base/node-ref.lua +++ b/tex/context/base/node-ref.lua @@ -16,6 +16,8 @@ if not modules then modules = { } end modules ['node-ref'] = { -- is grouplevel still used? +local concat = table.concat + local attributes, nodes, node = attributes, nodes, node local allocate = utilities.storage.allocate, utilities.storage.mark @@ -32,9 +34,11 @@ local colors = attributes.colors local references = structures.references local tasks = nodes.tasks -local trace_references = false trackers.register("nodes.references", function(v) trace_references = v end) -local trace_destinations = false trackers.register("nodes.destinations", function(v) trace_destinations = v end) -local trace_areas = false trackers.register("nodes.areas", function(v) trace_areas = v end) +local trace_references = false trackers.register("nodes.references", function(v) trace_references = v end) +local trace_destinations = false trackers.register("nodes.destinations", function(v) trace_destinations = v end) +local trace_areas = false trackers.register("nodes.areas", function(v) trace_areas = v end) +local show_references = false trackers.register("nodes.references.show", function(v) show_references = v end) +local show_destinations = false trackers.register("nodes.destinations.show", function(v) show_destinations = v end) local report_reference = logs.reporter("backend","references") local report_destination = logs.reporter("backend","destinations") @@ -419,7 +423,7 @@ local function inject_area(head,attribute,make,stack,done,parent,pardir,txtdir) return head, true end --- tracing +-- tracing: todo: use predefined colors local register_color = colors.register @@ -430,7 +434,22 @@ local u_transparency = nil local u_colors = { } local force_gray = true -local function colorize(width,height,depth,n,reference,what) +local function addstring(str,what) + if str then + local typesetters = nuts.typesetters + if typesetters then + if what == "reference" then + str = str .. "<" + else + str = str .. ">" + end + local text = typesetters.fast_hpack(str,fonts.infofont()) + return text + end + end +end + +local function colorize(width,height,depth,n,reference,what,sr) if force_gray then n = 0 end u_transparency = u_transparency or transparencies.register(nil,2,.65) local ucolor = u_colors[n] @@ -468,10 +487,37 @@ local function colorize(width,height,depth,n,reference,what) setfield(rule,"prev",kern) return kern else + +if sr and sr ~= "" then + local text = addstring(sr) + if text then + local kern = new_kern(-getfield(text,"width")) + setfield(kern,"next",text) + setfield(text,"prev",kern) + setfield(text,"next",rule) + setfield(rule,"prev",text) + return kern + end +end + return rule end end +local function justadd(what,sr) + if sr and sr ~= "" then + local text = addstring(sr) + if text then + local kern = new_kern(-getfield(text,"width")) + setfield(kern,"next",text) + setfield(text,"prev",kern) + setfield(text,"next",rule) + setfield(rule,"prev",text) + return kern + end + end +end + -- references: local texsetattribute = tex.setattribute @@ -523,12 +569,35 @@ local function makereference(width,height,depth,reference) -- height and depth a if annot then annot = tonut(annot) -- todo nofreferences = nofreferences + 1 - local result, current + local result, current, texts + if show_references then + local d = sr[1] + if d then + local r = d.reference + local p = d.prefix + if r then + if p then + texts = p .. " : " .. r + else + texts = r + end + else + -- t[#t+1] = d.internal or "?" + end + end + end if trace_references then local step = 65536 - result = hpack_list(colorize(width,height-step,depth-step,2,reference,"reference")) -- step subtracted so that we can see seperate links + result = hpack_list(colorize(width,height-step,depth-step,2,reference,"reference",texts)) -- step subtracted so that we can see seperate links setfield(result,"width",0) current = result + elseif texts then + texts = justadd("reference",texts) + if texts then + result = hpack_list(texts) + setfield(result,"width",0) + current = result + end end if current then setfield(current,"next",annot) @@ -600,14 +669,40 @@ local function makedestination(width,height,depth,reference) if height < ht then height = ht end if depth < dp then depth = dp end end - local result, current + local result, current, texts + if show_destinations then + local str = sr[4] + if str and #str > 0 then + local t = { } + for i=1,#str do + local d = references.internals[str[i]] + if d then + d = d.references + local r = d.reference + local p = d.usedprefix + if r then + if p then + t[#t+1] = p .. " : " .. r + else + t[#t+1] = r + end + else + -- t[#t+1] = d.internal or "?" + end + end + end + if #t > 0 then + texts = concat(t," | ") + end + end + end if trace_destinations then local step = 0 if width == 0 then step = 4*65536 width, height, depth = 5*step, 5*step, 0 end - local rule = hpack_list(colorize(width,height,depth,3,reference,"destination")) + local rule = hpack_list(colorize(width,height,depth,3,reference,"destination",texts)) setfield(rule,"width",0) if not result then result, current = rule, rule @@ -617,6 +712,15 @@ local function makedestination(width,height,depth,reference) current = rule end width, height = width - step, height - step + elseif texts then + texts = justadd("destination",texts) + if texts then + result = hpack_list(texts) + if result then + setfield(result,"width",0) + current = result + end + end end nofdestinations = nofdestinations + 1 local annot = nodeinjections.destination(width,height,depth,name,view) diff --git a/tex/context/base/page-lin.mkvi b/tex/context/base/page-lin.mkvi index 484412dbd..6204cb40c 100644 --- a/tex/context/base/page-lin.mkvi +++ b/tex/context/base/page-lin.mkvi @@ -106,8 +106,6 @@ % we could make this a bit more efficient by putting the end reference % in the same table as the start one but why make things complex ... -\let\dofinishlinereference\dofinishfullreference % at lua end - \unexpanded\def\page_lines_some_reference#1#2#3% {\dontleavehmode\begingroup \global\advance\c_page_lines_reference\plusone diff --git a/tex/context/base/publ-imp-aps.mkvi b/tex/context/base/publ-imp-aps.mkvi index 49210dbae..2b3da954e 100644 --- a/tex/context/base/publ-imp-aps.mkvi +++ b/tex/context/base/publ-imp-aps.mkvi @@ -49,12 +49,6 @@ [aps] [\c!specification=aps] -\setupbtxlist - [aps] - [alternative=paragraph, - width=auto, - distance=0pt] - \definebtx [aps:list] [aps] @@ -92,8 +86,8 @@ \definebtx [aps:list:yes] [aps:list] - [\c!command={\high}, % also, left, right, stopper, style, color... - \c!align=flushright] + [left={[}, + right={]}] %D In order to be able to get journals expanded (or normalized or abbreviated) you need %D to load a list: diff --git a/tex/context/base/s-references-show.mkiv b/tex/context/base/s-references-show.mkiv new file mode 100644 index 000000000..72cccce54 --- /dev/null +++ b/tex/context/base/s-references-show.mkiv @@ -0,0 +1,132 @@ +%D \module +%D [ file=s-references-show.mkiv, +%D version=2015.04.13, +%D title=\CONTEXT\ Style File, +%D subtitle=Reference Checking, +%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. + +\startmodule[references-show] + +\unprotect + +% \enabletrackers[nodes.references,nodes.destinations] % also shows areas + +\enabletrackers[nodes.references.show,nodes.destinations.show] + +\enablehiddenbackground % trick + +\edef\hiddenbackgroundlist{\hiddenbackgroundlist,trace-references} + +\defineoverlay + [trace-references] + [\directsetup{trace:references:onpage}] + +\startluacode + local pagelist = structures.references.tracedpages + + function commands.getreferencesonpage(n) + n = tonumber(n) + if n then + local pagedata = pagelist[n] + if pagedata then + context("%s references",#pagedata) + context.blank() + for i=1,#pagedata do + local details = pagedata[i] + local prefix = details[1] + local reference = details[2] + -- local internal = details[3] + -- context("%04i = %s : %s",internal,prefix == "" and "-" or prefix,reference) + context("%s : %s",prefix == "" and "-" or prefix,reference) + context.par() + end + else + context("no references") + end + else + context("no valid page") + end + end + +\stopluacode + +\definecolor + [trace:references:onpage] + [b=.5,a=1,t=.25] + +\defineframed + [trace:references:onpage] + [\c!offset=2\exheight, + %\c!foregroundstyle=\infofont, + \c!frame=\v!off, + \c!background=\v!color, + \c!backgroundcolor=trace:references:onpage, + \c!align=\v!normal] + +\startsetups trace:references:onpage + \vbox to \vsize \bgroup + \infofont + \vskip\dimexpr-\topspace-\headerheight+2\exheight\relax + \hbox to \hsize \bgroup + \doifoddpageelse\hss{\hskip\dimexpr-\cutspace+2\exheight\relax}% + \directlocalframed [ + trace:references:onpage + ] { + \ctxcommand{getreferencesonpage(\the\realpageno)} + } + \doifoddpageelse{\hskip\dimexpr-\cutspace+2\exheight\relax}\hss + \egroup + \vss + \egroup +\stopsetups + +\protect + +\continueifinputfile{s-references-show.mkiv} + +\usemodule[art-01] + +\setupinteraction + [state=start] + +\setuppagenumbering + [alternative=doublesided] + +\starttext + +\title {Contents} + +\placelist[chapter] + +\setupreferenceprefix[zero] + +\chapter[crap]{foo} + +\setupreferenceprefix[one] + +test \pagereference[whatever] + +\dorecurse{5}{ + \placefigure + [here][bar 1.#1] + {xx}{\framed{xx #1}} +} + +\setupreferenceprefix[two] + +\dorecurse{5}{ + \placefigure + [here][bar 2.#1] + {xx}{\framed{xx #1}} +} + +\in{checked}[bar 1.1] +\in{checked}[bar 2.1] + +\stoptext diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index db0b63cec..b2676f4dd 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 54a798c4a..3832c19b2 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-doc.mkiv b/tex/context/base/strc-doc.mkiv index 05b31bf4f..c453f199e 100644 --- a/tex/context/base/strc-doc.mkiv +++ b/tex/context/base/strc-doc.mkiv @@ -27,6 +27,6 @@ view {\interactionparameter\c!focus}% \relax \xdef\currentstructureattribute {\the\lastdestinationattribute}% - \xdef\currentstructuresynchronize{\ctxlatecommand{enhancelist(#1)}}} + \xdef\currentstructuresynchronize{\strc_lists_inject_enhance{#1}{\nextinternalreference}}} \protect \endinput diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index 3788700a0..722f70c9a 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -510,6 +510,7 @@ \edef\floatlocation{\floatparameter\c!default}% beware of a clash between alignment locations \fi \strc_floats_analyze_location + % todo: use \lets \setupcurrentfloatcaption[\c!reference={#reference},\c!title={#caption},\c!marking=,\c!list=,\c!bookmark=]% \doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal} diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi index 80703022e..903471913 100644 --- a/tex/context/base/strc-itm.mkvi +++ b/tex/context/base/strc-itm.mkvi @@ -247,8 +247,6 @@ \normalexpanded{\textreference[\currentitemreference]{\strc_itemgroups_extra_symbol}}% \fi \fi} -\let\dofinishitemreference\dofinishfullreference % finalizer - \def\strc_itemgroups_insert_reference_indeed % maybe we need a 'frozen counter' numberdata blob / quick hack .. .mive this to strc-ref {%\setnextinternalreference % no need to collect nodes in \b_strc_destination_nodes here ... maybe at some point diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index b6d79e54f..b0f900b68 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -127,12 +127,15 @@ \def\strc_lists_inject_nop[#dummya][#dummyb]% {\endgroup} +\unexpanded\def\strc_lists_inject_enhance#listindex#internal% + {\normalexpanded{\ctxlatecommand{enhancelist(#listindex)}}} + \unexpanded\def\strc_lists_inject_yes[#settings][#userdata]% can be used directly {\setupcurrentlist[\c!type=userdata,\c!location=\v!none,#settings]% grouped (use \let... \edef\p_location{\listparameter\c!location}% \setnextinternalreference \scratchcounter\clf_addtolist - references { + references { internal \nextinternalreference block {\currentsectionblock} % section structures.sections.currentid() @@ -149,7 +152,7 @@ \edef\currentlistnumber{\the\scratchcounter}% \ifx\p_location\v!here % this branch injects nodes ! - \expanded{\ctxlatecommand{enhancelist(\currentlistnumber)}}% + \strc_lists_inject_enhance{\currentlistnumber}{\nextinternalreference}% \clf_setinternalreference internal \nextinternalreference\relax % this will change \xdef\currentstructurelistattribute{\the\lastdestinationattribute}% \dontleavehmode\hbox attr \destinationattribute \lastdestinationattribute{}% todo @@ -1264,11 +1267,10 @@ \hskip-\leftskip \ifconditional\c_lists_has_number \ifconditional\c_lists_show_number - \setbox\scratchbox\hbox\ifdim\scratchwidth>\zeropoint to \scratchwidth\fi + \setbox\scratchbox\simplealignedbox\scratchwidth{\usealignparameter\c!numberalign} \bgroup \useliststyleandcolor\c!numberstyle\c!numbercolor \currentlistsymbol - \hss \egroup \ifdim\wd\scratchbox>\zeropoint \box\scratchbox diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index 9e69ed248..d51b6f48c 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -481,7 +481,6 @@ % currentstructurecomponent => \strc_current_ or just \m_strc_ - \unexpanded\def\strc_counters_register_component#1#2#3#4#5#6#7[#8][#9]% maybe also nolist {\begingroup % @@ -519,9 +518,21 @@ \glet\m_strc_counters_last_registered_attribute \attributeunsetvalue \glet\m_strc_counters_last_registered_synchronize\relax} +\def\strc_counters_register_component_check_prefix + {\ifx\currentstructurecomponentreferenceprefix\empty + \let\currentstructurecomponentreferenceprefix\currentstructurereferenceprefix + \fi + \ifx\currentstructurecomponentreferenceprefix\empty + \let\currentstructurecomponentreferenceprefix\referenceprefix + \fi + \ifdefined\currentstructurecomponentreferenceprefix\else + \let\currentstructurecomponentreferenceprefix\empty + \fi} + \def\strc_counters_register_component_page#1% {\xdef\currentstructurecomponentreference {#1\c!reference}% \xdef\currentstructurecomponentreferenceprefix{#1\c!referenceprefix}% + \strc_counters_register_component_check_prefix \setnextinternalreference \clf_setreferenceattribute {\currentstructurecomponentreferenceprefix}% @@ -529,7 +540,7 @@ {% references {% internal \nextinternalreference - block {\currentsectionblock}% + block {\currentsectionblock}% move to lua view {\interactionparameter\c!focus}% }% metadata {% @@ -550,6 +561,7 @@ \xdef\currentstructurecomponentlabel {#2\c!label}% \xdef\currentstructurecomponentreference {#2\c!reference}% \xdef\currentstructurecomponentreferenceprefix{#2\c!referenceprefix}% + \strc_counters_register_component_check_prefix \ifx\currentstructurecomponentexpansion\s!xml \xmlstartraw \xdef\currentstructurecomponenttitle {#2\c!title}% @@ -650,7 +662,7 @@ \xdef\m_strc_counters_last_registered_index{\the\scratchcounter}% \clf_setinternalreference internal \nextinternalreference\relax \xdef\m_strc_counters_last_registered_attribute {\the\lastdestinationattribute}% - \xdef\m_strc_counters_last_registered_synchronize{\ctxlatecommand{enhancelist(\m_strc_counters_last_registered_index)}}} + \xdef\m_strc_counters_last_registered_synchronize{\strc_lists_inject_enhance{\m_strc_counters_last_registered_index}{\nextinternalreference}}} \let\m_strc_counters_last_registered_index \relax \let\m_strc_counters_last_registered_attribute \relax diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 9cf703b74..ba5ddd139 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -128,7 +128,7 @@ local context_delayed = context.delayed local ctx_pushcatcodes = context.pushcatcodes local ctx_popcatcodes = context.popcatcodes -local ctx_dofinishsomereference = context.dofinishsomereference +local ctx_dofinishreference = context.dofinishreference local ctx_dofromurldescription = context.dofromurldescription local ctx_dofromurlliteral = context.dofromurlliteral local ctx_dofromfiledescription = context.dofromfiledescription @@ -378,6 +378,7 @@ implement { function references.set(kind,prefix,tag,data) -- setcomponent(data) +-- print(kind,prefix,tag) local pd = tobesaved[prefix] -- nicer is a metatable if not pd then pd = { } @@ -396,7 +397,8 @@ function references.set(kind,prefix,tag,data) else n = n + 1 pd[ref] = data - ctx_dofinishsomereference(kind,prefix,ref) + local r = data.references + ctx_dofinishreference(prefix or "",ref or "",r and r.internal or 0) end end process_settings(tag,action) @@ -440,12 +442,31 @@ implement { local function register_from_lists(collected,derived,pages,sections) local derived_g = derived[""] -- global + local derived_p = nil + local derived_c = nil + local prefix = nil + local component = nil + local entry = nil if not derived_g then derived_g = { } derived[""] = derived_g end + local function action(s) + if trace_referencing then + report_references("list entry %a provides %a reference %a on realpage %a",i,kind,s,realpage) + end + if derived_p and not derived_p[s] then + derived_p[s] = entry + end + if derived_c and not derived_c[s] then + derived_c[s] = entry + end + if not derived_g[s] then + derived_g[s] = entry -- first wins + end + end for i=1,#collected do - local entry = collected[i] + entry = collected[i] local metadata = entry.metadata if metadata then local kind = metadata.kind @@ -456,10 +477,8 @@ local function register_from_lists(collected,derived,pages,sections) if reference and reference ~= "" then local realpage = references.realpage if realpage then - local prefix = references.referenceprefix - local component = references.component - local derived_p = nil - local derived_c = nil + prefix = references.referenceprefix + component = references.component if prefix and prefix ~= "" then derived_p = derived[prefix] if not derived_p then @@ -474,20 +493,6 @@ local function register_from_lists(collected,derived,pages,sections) derived[component] = derived_c end end - local function action(s) - if trace_referencing then - report_references("list entry %a provides %a reference %a on realpage %a",i,kind,s,realpage) - end - if derived_p and not derived_p[s] then - derived_p[s] = entry - end - if derived_c and not derived_c[s] then - derived_c[s] = entry - end - if not derived_g[s] then - derived_g[s] = entry -- first wins - end - end process_settings(reference,action) end end @@ -500,6 +505,79 @@ end references.registerinitializer(function() register_from_lists(lists.collected,derived) end) +-- tracing + +local function collectbypage(tracedpages) + -- lists + do + local collected = structures.lists.collected + local data = nil + local function action(reference) + local prefix = data.referenceprefix + local component = data.component + local realpage = data.realpage + if realpage then + local pagelist = rawget(tracedpages,realpage) + local internal = data.internal or 0 + local prefix = (prefix ~= "" and prefix) or (component ~= "" and component) or "" + local pagedata = { prefix, reference, internal } + if pagelist then + pagelist[#pagelist+1] = pagedata + else + tracedpages[realpage] = { pagedata } + end + if internal > 0 then + data.usedprefix = prefix + end + end + end + for i=1,#collected do + local entry = collected[i] + local metadata = entry.metadata + if metadata and metadata.kind then + data = entry.references + if data then + local reference = data.reference + if reference and reference ~= "" then + process_settings(reference,action) + end + end + end + end + end + -- references + do + for prefix, list in next, collected do + for reference, entry in next, list do + local data = entry.references + local reference = data and data.reference + if reference then + local realpage = data.realpage + local internal = data.internal or 0 + local pagelist = rawget(tracedpages,realpage) + local pagedata = { prefix, reference, internal } + if pagelist then + pagelist[#pagelist+1] = pagedata + else + tracedpages[realpage] = { pagedata } + end + if internal > 0 then + data.usedprefix = prefix + end + end + end + end + end +end + +references.tracedpages = table.setmetatableindex(allocate(),function(t,k) + if collectbypage then + collectbypage(t) + collectbypage = nil + end + return rawget(t,k) +end) + -- urls local urls = references.urls or { } diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index fe4e5c765..fea01d270 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -120,6 +120,9 @@ % maybe: \let\reference\textreference +\unexpanded\def\showreferences + {\enabletrackers[nodes.references.show,nodes.destinations.show]} + %D These are implemented in a low level form as: \unexpanded\def\strc_references_text_reference [#labels]{\strc_references_set_named_reference\s!text{#labels}{}} @@ -142,13 +145,10 @@ \newcount\lastreferenceattribute \newcount\lastdestinationattribute -\def\dofinishfullreference#prefix#label{\normalexpanded{\ctxlatecommand{enhancereference("#prefix","#label")}}} -\def\dofinishtextreference#prefix#label{\normalexpanded{\ctxlatecommand{enhancereference("#prefix","#label")}}} - -\let\dofinishpagereference\dofinishfullreference -\let\dofinishuserreference\dofinishfullreference +\def\strc_references_finish#prefix#reference#internal% + {\normalexpanded{\ctxlatecommand{enhancereference("#prefix","#reference")}}} -\def\dofinishsomereference#kind{\executeifdefined{dofinish#{kind}reference}\gobbletwoarguments} +\let\dofinishreference\strc_references_finish % used at lua end % This is somewhat tricky: we want to keep the reference with the following word but % that word should also hyphenate. We need to find a better way. diff --git a/tex/context/base/trac-vis.lua b/tex/context/base/trac-vis.lua index 81ac0f206..86af6da0b 100644 --- a/tex/context/base/trac-vis.lua +++ b/tex/context/base/trac-vis.lua @@ -190,7 +190,7 @@ end local function enable() if not usedfont then - -- we use a narrow monospaced font + -- we use a narrow monospaced font -- infofont ? visualizers.setfont(fonts.definers.define { name = "lmmonoltcond10regular", size = tex.sp("4pt") }) end for mode, value in next, modes do @@ -315,7 +315,7 @@ local c_glyph_d = "trace:do" local c_white_d = "trace:dw" local c_math_d = "trace:dr" -local function sometext(str,layer,color,textcolor) -- we can just paste verbatim together .. no typesteting needed +local function sometext(str,layer,color,textcolor,lap) -- we can just paste verbatim together .. no typesteting needed local text = fast_hpack_string(str,usedfont) local size = getfield(text,"width") local rule = new_rule(size,2*exheight,exheight/2) @@ -329,10 +329,13 @@ local function sometext(str,layer,color,textcolor) -- we can just paste verbatim local info = linked_nodes(rule,kern,text) setlisttransparency(info,c_zero) info = fast_hpack(info) + local width = getfield(info,"width") + if lap then + info = fast_hpack(linked_nodes(new_kern(-width),info)) + end if layer then setattr(info,a_layer,layer) end - local width = getfield(info,"width") setfield(info,"width",0) setfield(info,"height",0) setfield(info,"depth",0) diff --git a/tex/context/base/trac-vis.mkiv b/tex/context/base/trac-vis.mkiv index 1264ec49a..a227e8354 100644 --- a/tex/context/base/trac-vis.mkiv +++ b/tex/context/base/trac-vis.mkiv @@ -117,7 +117,7 @@ \def\syst_visualizers_setfont[#1]% somename at 4pt {\begingroup \doifelsenothing{#1}{\definedfont[Mono at 4pt]}{\definedfont[#1]}% - \clf_setvisualfont + \clf_setvisualfont\fontid\font \endgroup} %D New (these might also be a visualizers): diff --git a/tex/context/base/typo-chr.lua b/tex/context/base/typo-chr.lua index 073574218..94095828d 100644 --- a/tex/context/base/typo-chr.lua +++ b/tex/context/base/typo-chr.lua @@ -86,6 +86,8 @@ if not modules then modules = { } end modules ['typo-chr'] = { -- arguments = "string", -- } +local insert, remove = table.insert, table.remove + local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph @@ -94,7 +96,9 @@ local free_node = node.free local punctuation = characters.is_punctuation -local function removepunctuation() +local stack = { } + +local function pickup() local list = texnest[texnest.ptr] if list then local tail = list.tail @@ -104,12 +108,48 @@ local function removepunctuation() if prev then prev.next = nil end - free_node(tail) + list.tail = prev + tail.prev = nil + return tail + end + end +end + +local actions = { + remove = function(specification) + local n = pickup() + if n then + free_node(n) + end + end, + push = function(specification) + local n = pickup() + if n then + insert(stack,n or false) + end + end, + pop = function(specification) + local n = remove(stack) + if n then + context(n) end + end, +} + +local function pickuppunctuation(specification) + local action = actions[specification.action or "remove"] + if action then + action(specification) end end interfaces.implement { - name = "removepunctuation", - actions = removepunctuation, + name = "pickuppunctuation", + actions = pickuppunctuation, + arguments = { + { + { "action" } + } + } } + diff --git a/tex/context/base/typo-chr.mkiv b/tex/context/base/typo-chr.mkiv index c6f17ceca..9d8dd7c20 100644 --- a/tex/context/base/typo-chr.mkiv +++ b/tex/context/base/typo-chr.mkiv @@ -21,6 +21,8 @@ \registerctxluafile{typo-chr}{1.001} -\unexpanded\def\removepunctuation{\clf_removepunctuation} +\unexpanded\def\removepunctuation{\clf_pickuppunctuation action {remove}\relax} +\unexpanded\def\pushpunctuation {\clf_pickuppunctuation action {push}\relax} +\unexpanded\def\poppunctuation {\clf_pickuppunctuation action {pop}\relax} \protect diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 193b5b58f..c8e7e7517 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -868,6 +868,7 @@ + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 06f34e8c2..a100a938f 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -868,6 +868,7 @@ + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 362bb7ad9..0e51dfc7c 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -868,6 +868,7 @@ + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 50f1ce9db..cd35ad7e1 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -868,6 +868,7 @@ + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 477fa9caf..f07dbb5e6 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -868,6 +868,7 @@ + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 3807ae464..f32d79275 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -868,6 +868,7 @@ + diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index f784912ef..a55ad78ce 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -868,6 +868,7 @@ + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 69a0394c5..951a5e8c9 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -868,6 +868,7 @@ + diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 448846b84..612fb34da 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/12/15 15:41:22 +-- merge date : 04/13/15 19:30:46 do -- begin closure to overcome local limits and interference -- cgit v1.2.3