diff options
author | Hans Hagen <pragma@wxs.nl> | 2014-08-29 20:57:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2014-08-29 20:57:00 +0200 |
commit | 54b35840ce8f91454174a2d63042d776222a378b (patch) | |
tree | 056763d0a6f291516ac8f7b572a3e234a9b2fde0 | |
parent | 2c6477867c9a9e84a1e48134f062ef7706de1499 (diff) | |
download | context-54b35840ce8f91454174a2d63042d776222a378b.tar.gz |
beta 2014.08.29 20:57
-rw-r--r-- | tex/context/base/back-exp.lua | 93 | ||||
-rw-r--r-- | tex/context/base/back-exp.mkiv | 24 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4436 -> 4433 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/core-env.mkiv | 61 | ||||
-rw-r--r-- | tex/context/base/spac-par.mkiv | 3 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 25001 -> 24983 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 327109 -> 327145 bytes | |||
-rw-r--r-- | tex/context/base/strc-flt.mkvi | 11 | ||||
-rw-r--r-- | tex/context/base/strc-lst.lua | 4 | ||||
-rw-r--r-- | tex/context/base/strc-lst.mkvi | 3 | ||||
-rw-r--r-- | tex/context/base/strc-reg.lua | 5 | ||||
-rw-r--r-- | tex/context/base/strc-reg.mkiv | 9 | ||||
-rw-r--r-- | tex/context/base/strc-tag.lua | 1 | ||||
-rw-r--r-- | tex/context/base/strc-tag.mkiv | 28 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
17 files changed, 200 insertions, 48 deletions
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index b528f5a14..647a9a049 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -292,7 +292,7 @@ end -- local tagsplitter = C(precolon) * colon * C(predash) * dash * C(rest) + -- C(predash) * dash * Cc(nil) * C(rest) -local listdata = { } +local listdata = { } -- maybe do this otherwise function wrapups.hashlistdata() local c = structures.lists.collected @@ -487,6 +487,27 @@ local function makebreaknode(attributes) -- maybe no fulltag } end +local function ignorebreaks(result,element,detail,n,fulltag,di) + local data = di.data + for i=1,#data do + local d = data[i] + if d.content == " " then + d.content = "" + end + end +end + +local function ignorespaces(result,element,detail,n,fulltag,di) + local data = di.data + for i=1,#data do + local d = data[i] + local c = d.content + if type(c) == "string" then + d.content = lpegmatch(p_stripper,c) + end + end +end + do local fields = { "title", "subtitle", "author", "keywords" } @@ -606,30 +627,6 @@ do end -local function ignorebreaks(result,element,detail,n,fulltag,di) - local data = di.data - for i=1,#data do - local d = data[i] - if d.content == " " then - d.content = "" - end - end -end - -local function ignorespaces(result,element,detail,n,fulltag,di) - local data = di.data - for i=1,#data do - local d = data[i] - local c = d.content - if type(c) == "string" then - d.content = lpegmatch(p_stripper,c) - end - end -end - -extras.registerpages = ignorebreaks -extras.registerseparator = ignorespaces - do local highlight = { } @@ -653,7 +650,8 @@ do local f_insert = formatters[' insert="%s"'] function structurestags.setdescription(tag,n) - local nd = structures.notes.get(tag,n) -- todo: use listdata instead + -- we can also use the internals hash or list + local nd = structures.notes.get(tag,n) if nd then local references = nd.references descriptions[references and references.internal] = detailedtag("description",tag) @@ -1302,6 +1300,47 @@ do end end + -- todo: internal is already hashed + + function structurestags.setlist(tag,n) + local data = structures.lists.getresult(n) + if data then + referencehash[detailedtag("listitem",tag)] = data + end + end + + function extras.listitem(result,element,detail,n,fulltag,di) + local data = referencehash[fulltag] + if data then + extras.addreference(result,data.references) + return true + end + end + +end + +do + + -- todo: internal is already hashed + + function structurestags.setregister(tag,n) + local data = structures.registers.get(tag,n) + if data then + referencehash[detailedtag("registerlocation",tag)] = data + end + end + + function extras.registerlocation(result,element,detail,n,fulltag,di) + local data = referencehash[fulltag] + if data then + extras.addreference(result,data.references) + return true + end + end + + extras.registerpages = ignorebreaks + extras.registerseparator = ignorespaces + end do @@ -2862,3 +2901,5 @@ commands.settagfigure = structurestags.setfigure commands.settagcombination = structurestags.setcombination commands.settagtablecell = structurestags.settablecell commands.settagtabulatecell = structurestags.settabulatecell +commands.settagregister = structurestags.setregister +commands.settaglist = structurestags.setlist diff --git a/tex/context/base/back-exp.mkiv b/tex/context/base/back-exp.mkiv index d1cd42f15..a7f8e0040 100644 --- a/tex/context/base/back-exp.mkiv +++ b/tex/context/base/back-exp.mkiv @@ -53,12 +53,25 @@ \newcount\tagparcounter \let\dotagsetparcounter\relax +\let\doresetparcounter \relax \appendtoks + \doresetparcounter +\to \everyflushatnextpar + +% \appendtoks +% \dotagsetparcounter +% \to \everypar + +\prependtoks \dotagsetparcounter \to \everypar -\appendtoks +% \appendtoks +% \dotagsetparcounter +% \to \neverypar + +\prependtoks \dotagsetparcounter \to \neverypar @@ -99,6 +112,7 @@ \appendtoks \unexpanded\def\dotagsetparcounter{\global\advance\tagparcounter\plusone\attribute\taggedparattribute\tagparcounter}% + \unexpanded\def\doresetparcounter {\attribute\taggedparattribute\attributeunsetvalue}% \to \everyenableelements \appendtoks @@ -114,6 +128,14 @@ \to \everyenableelements \appendtoks + \unexpanded\def\dotagregisterlocation{\taggedctxcommand{settagregister("\currentregister",\currentregisternumber)}}% +\to \everyenableelements + +\appendtoks + \unexpanded\def\dotaglistlocation{\taggedctxcommand{settaglist("\currentlist",\currentlistindex)}}% +\to \everyenableelements + +\appendtoks \let\specialfixedspace \explicitfixedspace \let\specialobeyedspace \explicitobeyedspace \let\specialstretchedspace\explicitstretchedspace diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index c14360141..dd04289e9 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{2014.08.28 20:19} +\newcontextversion{2014.08.29 20:57} %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 dd4b097ae..54792ec8f 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 fa218f7e5..8ff3a4b55 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.08.28 20:19} +\edef\contextversion{2014.08.29 20:57} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv index 01d127d2f..47f29ed73 100644 --- a/tex/context/base/core-env.mkiv +++ b/tex/context/base/core-env.mkiv @@ -173,6 +173,27 @@ \newconditional\c_checked_mode +% one + +% \def\syst_modes_check_indeed#1% +% {\ifcsname\??mode#1\endcsname +% \ifcase\csname\??mode#1\endcsname\else +% \let\syst_modes_check_step\gobbleoneargument +% \fi +% \fi} +% +% \def\syst_modes_check#1#2#3% +% {\let\syst_modes_check_step\syst_modes_check_indeed +% \rawprocesscommacommand[#3]\syst_modes_check_step +% \ifx\syst_modes_check_step\gobbleoneargument +% \expandafter#1% +% \else +% \expandafter#2% +% \fi} + +% modes .. twice as fast on defined modes .. we could use definers and make it even faster +% if needed + \def\syst_modes_check_indeed#1% {\ifcsname\??mode#1\endcsname \ifcase\csname\??mode#1\endcsname\else @@ -180,7 +201,7 @@ \fi \fi} -\def\syst_modes_check#1#2#3% +\def\syst_modes_check_nop#1#2#3% {\let\syst_modes_check_step\syst_modes_check_indeed \rawprocesscommacommand[#3]\syst_modes_check_step \ifx\syst_modes_check_step\gobbleoneargument @@ -189,6 +210,22 @@ \expandafter#2% \fi} +\def\syst_modes_check_yes#1#2#3% + {\ifcase\csname\??mode#3\endcsname + \expandafter#2% + \else + \expandafter#1% + \fi} + +\def\syst_modes_check#1#2#3% + {\ifcsname\??mode#3\endcsname + \expandafter\syst_modes_check_yes + \else + \expandafter\syst_modes_check_nop + \fi#1#2{#3}} + +% all + \def\syst_modes_check_all_indeed#1% {\ifcsname\??mode#1\endcsname \ifcase\csname\??mode#1\endcsname @@ -384,6 +421,28 @@ % % \def\syst_setups_normal#1% % {:\ifcsname\??setup:#1\endcsname#1\else\letterpercent\fi\endcsname\empty} % takes one argument +% +% only makes sense with many setups +% +% \def\syst_setups% the grid option will be extended to other main modes +% {\ifgridsnapping +% \expandafter\syst_setups_grid +% \else +% \expandafter\syst_setups_normal +% \fi} +% +% \def\syst_setups_normal#1% the grid option will be extended to other main modes +% {\csname\??setup +% :\ifcsname\??setup:#1\endcsname#1\else\letterpercent\fi +% \endcsname\empty} % takes one argument +% +% \def\syst_setups_grid#1% the grid option will be extended to other main modes +% {\csname\??setup +% \ifcsname\??setup\v!grid:#1\endcsname\v!grid:#1\else:\ifcsname\??setup:#1\endcsname#1\else\letterpercent\fi\fi +% \endcsname\empty} % takes one argument +% +% \let\directsetup\syst_setups +% \let\texsetup \syst_setups % nicer than \directsetup and more en par with xmlsetup and luasetup % We can consider: % diff --git a/tex/context/base/spac-par.mkiv b/tex/context/base/spac-par.mkiv index 825cdca46..4dd3db243 100644 --- a/tex/context/base/spac-par.mkiv +++ b/tex/context/base/spac-par.mkiv @@ -203,6 +203,8 @@ % \glet\flushpostponednodedata\spac_postponed_data_flush % \fi} +\newtoks\everyflushatnextpar + \unexpanded\def\pushpostponednodedata {\globalpushbox\b_spac_postponed_data} @@ -214,6 +216,7 @@ \unexpanded\def\flushatnextpar {\begingroup + \the\everyflushatnextpar \glet\flushpostponednodedata\spac_postponed_data_flush \dowithnextboxcs\spac_postponed_data_finish\hbox} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 056508a6f..97e928c35 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 394676a26..d12a331e7 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index a93921317..3f6822adb 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -1104,11 +1104,22 @@ \unexpanded\def\betweenfloatblanko % assumes that spaceafter is present {\blank[\rootfloatparameter\c!spacebefore]} % or v!back,.... +% \unexpanded\def\doplacefloatbox % used elsewhere +% {%\forgetall % NO +% \whitespace +% \blank[\rootfloatparameter\c!spacebefore] +% \page_otr_command_flush_float_box +% \blank[\rootfloatparameter\c!spaceafter]} + \unexpanded\def\doplacefloatbox % used elsewhere {%\forgetall % NO \whitespace \blank[\rootfloatparameter\c!spacebefore] + \nointerlineskip + \flushnotes % new per 2014-05-29 : todo: move them up in the mvl + \nointerlineskip \page_otr_command_flush_float_box + \nointerlineskip \blank[\rootfloatparameter\c!spaceafter]} % test case: diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 6a2c07249..570a8b126 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -550,6 +550,10 @@ end lists.result = { } +function lists.getresult(r) + return lists.result[r] +end + function lists.process(specification) lists.result = lists.filter(specification) local specials = utilities.parsers.settings_to_hash(specification.extras or "") diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index 0008f0602..b10ab696d 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -451,6 +451,8 @@ \def\usestructurelistprocessor#tag% {\csname\??structurelistprocessor#tag\endcsname} +\let\dotaglistlocation\relax + \unexpanded\def\strclistsentryprocess#tag#method#index#extra% This one is called at the lua end! {\ctxcommand{pushlist(#index)}% \edef\currentlist {#tag}% @@ -459,6 +461,7 @@ \edef\currentlistextra {#extra}% \listextraparameter\c!before \dostarttagged\t!listitem\currentlist + \dotaglistlocation \csname\??structurelistprocessor \ifcsname\??structurelistprocessor\currentlist:\currentlistmethod\endcsname\currentlist:\currentlistmethod\else \ifcsname\??structurelistprocessor\currentlistmethod \endcsname\currentlistmethod \else diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua index da4ba9b2d..03f4ae0be 100644 --- a/tex/context/base/strc-reg.lua +++ b/tex/context/base/strc-reg.lua @@ -570,6 +570,11 @@ registers.store = storeregister registers.enhance = enhanceregister registers.extend = extendregister +function registers.get(tag,n) + local list = tobesaved[tag] + return list and list.entries[n] +end + function commands.storeregister(rawdata) local nofentries = storeregister(rawdata) setinternalreference(nil,nil,rawdata.references.internal) diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index 6147e2c0d..9cb135fdf 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -302,9 +302,14 @@ \currentregistersynchronize % here? % needs thinking ... bla\index{bla}. will break before the . but adding a % penalty is also no solution + \dostarttagged\t!registerlocation\currentregister \attribute\destinationattribute\lastdestinationattribute \signalcharacter % no \strut as it will be removed during cleanup + \dotagregisterlocation + \dostoptagged \endgroup} +\let\dotagregisterlocation\relax % experiment + \unexpanded\def\strc_registers_insert_entry[#1][#2]% {\def\currentregister{#1}% \doifelse{\registerparameter\c!ownnumber}\v!yes @@ -482,6 +487,10 @@ }, } }}% + \dostarttagged\t!registerlocation\currentregister + \attribute\destinationattribute\lastdestinationattribute \signalcharacter % no \strut as it will be removed during cleanup + \dotagregisterlocation + \dostoptagged \endgroup} %D Rendering: diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index fdbce5b84..8835786bf 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -83,6 +83,7 @@ local properties = allocate { sorting = { pdf = "Span", nature = "inline" }, register = { pdf = "Div", nature = "display" }, + registerlocation = { pdf = "Span", nature = "inline" }, registersection = { pdf = "Div", nature = "display" }, registertag = { pdf = "Span", nature = "mixed" }, registerentries = { pdf = "Div", nature = "display" }, diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv index 9b3c2feb9..39dba8259 100644 --- a/tex/context/base/strc-tag.mkiv +++ b/tex/context/base/strc-tag.mkiv @@ -63,6 +63,7 @@ \def\t!synonym {synonym} % Span \def\t!register {register} % Div +\def\t!registerlocation {registerlocation} % Span \def\t!registersection {registersection} % Div \def\t!registertag {registertag} % Span \def\t!registerentries {registerentries} % Div @@ -327,7 +328,9 @@ {\dodoubleempty\paragraph_start} \def\paragraph_start - {\iffirstargument + {\endgraf % we end before the group + \begingroup + \iffirstargument \ifsecondargument \doubleexpandafter\paragraph_start_two \else @@ -338,41 +341,32 @@ \fi} \def\paragraph_start_two[#1][#2]% - {\endgraf % we end before the group - \begingroup - \let\stopparagraph\paragraph_stop_indeed - \edef\currentparagraph{#1}% + {\edef\currentparagraph{#1}% \setupcurrentparagraph[#2]% \paragraph_start_indeed} \def\paragraph_start_one[#1][#2]% - {\endgraf % we end before the group - \begingroup - \let\stopparagraph\paragraph_stop_indeed - \doifassignmentelse{#1} + {\doifassignmentelse{#1} {\let\currentparagraph\empty \setupcurrentparagraph[#1]} {\edef\currentparagraph{#1}}% \paragraph_start_indeed} +\def\paragraph_start_zero[#1][#2]% + {\let\currentparagraph\empty + \paragraph_start_indeed} + \def\paragraph_start_indeed {\useparagraphstyleandcolor\c!style\c!color \usealignparameter\paragraphparameter \usesetupsparameter\paragraphparameter \dostarttagged\t!paragraph\currentparagraph} -\def\paragraph_start_zero[#1][#2]% - {\let\currentparagraph\empty - \paragraph_start_indeed} - -\unexpanded\def\paragraph_stop_indeed +\unexpanded\def\stopparagraph {\dostoptagged \endgraf % we end inside the group \endgroup} -\unexpanded\def\stopparagraph - {\dostoptagged} - \let\startpar\startparagraph \let\stoppar \stopparagraph diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index be74c9c05..77aab3049 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 : 08/28/14 20:19:26 +-- merge date : 08/29/14 20:57:48 do -- begin closure to overcome local limits and interference |