diff options
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4110 -> 4105 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/lpdf-ini.lua | 5 | ||||
-rw-r--r-- | tex/context/base/spac-ali.mkiv | 18 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24553 -> 24575 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 225210 -> 225373 bytes | |||
-rw-r--r-- | tex/context/base/strc-bkm.lua | 77 | ||||
-rw-r--r-- | tex/context/base/strc-doc.lua | 27 | ||||
-rw-r--r-- | tex/context/base/strc-lst.lua | 17 | ||||
-rw-r--r-- | tex/context/base/strc-sbe.mkiv | 19 | ||||
-rw-r--r-- | tex/context/base/strc-sec.mkiv | 36 | ||||
-rw-r--r-- | tex/context/base/supp-box.mkiv | 13 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
14 files changed, 185 insertions, 33 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 0451545c2..a8702a739 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{2013.11.04 15:51} +\newcontextversion{2013.11.04 20:03} %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 Binary files differindex 7c50913e6..d5982f45d 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 479522660..03b13e4c6 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.11.04 15:51} +\edef\contextversion{2013.11.04 20:03} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index cd601f21f..23fe6c177 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['lpdf-ini'] = { local setmetatable, getmetatable, type, next, tostring, tonumber, rawset = setmetatable, getmetatable, type, next, tostring, tonumber, rawset local char, byte, format, gsub, concat, match, sub, gmatch = string.char, string.byte, string.format, string.gsub, table.concat, string.match, string.sub, string.gmatch local utfchar, utfvalues = utf.char, utf.values -local sind, cosd = math.sind, math.cosd +local sind, cosd, floor = math.sind, math.cosd, math.floor local lpegmatch, P, C, R, S, Cc, Cs = lpeg.match, lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc, lpeg.Cs local formatters = string.formatters @@ -49,7 +49,8 @@ local function tosixteen(str) -- an lpeg might be faster (no table) if b < 0x10000 then r[n] = format("%04x",b) else - r[n] = format("%04x%04x",b/1024+0xD800,b%1024+0xDC00) + -- r[n] = format("%04x%04x",b/1024+0xD800,b%1024+0xDC00) + r[n] = format("%04x%04x",floor(b/1024),b%1024+0xDC00) end end n = n + 1 diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index a7ce5b971..6f1ba7f4a 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -984,6 +984,24 @@ % % \wordright[\rightskip]{whatever} +% Trick posted by WS on mailing list, generalized a bit. The bottom text only shows +% op when there is one line space available. We could add some extra space if needed. + +% \unexpanded\def\bottomword +% {\par +% \dowithnextbox +% {\leaders\box\nextbox\vfil\page} +% \vbox to \lineheight} +% +% \unexpanded\def\bottomword +% {\par +% \groupedcommand +% {\leaders +% \vbox to \lineheight\bgroup} +% {\egroup +% \vfil +% \page}} + % \simplealignedbox{2cm}{right}{x} \installcorenamespace{alignsimple} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex aad647724..c8527223a 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex ce12b5bc1..7d6b5e895 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-bkm.lua b/tex/context/base/strc-bkm.lua index 13508e820..6cf325363 100644 --- a/tex/context/base/strc-bkm.lua +++ b/tex/context/base/strc-bkm.lua @@ -101,11 +101,64 @@ function bookmarks.setup(spec) end end +-- function bookmarks.place() +-- if next(names) then +-- local list = lists.filtercollected(names,"all",nil,lists.collected,forced) +-- if #list > 0 then +-- local levels, noflevels, lastlevel = { }, 0, 1 +-- for i=1,#list do +-- local li = list[i] +-- local metadata = li.metadata +-- local name = metadata.name +-- if not metadata.nolist or forced[name] then -- and levelmap[name] then +-- local titledata = li.titledata +-- if titledata then +-- local structural = levelmap[name] +-- lastlevel = structural or lastlevel +-- local title = titledata.bookmark +-- if not title or title == "" then +-- -- We could typeset the title and then convert it. +-- if not structural then +-- -- placeholder, todo: bookmarklabel +-- title = name .. ": " .. (titledata.title or "?") +-- else +-- title = titledata.title or "?" +-- end +-- end +-- if numbered[name] then +-- local sectiondata = sections.collected[li.references.section] +-- local numberdata = li.numberdata +-- if sectiondata and numberdata and not numberdata.hidenumber then +-- -- we could typeset the number and convert it +-- title = concat(sections.typesetnumber(sectiondata,"direct",numberspec,sectiondata)) .. " " .. title +-- end +-- end +-- noflevels = noflevels + 1 +-- levels[noflevels] = { +-- lastlevel, +-- stripped(title), -- can be replaced by converter +-- li.references, -- has internal and realpage +-- allopen or opened[name] +-- } +-- end +-- end +-- end +-- bookmarks.finalize(levels) +-- end +-- function bookmarks.place() end -- prevent second run +-- end +-- end + function bookmarks.place() if next(names) then - local list = lists.filtercollected(names,"all",nil,lists.collected,forced) - if #list > 0 then - local levels, noflevels, lastlevel = { }, 0, 1 + local levels = { } + local noflevels = 0 + local lastlevel = 1 + local nofblocks = #lists.sectionblocks -- always >= 1 + for i=1,nofblocks do + local block = lists.sectionblocks[i] + local blockdone = nofblocks == 1 + local list = lists.filtercollected(names,block..":all",nil,lists.collected,forced) for i=1,#list do local li = list[i] local metadata = li.metadata @@ -113,8 +166,24 @@ function bookmarks.place() if not metadata.nolist or forced[name] then -- and levelmap[name] then local titledata = li.titledata if titledata then + if not blockdone then + -- add block entry + local blockdata = sections.sectionblockdata[block] + noflevels = noflevels + 1 + levels[noflevels] = { + 1, -- toplevel + stripped(blockdata.bookmark ~= "" and blockdata.bookmark or block), + li.references, + allopen or opened[name] -- same as first entry + } + blockdone = true + end local structural = levelmap[name] lastlevel = structural or lastlevel + if nofblocks > 1 then + -- we have a block so increase the level + lastlevel = lastlevel + 1 + end local title = titledata.bookmark if not title or title == "" then -- We could typeset the title and then convert it. @@ -143,8 +212,8 @@ function bookmarks.place() end end end - bookmarks.finalize(levels) end + bookmarks.finalize(levels) function bookmarks.place() end -- prevent second run end end diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua index 5be5727f5..e3cbb02ed 100644 --- a/tex/context/base/strc-doc.lua +++ b/tex/context/base/strc-doc.lua @@ -171,15 +171,16 @@ end) -- -sections.levelmap = sections.levelmap or { } +sections.verbose = true -local levelmap = sections.levelmap +local sectionblockdata = sections.sectionblockdata or { } +sections.sectionblockdata = sectionblockdata -storage.register("structures/sections/levelmap", sections.levelmap, "structures.sections.levelmap") - -sections.verbose = true +local levelmap = sections.levelmap or { } +sections.levelmap = levelmap +levelmap.block = -1 -levelmap.block = -1 +storage.register("structures/sections/levelmap", sections.levelmap, "structures.sections.levelmap") function sections.setlevel(name,level) -- level can be number or parent (=string) local l = tonumber(level) @@ -197,17 +198,21 @@ function sections.getlevel(name) return levelmap[name] or 0 end -function sections.setblock(name) +table.setmetatableindex(sectionblockdata,"table") + +function sections.setblock(name,settings) local block = name or data.block or "unknown" -- can be used to set the default data.block = block + sectionblockdata[block] = settings return block end -function sections.pushblock(name) +function sections.pushblock(name,settings) counters.check(0) -- we assume sane usage of \page between blocks local block = name or data.block data.blocks[#data.blocks+1] = block data.block = block + sectionblockdata[block] = settings documents.reset() return block end @@ -954,9 +959,9 @@ commands.namedstructureuservariable = function(depth,name) sections.userdata -- -function commands.setsectionblock (name) context(sections.setblock(name)) end -function commands.pushsectionblock(name) context(sections.pushblock(name)) end -function commands.popsectionblock () context(sections.popblock()) end +commands.setsectionblock = sections.setblock +commands.pushsectionblock = sections.pushblock +commands.popsectionblock = sections.popblock -- diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index f6a355707..d86368b6a 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -54,6 +54,9 @@ lists.ordered = allocate(lists.ordered or { }) -- to be checked lists.cached = cached lists.pushed = pushed +local sectionblocks = allocate() +lists.sectionblocks = sectionblocks + references.specials = references.specials or { } local variables = interfaces.variables @@ -85,15 +88,23 @@ local function initializer() local collected = lists.collected local internals = checked(references.internals) local ordered = lists.ordered + local blockdone = { } for i=1,#collected do local c = collected[i] local m = c.metadata local r = c.references if m then -- access by internal reference - local internal = r and r.internal - if internal then - internals[internal] = c + if r then + local internal = r.internal + if internal then + internals[internal] = c + end + local block = r.block + if block and not blockdone[block] then + blockdone[block] = true + sectionblocks[#sectionblocks+1] = block + end end -- access by order in list local kind, name = m.kind, m.name diff --git a/tex/context/base/strc-sbe.mkiv b/tex/context/base/strc-sbe.mkiv index 4ea08b30c..fc48307ec 100644 --- a/tex/context/base/strc-sbe.mkiv +++ b/tex/context/base/strc-sbe.mkiv @@ -76,17 +76,24 @@ \to \everyaftersectionblock \unexpanded\def\setsectionblock - {\dosingleargument\strc_sectionblock_set} + {\dodoubleempty\strc_sectionblock_set} -\def\strc_sectionblock_set[#1]% used to set the default - {\edef\currentsectionblock{\ctxcommand{setsectionblock("#1")}}} +\def\strc_sectionblock_set[#1][#2]% used to set the default + {\edef\currentsectionblock{#1}% from now on we assume a value + \setupcurrentsectionblock[#2]% + \ctxcommand{setsectionblock("#1", { bookmark = "\sectionblockparameter\c!bookmark" })}} \let\currentsectionblock\empty % was \s!unknown -\unexpanded\def\startsectionblock[#1]% +\unexpanded\def\startsectionblock + {\dodoubleempty\strc_sectionblock_start} + +\unexpanded\def\strc_sectionblock_start[#1][#2]% {%\ctxlua{structures.counters.check(0)}% we assume sane usage of \page, as this is the only workable place (in push) \begingroup - \edef\currentsectionblock{\ctxcommand{pushsectionblock("#1")}}% + \edef\currentsectionblock{#1}% from now on we assume a value + \setupcurrentsectionblock[#2]% + \ctxcommand{pushsectionblock("#1", { bookmark = "\sectionblockparameter\c!bookmark" })}% \csname #1true\endcsname % obsolete \setsystemmode\currentsectionblock \the\everybeforesectionblock\relax @@ -95,7 +102,7 @@ \unexpanded\def\stopsectionblock {\showmessage\m!structures2\currentsectionblock \the\everyaftersectionblock\relax - \edef\currentsectionblock{\ctxcommand{popsectionblock()}}% + \ctxcommand{popsectionblock()}% \endgroup} %D \starttyping diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index 2836b018b..2962e2c49 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -88,6 +88,24 @@ \def\namedstructureheadlocation#1% expandable, maybe [#1] {\csname\??savedinternalreference\ifcsname\??savedinternalreference#1\endcsname#1\else\s!default\fi\endcsname} +% The next directive only makes sense when we have sort of garanteed outcome (math is not so +% nice for instance). +% +% \enabledirectives[references.bookmarks.preroll] + +\newconditional\c_strc_bookmarks_preroll + +\installtexdirective + {references.bookmarks.preroll} + {\settrue \c_strc_bookmarks_preroll} + {\setfalse\c_strc_bookmarks_preroll} + +\def\strc_sectioning_autobookmark#1% + {\nodestostring\tempstring{#1}% + \globallet\currentstructurebookmark\tempstring} + +% so it's an experiment + \unexpanded\def\strc_sectioning_register#1#2#3% #1=interfaced-settings, #2=optional user data (not yet supported) {\begingroup \setupstructure[\c!name={#1},#2]% @@ -112,6 +130,9 @@ \xdef\currentstructuremarking {\structureparameter\c!marking}% \xdef\currentstructurelist {\structureparameter\c!list}% \xmlstopraw +\iflocation \ifx\currentstructurebookmark\empty \ifconditional\c_strc_bookmarks_preroll + \strc_sectioning_autobookmark\currentstructuretitle +\fi \fi \fi \ifx\currentstructurelist\empty \globallet\currentstructurelist\currentstructuretitle \fi @@ -122,16 +143,23 @@ \xdef\currentstructurebookmark{\structureparameter\c!bookmark}% \xdef\currentstructuremarking {\structureparameter\c!marking}% \xdef\currentstructurelist {\structureparameter\c!list}% +\iflocation \ifx\currentstructurebookmark\empty \ifconditional\c_strc_bookmarks_preroll + \strc_sectioning_autobookmark\currentstructuretitle +\fi \fi \fi \else \xdef\currentstructuretitle {\detokenizedstructureparameter\c!title}% \xdef\currentstructurebookmark{\detokenizedstructureparameter\c!bookmark}% \xdef\currentstructuremarking {\detokenizedstructureparameter\c!marking}% \xdef\currentstructurelist {\detokenizedstructureparameter\c!list}% \iflocation \ifx\currentstructurebookmark\empty - \begingroup - \simplifycommands - \xdef\currentstructurebookmark{\detokenize\expandafter{\normalexpanded{\structureparameter\c!title}}}% - \endgroup +\ifconditional\c_strc_bookmarks_preroll + \strc_sectioning_autobookmark{\structureparameter\c!title}% +\else + \begingroup + \simplifycommands + \xdef\currentstructurebookmark{\detokenize\expandafter{\normalexpanded{\structureparameter\c!title}}}% + \endgroup +\fi \fi \fi \fi \ifx\currentstructurelist\empty diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv index ad35b525b..467fff72b 100644 --- a/tex/context/base/supp-box.mkiv +++ b/tex/context/base/supp-box.mkiv @@ -2712,6 +2712,19 @@ \egroup} \hbox} +%D A bit dirty: + +% \unexpanded\def\nodestostring#1% \cs {content} +% {\dowithnextbox{\edef#1{\syst_boxes_nodestostring}}\hbox} +% +% \def\syst_boxes_nodestostring +% {\ctxcommand{boxtostring(\number\nextbox)}} + +\unexpanded\def\nodestostring#1#2% more tolerant for #2=\cs + {\begingroup + \setbox\nextbox\hbox{#2}% + \normalexpanded{\endgroup\edef\noexpand#1{\ctxcommand{boxtostring(\number\nextbox)}}}} + \protect \endinput % a bit of test code: diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a3407f015..6a5873dd9 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 : 11/04/13 15:51:09 +-- merge date : 11/04/13 20:03:17 do -- begin closure to overcome local limits and interference |