From 48c3ce21b30a886099e9afc2edf683e8a47ba29e Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Fri, 26 Feb 2016 17:15:09 +0100 Subject: 2016-02-26 16:11:00 --- tex/context/base/context-version.pdf | Bin 4172 -> 4169 bytes tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/lpdf-ano.lua | 7 +- tex/context/base/mkiv/node-ref.lua | 168 ++++++++++++----- tex/context/base/mkiv/publ-imp-apa.lua | 45 ++--- tex/context/base/mkiv/publ-imp-apa.mkvi | 14 +- tex/context/base/mkiv/status-files.pdf | Bin 9064 -> 8959 bytes tex/context/base/mkiv/status-lua.pdf | Bin 267224 -> 267149 bytes tex/context/base/mkiv/strc-mat.mkiv | 4 +- tex/context/base/mkiv/strc-not.lua | 74 ++------ tex/context/base/mkiv/strc-not.mkvi | 204 +++++++++++++-------- tex/context/base/mkiv/strc-ref.lua | 4 +- tex/context/base/mkiv/strc-ref.mkvi | 48 +++++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 15 files changed, 370 insertions(+), 204 deletions(-) (limited to 'tex') diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index db62d2f0f..83f314934 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/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 9b95cfa8c..49bc48b60 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{2016.02.25 14:00} +\newcontextversion{2016.02.26 16:09} %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 2bf4d34c5..6533fb6ee 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.02.25 14:00} +\edef\contextversion{2016.02.26 16:09} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua index 42e3c3b10..657ff17e5 100644 --- a/tex/context/base/mkiv/lpdf-ano.lua +++ b/tex/context/base/mkiv/lpdf-ano.lua @@ -512,8 +512,11 @@ end local function pdflinkname(destination,internal,page) local method = references.innermethod if method == v_auto then - flaginternals[internal] = true -- for bookmarks and so - local used = usedinternals[internal] + local used = defaultview + if internal then + flaginternals[internal] = true -- for bookmarks and so + used = usedinternals[internal] or defaultview + end if used == defaultview then -- or used == true then return pagereferences[page] else diff --git a/tex/context/base/mkiv/node-ref.lua b/tex/context/base/mkiv/node-ref.lua index c6316917d..ca408b44d 100644 --- a/tex/context/base/mkiv/node-ref.lua +++ b/tex/context/base/mkiv/node-ref.lua @@ -101,7 +101,16 @@ local implement = interfaces.implement -- a paragraph we have a problem: we cannot calculate the height well. This happens -- with footnotes or content broken across a page. -local function vlist_dimensions(start,stop) +local function hlist_dimensions(start,stop,parent) + local last = stop and getnext(stop) + if parent then + return list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign"),getfield(parent,"glue_order"),start,last) + else + return list_dimensions(start,last) + end +end + +local function vlist_dimensions(start,stop) -- also needs the stretch and so local temp if stop then temp = getnext(stop) @@ -111,7 +120,7 @@ local function vlist_dimensions(start,stop) local w = getfield(v,"width") local h = getfield(v,"height") local d = getfield(v,"depth") - setlist(v) + setlist(v) -- not needed free_node(v) if temp then setnext(stop,temp) @@ -119,19 +128,10 @@ local function vlist_dimensions(start,stop) return w, h, d end -local function hlist_dimensions(start,stop,parent) - local last = stop and getnext(stop) - if parent then - return list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign"),getfield(parent,"glue_order"),start,last) - else - return list_dimensions(start,last) - end -end - local function dimensions(parent,start,stop) -- in principle we could move some to the caller local id = getid(start) if start == stop then - if id == hlist_code or id == vlist_code or id == glyph_code or id == rule_code then -- or image + if id == hlist_code or id == vlist_code or id == glyph_code or id == rule_code then if trace_areas then report_area("dimensions taken of %a",nodecodes[id]) end @@ -156,29 +156,77 @@ local function dimensions(parent,start,stop) -- in principle we could move some -- todo: if no prev and no next and parent -- todo: we need a a list_dimensions for a vlist if getid(parent) == vlist_code then - local l = getlist(parent) - local c = l - local ok = false - while c do - if c == start then - ok = true + if false then + local l = getlist(parent) + local c = l + local ok = false + while c do + if c == start then + ok = true + end + if ok and getid(c) == hlist_code then + break + else + c = getnext(c) + end end - if ok and getid(c) == hlist_code then - break + if ok and c then + if trace_areas then + report_area("dimensions taken of first line in vlist") + end + return getfield(c,"width"), getfield(c,"height"), getfield(c,"depth"), c else - c = getnext(c) - end - end - if ok and c then - if trace_areas then - report_area("dimensions taken of first line in vlist") + if trace_areas then + report_area("dimensions taken of vlist (probably wrong)") + end + return hlist_dimensions(start,stop,parent) end - return getfield(c,"width"), getfield(c,"height"), getfield(c,"depth"), c else - if trace_areas then - report_area("dimensions taken of vlist (probably wrong)") + -- + -- we can as well calculate here because we only have kerns and glue + -- + local first = nil + local last = nil + local current = start + local noflines = 0 + while current do + local id = getid(current) + if id == hlist_code or id == vlist_code or id == rule_code then + if noflines == 0 then + first = current + noflines = 1 + else + noflines = noflines + 1 + end + last = current + end + if current == stop then + break + else + current = getnext(current) + end + end + if noflines > 1 then + if trace_areas then + report_area("dimensions taken of vlist") + end + local w, h, d = vlist_dimensions(first,last,parent) + local ht = getfield(first,"height") + return w, ht, d + h - ht, first + else + -- return hlist_dimensions(start,stop,parent) + if first then + if trace_areas then + report_area("dimensions taken of first line in vlist") + end + return getfield(first,"width"), getfield(first,"height"), getfield(first,"depth"), first + else + if trace_areas then + report_area("dimensions taken of vlist (probably wrong)") + end + return hlist_dimensions(start,stop,parent) + end end - return hlist_dimensions(start,stop,parent) end else if trace_areas then @@ -207,7 +255,7 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t -- special case, we only treat the first line in a vlist local l = getlist(line) if trace_areas then - report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","line", + report_area("%s: %i : %s %s %s => w=%p, h=%p, d=%p, c=%S","line", reference,pardir or "---",txtdir or "---", tosequence(l,nil,true),width,height,depth,resolved) end @@ -217,7 +265,7 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t else if head == first then if trace_areas then - report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","head", + report_area("%s: %i : %s %s %s => w=%p, h=%p, d=%p, c=%S","head", reference,pardir or "---",txtdir or "---", tosequence(first,last,true),width,height,depth,resolved) end @@ -225,7 +273,7 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t return result, last else if trace_areas then - report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","middle", + report_area("%s: %i : %s %s %s => w=%p, h=%p, d=%p, c=%S","middle", reference,pardir or "---",txtdir or "---", tosequence(first,last,true),width,height,depth,resolved) end @@ -234,9 +282,6 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t setlink(prev,result) end setlink(result,first) - -- if first == getnext(head) then - -- setnext(head,result) -- hm, weird - -- end return head, last end end @@ -312,6 +357,12 @@ end -- skip is somewhat messy +-- todo: when line we can look at the next line + +-- see dimensions: this is tricky with split off boxes like inserts +-- where we can end up with a first and last spanning lines so maybe +-- we need to do vlists differently + local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,txtdir) -- main if head then local current, first, last, firstdir, reference = head, nil, nil, nil, nil @@ -320,10 +371,6 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx while current do local id = getid(current) if id == hlist_code or id == vlist_code then - - -- see dimensions: this is tricky with split off boxes like inserts - -- where we can end up with a first and last spanning lines - local r = getattr(current,attribute) -- test \goto{test}[page(2)] test \gotobox{test}[page(2)] -- test \goto{\TeX}[page(2)] test \gotobox{\hbox {x} \hbox {x}}[page(2)] @@ -350,7 +397,9 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx if list then local h, ok h, ok , pardir, txtdir = inject_areas(list,attribute,make,stack,done,r or skip or 0,current,pardir,txtdir) - setlist(current,h) + if h ~= current then + setlist(current,h) + end end if r then done[r] = done[r] - 1 @@ -402,7 +451,10 @@ local function inject_area(head,attribute,make,stack,done,parent,pardir,txtdir) end local list = getlist(current) if list then - setlist(current,(inject_area(list,attribute,make,stack,done,current,pardir,txtdir))) + local h = inject_area(list,attribute,make,stack,done,current,pardir,txtdir) + if h ~= current then + setlist(current,h) + end end elseif id == dir_code then txtdir = getfield(current,"dir") @@ -776,11 +828,11 @@ function references.mark(reference,h,d,view) end function references.inject(prefix,reference,specification) -- todo: use currentreference is possible --- print(prefix,reference,h,d,highlight,newwindow,layer) local set, bug = references.identify(prefix,reference) if bug or #set == 0 then -- unknown ref, just don't set it and issue an error else + -- nil prefix when "" -- check set.highlight = specification.highlight set.newwindow = specification.newwindow @@ -789,6 +841,21 @@ function references.inject(prefix,reference,specification) -- todo: use currentr end end +function references.injectinternal(internal,specification) -- todo: use currentreference is possible + local set = references.internals[internal] + if set then + -- unknown ref, just don't set it and issue an error + else + -- nil prefix when "" + -- check + set = { set } + set.highlight = specification.highlight + set.newwindow = specification.newwindow + set.layer = specification.layer + setreference(specification.height,specification.depth,set) -- sets attribute / todo: for set[*].error + end +end + function references.injectcurrentset(h,d) -- used inside doifelse local currentset = references.currentset if currentset then @@ -812,6 +879,21 @@ implement { } } +implement { + name = "injectinternalreference", + actions = references.injectinternal, + arguments = { + "integer", + { + { "highlight", "boolean" }, + { "newwindow", "boolean" }, + { "layer" }, + { "height", "dimen" }, + { "depth", "dimen" }, + } + } +} + implement { name = "injectcurrentreference", actions = references.injectcurrentset, diff --git a/tex/context/base/mkiv/publ-imp-apa.lua b/tex/context/base/mkiv/publ-imp-apa.lua index c6fe248ce..f2e7f11e1 100644 --- a/tex/context/base/mkiv/publ-imp-apa.lua +++ b/tex/context/base/mkiv/publ-imp-apa.lua @@ -33,6 +33,7 @@ local specification = { author = "author", -- interpreted as name(s) withauthor = "author", editor = "author", + translator = "author", artist = "author", composer = "author", producer = "author", @@ -90,7 +91,7 @@ categories.article = { "author" }, optional = { - "withauthor", + "withauthor", "translator", "year", "subtitle", "type", "file", "journal", "volume", "number", "pages", @@ -108,7 +109,7 @@ categories.magazine = { "journal", }, optional = { - "withauthor", + "withauthor", "translator", "subtitle", "type", "file", "number", "month", "day", @@ -130,7 +131,7 @@ categories.periodical = { "year", }, optional = { - "author", "withauthor", + "author", "withauthor", "translator", "subtitle", "file", "series", "volume", "number", "month", "organization", @@ -152,7 +153,7 @@ categories.standard = { "doi", "note", }, optional = { - "withauthor", + "withauthor", "translator", }, } @@ -166,7 +167,7 @@ categories.book = { }, required = { "author" }, optional = { - "withauthor", + "withauthor", "translator", "year", "month", "day", "subtitle", "type", "file", "editionset", "series", @@ -188,7 +189,7 @@ categories.inbook = { "year" , }, optional = { - "withauthor", + "withauthor", "translator", "subtitle", "type", "file", "booktitle", -- APA ignores this: "chapter", @@ -214,7 +215,7 @@ categories.incollection = { "year", }, optional = { - "withauthor", + "withauthor", "translator", "subtitle", "type", "file", "editionset", "series", -- APA ignores this: "chapter", @@ -236,7 +237,7 @@ categories.booklet = { "author" }, optional = { - "withauthor", + "withauthor", "translator", "publisher", "year", "month", "subtitle", "type", "file", @@ -259,7 +260,7 @@ categories.proceedings = { "year" }, optional = { - "withauthor", + "withauthor", "translator", "publisher", "subtitle", "file", "editionset", "series", @@ -275,7 +276,7 @@ categories.inproceedings = { sets = categories.incollection.sets, required = categories.incollection.required, optional = { - "withauthor", + "withauthor", "translator", "subtitle", "type", "file", "month", "edition", "series", @@ -300,7 +301,7 @@ categories.thesis = { "type" }, optional = { - "withauthor", + "withauthor", "translator", "subtitle", "file", "month", "address", @@ -317,7 +318,7 @@ categories.mastersthesis = { "year" }, optional = { - "withauthor", + "withauthor", "translator", "type", "subtitle", "file", "month", @@ -343,7 +344,7 @@ categories.techreport = { "year" }, optional = { - "withauthor", + "withauthor", "translator", "publisher", "address", "subtitle", "file", @@ -367,7 +368,7 @@ categories.manual = { }, optional = { "author", "publisher", - "withauthor", + "withauthor", "translator", "address", "subtitle", "file", "editionset", "month", "year", @@ -396,7 +397,7 @@ categories.patent = { "type", --check this: "language", "author", "publisher", - "withauthor", + "withauthor", "translator", "title", "subtitle", "file", "address", "day", "month", @@ -416,7 +417,7 @@ categories.unpublished = { "note" }, optional = { - "withauthor", + "withauthor", "translator", "subtitle", "file", "year", "month", "doi" @@ -435,7 +436,7 @@ categories.electronic = { optional = { "subtitle", "type", "file", "year", "month", - "author", "withauthor", + "author", "withauthor", "translator", "address", "organization", "howpublished", @@ -457,7 +458,7 @@ categories.film = { "address", "publisher", -- aka studio }, optional = { - "withauthor", + "withauthor", "translator", "type", "note", "doi", @@ -477,7 +478,7 @@ categories.music = { "address", "publisher", -- aka label }, optional = { - "withauthor", + "withauthor", "translator", "type", "note", "doi", @@ -494,7 +495,7 @@ categories.misc = { -- nothing is really important here }, optional = { - "author", "withauthor", + "author", "withauthor", "translator", "title", "subtitle", "file", "year", "month", "howpublished", @@ -514,7 +515,7 @@ categories.other = { "year" }, optional = { - "withauthor", + "withauthor", "translator", "subtitle", "file", "doi", "note", }, @@ -532,7 +533,7 @@ categories.literal = { "text" }, optional = { - "withauthor", + "withauthor", "translator", "doi", "note" }, virtual = false, diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi index fae2dcc6d..5600b5722 100644 --- a/tex/context/base/mkiv/publ-imp-apa.mkvi +++ b/tex/context/base/mkiv/publ-imp-apa.mkvi @@ -80,6 +80,11 @@ [apa:\s!list:editor] [apa:\s!list:author] +\definebtx + [apa:\s!list:translator] + [apa:\s!list:author] + [\c!authorconversion=normalshort] + \definebtx [apa:\s!list:suffix] [apa:\s!list] @@ -482,7 +487,7 @@ apa:Directors=Directors, apa:Recordedby={Recorded by}, apa:Author=Author, - apa:Translator={Trans.}, % Translator(s) (not used?) + apa:Translator={Trans.}, % Translator(s) apa:Advanced={Advanced online publication}, apa:Retrieved={Available from}, % {Retrieved from}, apa:In=In] @@ -792,6 +797,13 @@ \texdefinition{btx:apa:composed-title}{title} } \btxdoif {title} { + \btxdoif {translator} { + \btxleftparenthesis + \btxflush{translator} + \btxcomma + \btxlabeltext{apa:Translator} + \btxrightparenthesis + } \btxperiod % TODO: this period may NOT be wanted, as in: Title (2nd ed.). } diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 0b2a283e6..7c90060c8 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 1dc7bb32f..2f6007d38 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/base/mkiv/strc-mat.mkiv b/tex/context/base/mkiv/strc-mat.mkiv index 5bfad81eb..85870d547 100644 --- a/tex/context/base/mkiv/strc-mat.mkiv +++ b/tex/context/base/mkiv/strc-mat.mkiv @@ -949,7 +949,7 @@ \def\strc_formulas_start_place_yes[#1]% {\doifassignmentelse{#1}\strc_formulas_start_place_parameters\strc_formulas_start_place_reference[#1]} -\def\strc_formulas_start_place_nop +\def\strc_formulas_start_place_nop[#1]% {\let\currentplaceformulareference\empty \let\currentplaceformulasuffix \empty \strc_formulas_place_nop} @@ -961,7 +961,7 @@ \strc_formulas_place_nop} \def\strc_formulas_start_place_parameters[#1]% - {\letdummyparameter\c!name \empty + {\letdummyparameter\c!title \empty \letdummyparameter\c!reference\empty \letdummyparameter\c!suffix \empty \getdummyparameters[#1]% diff --git a/tex/context/base/mkiv/strc-not.lua b/tex/context/base/mkiv/strc-not.lua index 71eccf1ce..bf14092d1 100644 --- a/tex/context/base/mkiv/strc-not.lua +++ b/tex/context/base/mkiv/strc-not.lua @@ -302,85 +302,51 @@ implement { actions = notes.postpone } -function notes.setsymbolpage(tag,n,l) - local l = l or listindex(tag,n) - if l then - local p = texgetcount("realpageno") - if trace_notes or trace_references then - report_notes("note %a of %a with list index %a gets symbol page %a",n,tag,l,p) - end - local entry = lists.cached[l] - if entry then - entry.references.symbolpage = p - else - report_notes("internal error: note %a of %a is not flushed",n,tag) - end - else - report_notes("internal error: note %a of %a is not initialized",n,tag) - end -end - -implement { - name = "setnotesymbolpage", - actions = notes.setsymbolpage, - arguments = { "string", "integer" } -} - -local function getsymbolpage(tag,n) - local li = internal(tag,n) - li = li and li.references - li = li and (li.symbolpage or li.realpage) or 0 - if trace_notes or trace_references then - report_notes("page number of note symbol %a of %a is %a",n,tag,li) - end - return li -end - -local function getnumberpage(tag,n) +local function getinternal(tag,n) local li = internal(tag,n) - li = li and li.references - li = li and li.realpage or 0 - if trace_notes or trace_references then - report_notes("page number of note number %s of %a is %a",n,tag,li) + if li then + local references = li.references + if references then + return references.internal or 0 + end end - return li + return 0 end local function getdeltapage(tag,n) -- 0:unknown 1:textbefore, 2:textafter, 3:samepage - local what = 0 - -- references.internals[lists.tobesaved[nd].internal] local li = internal(tag,n) if li then local references = li.references if references then - local symbolpage = references.symbolpage or 0 - local notepage = references.realpage or 0 + + -- local symb = structures.references.collected[""]["symb:"..tag..":"..n] + local symb = structures.references.collected[""]["*"..(references.internal or 0)] + local notepage = references.realpage or 0 + local symbolpage = symb and symb.references.realpage or -1 if trace_references then report_notes("note number %a of %a points from page %a to page %a",n,tag,symbolpage,notepage) end if notepage < symbolpage then - what = 3 -- after + return 3 -- after elseif notepage > symbolpage then - what = 2 -- before + return 2 -- before elseif notepage > 0 then - what = 1 -- same + return 1 -- same end else -- might be a note that is not flushed due to to deep -- nesting in a vbox end end - return what + return 0 end -notes.getsymbolpage = getsymbolpage -notes.getnumberpage = getnumberpage -notes.getdeltapage = getdeltapage +notes.getinternal = getinternal +notes.getdeltapage = getdeltapage -implement { name = "notesymbolpage", actions = { getsymbolpage, context }, arguments = { "string", "integer" } } -implement { name = "notenumberpage", actions = { getnumberpage, context }, arguments = { "string", "integer" } } -implement { name = "notedeltapage", actions = { getdeltapage, context }, arguments = { "string", "integer" } } +implement { name = "noteinternal", actions = { getinternal, context }, arguments = { "string", "integer" } } +implement { name = "notedeltapage", actions = { getdeltapage, context }, arguments = { "string", "integer" } } local function flushnotes(tag,whatkind,how) -- store and postpone local state = notestates[tag] diff --git a/tex/context/base/mkiv/strc-not.mkvi b/tex/context/base/mkiv/strc-not.mkvi index c3dc86f3e..43de7e108 100644 --- a/tex/context/base/mkiv/strc-not.mkvi +++ b/tex/context/base/mkiv/strc-not.mkvi @@ -430,9 +430,6 @@ \settrue\processingnote \ifconditional\c_strc_notes_skip \globallet\lastnotesymbol\strc_notes_inject_symbol_nop - \ifconditional\c_strc_notes_delayed - \strc_notes_inject_symbol_snc - \fi \else \iftypesettinglines % otherwise problems with \type {xxx} \ignorelines % makes footnotes work in \startlines ... \stoplines @@ -493,6 +490,9 @@ \newconstant\a_strc_notes_text_reference \newconstant\a_strc_notes_text_destination +\let\strc_notes_get_reference_attribute_symbol \empty +\let\strc_notes_get_destination_attribute_symbol\empty + \def\strc_notes_interaction_check_inline {\edef\p_interaction{\noteparameter\c!interaction}% \csname\??noteinteractioninline @@ -505,58 +505,111 @@ \ifcsname\??noteinteractiondisplay\p_interaction\endcsname\p_interaction\else\v!no\fi \endcsname} -\setvalue{\??noteinteractioninline\v!yes}% - {\strc_references_get_simple_page_reference{page(\clf_notenumberpage{\currentnote}\currentnotenumber)}% - \edef\strc_notes_get_reference_attribute_symbol{attr\referenceattribute\currentreferenceattribute}% - \let \strc_notes_set_style_color_inline \strc_notes_set_style_color_inline_yes} +\def\currentnotenumber{0} -\setvalue{\??noteinteractioninline\v!all}% - {%\strc_references_get_simple_page_reference{note:\cldcontext{structures.notes.internalid("\currentnote",\currentnotenumber)}}% - \strc_references_get_simple_page_reference{note:\currentnote:\currentnotenumber}% - \edef\strc_notes_get_reference_attribute_symbol{attr\referenceattribute\currentreferenceattribute}% - \let \strc_notes_set_style_color_inline \strc_notes_set_style_color_inline_yes} +\let\strc_notes_get_reference_attribute_symbol \empty +\let\strc_notes_get_destination_attribute_symbol\empty -\setvalue{\??noteinteractioninline\v!no}% - {\let\strc_notes_get_reference_attribute_symbol\empty - \let\strc_notes_set_style_color_inline \strc_notes_set_style_color_inline_nop} +\let\strc_notes_set_reference_attribute_number\donothing +\let\strc_notes_set_reference_attribute_text \donothing +\let\strc_notes_set_destination_attribute_text\donothing + +% inline -\expandafter\let\csname\??noteinteractioninline\v!number\expandafter\endcsname\csname\??noteinteractioninline\v!yes\endcsname -\expandafter\let\csname\??noteinteractioninline\v!text \expandafter\endcsname\csname\??noteinteractioninline\v!yes\endcsname +\def\strc_references_prepare_inline_references_nop + {\let\strc_notes_get_reference_attribute_symbol\empty + \let\strc_notes_get_destination_attribute_symbol\empty + \let\strc_notes_set_style_color_inline\strc_notes_set_style_color_inline_nop} + +% \def\strc_references_prepare_inline_references_yes +% {\strc_references_set_simple_page_reference{symb:\currentnote:\currentnotenumber}% destination +% \strc_references_get_simple_page_reference{internal(\clf_noteinternal{\currentnote}\currentnotenumber)}% reference +% \edef\strc_notes_get_destination_attribute_symbol{attr\destinationattribute\currentdestinationattribute}% +% \edef\strc_notes_get_reference_attribute_symbol{attr\referenceattribute\currentreferenceattribute}% +% \let\strc_notes_set_style_color_inline\strc_notes_set_style_color_inline_yes} + +\def\strc_references_prepare_inline_references_yes + {\edef\currentnoteinternal{\clf_noteinternal{\currentnote}\currentnotenumber}% + \strc_references_set_simple_page_reference{*\currentnoteinternal}% destination + \strc_references_get_simple_page_reference{internal(\currentnoteinternal)}% reference + \edef\strc_notes_get_destination_attribute_symbol{attr\destinationattribute\currentdestinationattribute}% + \edef\strc_notes_get_reference_attribute_symbol{attr\referenceattribute\currentreferenceattribute}% + \let\strc_notes_set_style_color_inline\strc_notes_set_style_color_inline_yes} -% page(...) : we could have a dedicated one +\letvalue{\??noteinteractioninline\v!no }\strc_references_prepare_inline_references_nop +\letvalue{\??noteinteractioninline\v!all }\strc_references_prepare_inline_references_yes +\letvalue{\??noteinteractioninline\v!number}\strc_references_prepare_inline_references_yes +\letvalue{\??noteinteractioninline\v!text }\strc_references_prepare_inline_references_yes +\letvalue{\??noteinteractioninline\v!yes }\strc_references_prepare_inline_references_yes -\setvalue{\??noteinteractiondisplay\v!yes}% - {\strc_references_get_simple_page_reference{page(\clf_notesymbolpage{\currentnote}\currentnotenumber)}% - \edef\strc_notes_set_reference_attribute_number{\attribute\referenceattribute\currentreferenceattribute}% - \let \strc_notes_set_reference_attribute_text \donothing - \let \strc_notes_set_destination_attribute_text\donothing - \let \strc_notes_set_style_color_display \strc_notes_set_style_color_display_yes} +% display (for 'all' we need unique text and number attributes so we resolve twice +% as we otherwise don't get the number one which is lapped in the margin so we need +% to explicitly visit it) -\setvalue{\??noteinteractiondisplay\v!no}% +\def\strc_references_prepare_display_references_nop {\let\strc_notes_set_reference_attribute_number\donothing - \let\strc_notes_set_reference_attribute_text \donothing + \let\strc_notes_set_reference_attribute_text\donothing \let\strc_notes_set_destination_attribute_text\donothing - \let\strc_notes_set_style_color_display \strc_notes_set_style_color_display_nop} - -\setvalue{\??noteinteractiondisplay\v!all}% - {\strc_references_get_simple_page_reference{page(\clf_notesymbolpage{\currentnote}\currentnotenumber)}% - \edef\strc_notes_set_reference_attribute_text {\attribute\referenceattribute\currentreferenceattribute}% - %\strc_references_set_simple_page_reference{note:\cldcontext{structures.notes.internalid("\currentnote",\currentnotenumber)}}% - \strc_references_set_simple_page_reference{note:\currentnote:\currentnotenumber}% - \edef\strc_notes_set_destination_attribute_text{\attribute\destinationattribute\currentdestinationattribute}% - \let \strc_notes_set_reference_attribute_number\strc_notes_set_reference_attribute_text - \let \strc_notes_set_style_color_display \strc_notes_set_style_color_display_yes} - -\setvalue{\??noteinteractiondisplay\v!text}% - {\strc_references_get_simple_page_reference{page(\clf_notesymbolpage{\currentnote}\currentnotenumber)}% - \edef\strc_notes_set_reference_attribute_text {\attribute\referenceattribute\currentreferenceattribute}% - %\strc_references_set_simple_page_reference{note:\cldcontext{structures.notes.internalid("\currentnote",\currentnotenumber)}}% - \strc_references_set_simple_page_reference{note:\currentnote:\currentnotenumber}% - \edef\strc_notes_set_destination_attribute_text{\attribute\destinationattribute\currentdestinationattribute}% - \let \strc_notes_set_reference_attribute_number\donothing - \let \strc_notes_set_style_color_display \strc_notes_set_style_color_display_yes} - -\expandafter\let\csname\??noteinteractiondisplay\v!number\expandafter\endcsname\csname\??noteinteractiondisplay\v!yes\endcsname + \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_nop} + +% \def\strc_references_prepare_display_references_yes_number +% {\let\strc_notes_set_reference_attribute_text\donothing +% \strc_references_get_simple_page_reference{symb:\currentnote:\currentnotenumber}% reference +% \edef\strc_notes_set_reference_attribute_number{\attribute\referenceattribute\currentreferenceattribute}% +% \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes} + +% \def\strc_references_prepare_display_references_yes_text +% {\strc_references_get_simple_page_reference{symb:\currentnote:\currentnotenumber}% reference +% \edef\strc_notes_set_reference_attribute_text{\attribute\referenceattribute\currentreferenceattribute}% +% \let\strc_notes_set_reference_attribute_number\donothing +% \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes} + +% \def\strc_references_prepare_display_references_yes_all +% {\strc_references_get_simple_page_reference{symb:\currentnote:\currentnotenumber}% reference +% \edef\strc_notes_set_reference_attribute_text{\attribute\referenceattribute\currentreferenceattribute}% +% \strc_references_get_simple_page_reference{symb:\currentnote:\currentnotenumber}% reference +% \edef\strc_notes_set_reference_attribute_number{\attribute\referenceattribute\currentreferenceattribute}% +% \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes} + +\def\strc_references_prepare_display_references_yes_number + {\edef\currentnoteinternal{\clf_noteinternal{\currentnote}\currentnotenumber}% + \ifcase\currentnoteinternal\relax + \strc_references_prepare_display_references_nop + \else + \let\strc_notes_set_reference_attribute_text\donothing + \strc_references_get_simple_page_reference{*\currentnoteinternal}% reference + \edef\strc_notes_set_reference_attribute_number{\attribute\referenceattribute\currentreferenceattribute}% + \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes + \fi} + +\def\strc_references_prepare_display_references_yes_text + {\edef\currentnoteinternal{\clf_noteinternal{\currentnote}\currentnotenumber}% + \ifcase\currentnoteinternal\relax + \strc_references_prepare_display_references_nop + \else + \strc_references_get_simple_page_reference{*\currentnoteinternal}% reference + \edef\strc_notes_set_reference_attribute_text{\attribute\referenceattribute\currentreferenceattribute}% + \let\strc_notes_set_reference_attribute_number\donothing + \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes + \fi} + +\def\strc_references_prepare_display_references_yes_all + {\edef\currentnoteinternal{\clf_noteinternal{\currentnote}\currentnotenumber}% + \ifcase\currentnoteinternal\relax + \strc_references_prepare_display_references_nop + \else + \strc_references_get_simple_page_reference{*\currentnoteinternal}% reference + \edef\strc_notes_set_reference_attribute_text{\attribute\referenceattribute\currentreferenceattribute}% + \strc_references_get_simple_page_reference{*\currentnoteinternal}% reference + \edef\strc_notes_set_reference_attribute_number{\attribute\referenceattribute\currentreferenceattribute}% + \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes + \fi} + +\letvalue{\??noteinteractiondisplay\v!no }\strc_references_prepare_display_references_nop +\letvalue{\??noteinteractiondisplay\v!all }\strc_references_prepare_display_references_yes_all +\letvalue{\??noteinteractiondisplay\v!number}\strc_references_prepare_display_references_yes_number +\letvalue{\??noteinteractiondisplay\v!text }\strc_references_prepare_display_references_yes_text +\letvalue{\??noteinteractiondisplay\v!yes }\strc_references_prepare_display_references_yes_number \let\strc_notes_set_style_color_inline_nop \usenotestyleandcolor \let\strc_notes_set_style_color_display_nop\usenotationstyleandcolor @@ -603,26 +656,32 @@ \noteparameter\c!symbolcommand{\symbol[\v!note:\v!previouspage]}% \fi} -\unexpanded\def\strc_notes_register_note_page % called more often than needed - {\iftrialtypesetting \else - \normalexpanded{\noexpand\ctxlatecommand{setnotesymbolpage("\currentnote",\currentnotenumber)}}% - \fi} - \unexpanded\def\strc_notes_inject_symbol_yes {\strc_notes_inject_symbol_indeed\conditionaltrue} \unexpanded\def\strc_notes_inject_symbol_nop {\strc_notes_inject_symbol_indeed\conditionalfalse} -% % this flushes the data to the list -% -% \unexpanded\def\strc_notes_inject_symbol_snc -% {\currentconstructionsynchronize} +\definemargindata + [strc_notes_destination_margin] + [\v!left] + [\c!margin=\zeropoint, + \c!width=\zeropoint, + \c!style=, + \c!color=] + +% \unexpanded\def\strc_notes_destination_hack +% {\ifx\strc_notes_get_destination_attribute_symbol\empty\else +% \strc_notes_destination_hack_indeed +% \fi} % -% but instead we need to do this with the content - -\unexpanded\def\strc_notes_inject_symbol_snc % so this will go away probably - {} +% \unexpanded\def\strc_notes_destination_hack_indeed % can be a helper +% {\strc_notes_destination_margin +% {\setbox\scratchbox\hpack \strc_notes_get_destination_attribute_symbol{}% +% \wd\scratchbox\makeupwidth +% \ht\scratchbox\strutht +% \dp\scratchbox\strutdp +% \hpack to \zeropoint{\box\scratchbox\hss}}} \unexpanded\def\strc_notes_inject_symbol_indeed#synchronize% {\removeunwantedspaces @@ -633,22 +692,19 @@ \fi \nobreak \begingroup - \ifconditional#synchronize\relax - \strc_notes_inject_symbol_snc % this flushes the data to the list - \fi - \strc_notes_register_note_page % this registers the symbol page number (late) \strc_notes_interaction_check_inline \strc_notes_set_style_color_inline\c!textstyle\c!textcolor - \hbox \strc_notes_get_reference_attribute_symbol \bgroup - \dostarttagged\t!descriptionsymbol\currentnote - \dotagsetnotesymbol - \noteparameter\c!textcommand{\clf_noteprefixednumber{\currentnote}\currentnotenumber\relax}% - % the next one can cycle so we need to make sure it has no advance width - \doif{\noteparameter\c!indicator}\v!yes\strc_notes_inject_pointer - \dostoptagged + \hbox \strc_notes_get_reference_attribute_symbol \strc_notes_get_destination_attribute_symbol \bgroup + % \hbox \strc_notes_get_reference_attribute_symbol \bgroup \strc_notes_destination_hack + \strc_references_flush_destination_nodes % a bit late but ok + \dostarttagged\t!descriptionsymbol\currentnote + \dotagsetnotesymbol + \noteparameter\c!textcommand{\clf_noteprefixednumber{\currentnote}\currentnotenumber\relax}% + % the next one can cycle so we need to make sure it has no advance width + \doif{\noteparameter\c!indicator}\v!yes\strc_notes_inject_pointer + \dostoptagged \egroup \endgroup -% \dostoptagged % check \globallet\lastnotesymbol\relax} \unexpanded\def\strc_notes_inject_dummy % temp hack @@ -1207,7 +1263,7 @@ \reinstateconstructionnumberentry\currentconstructionlistentry % we could store the number in the entry (e.g. needed when local notes in table) % \dontcomplain -% \begingroup + %begingroup \strc_notes_interaction_check_display \strc_notes_set_reference_attribute_text \strc_constructions_stored_start @@ -1217,7 +1273,7 @@ \strc_notes_inject_text\relax \ifvmode\obeydepth\else\endstrut\fi % \obeydepth is new per 2015-01-10 \strc_constructions_stored_stop -% \endgroup + %endgroup } \unexpanded\def\strc_notes_inject_text % hm main? diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua index 358b97744..a937a345b 100644 --- a/tex/context/base/mkiv/strc-ref.lua +++ b/tex/context/base/mkiv/strc-ref.lua @@ -507,7 +507,6 @@ local function register_from_lists(collected,derived,pages,sections) end end end - -- inspect(derived) end references.registerinitializer(function() register_from_lists(lists.collected,derived) end) @@ -1253,7 +1252,6 @@ function references.loadpresets(product,component) -- we can consider a special loadproductvariables (product,component,utilitydata) loadproductreferences(product,component,utilitydata) loadproductcomponents(product,component,utilitydata) - -- inspect(productdata) end end end @@ -1937,7 +1935,7 @@ local function setinternalreference(specification) -- ugly .. later we decide to ignore it when we have a real one -- but for testing we might want to see them all - if internal and innermethod ~= v_name then + if internal and innermethod ~= v_name then -- we dont' want too many #1 #2 #3 etc tn = tn + 1 t[tn] = internal -- when number it's internal diff --git a/tex/context/base/mkiv/strc-ref.mkvi b/tex/context/base/mkiv/strc-ref.mkvi index c9f627712..0bf6623a0 100644 --- a/tex/context/base/mkiv/strc-ref.mkvi +++ b/tex/context/base/mkiv/strc-ref.mkvi @@ -222,7 +222,9 @@ internal \nextinternalreference % block {\currentsectionblock}% view {\interactionparameter\c!focus}% + \ifx\referenceprefix\empty\else prefix {\referenceprefix}% + \fi reference {\currentreferencelabels}% }% metadata {% @@ -282,7 +284,9 @@ internal \nextinternalreference % block {\currentsectionblock}% view {\interactionparameter\c!focus}% + \ifx\referenceprefix\empty\else prefix {\referenceprefix}% + \fi reference {\currentreferencelabels}% }% metadata {% @@ -309,7 +313,9 @@ internal \nextinternalreference % block {\currentsectionblock}% view {\interactionparameter\c!focus}% + \ifx\referenceprefix\empty\else prefix {\referenceprefix}% + \fi reference {#labels}% }% metadata {% @@ -386,13 +392,40 @@ \def\strc_references_set_simple_page_reference#label% {\iflocation \strc_references_start_destination_nodes + \setnextinternalreference \clf_setreferenceattribute {% references {% % block {\currentsectionblock}% view {\interactionparameter\c!focus}% + \ifx\referenceprefix\empty\else prefix {\referenceprefix}% + \fi + reference {#label}% + internal \nextinternalreference + }% + metadata {% + kind {\s!page}% + }% + }% + \relax + \strc_references_stop_destination_nodes + \xdef\currentdestinationattribute{\number\lastdestinationattribute}% + \else + \setbox\b_strc_destination_nodes\emptyhbox + \xdef\currentdestinationattribute{\number\attributeunsetvalue}% + \fi} + +\def\strc_references_set_simple_internal_reference#label% no prefix + {\iflocation + \strc_references_start_destination_nodes + \setnextinternalreference + \clf_setreferenceattribute + {% + references {% + view {\interactionparameter\c!focus}% reference {#label}% + internal \nextinternalreference }% metadata {% kind {\s!page}% @@ -422,6 +455,21 @@ \xdef\currentreferenceattribute{\number\attributeunsetvalue}% \fi} +\def\strc_references_get_simple_internal_reference#internal% + {\iflocation + \clf_injectinternalreference + #internal + {% + height \ht\strutbox + depth \dp\strutbox + \extrareferencearguments + }% + \relax + \xdef\currentreferenceattribute{\number\lastreferenceattribute}% + \else + \xdef\currentreferenceattribute{\number\attributeunsetvalue}% + \fi} + %D \macros %D {contentreference} %D diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 51d289527..3dec0ec46 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/25/16 14:00:07 +-- merge date : 02/26/16 16:09:21 do -- begin closure to overcome local limits and interference -- cgit v1.2.3