diff options
author | Marius <mariausol@gmail.com> | 2013-12-02 16:40:20 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2013-12-02 16:40:20 +0200 |
commit | e1919e77f8fa775a3434f7bd7ee23100d6b4d527 (patch) | |
tree | 2e786197ec97cc94d004d367df054db9e16cc321 /tex | |
parent | dcde325d302ac7158a5e49d129cfff47c499f0e7 (diff) | |
download | context-e1919e77f8fa775a3434f7bd7ee23100d6b4d527.tar.gz |
beta 2013.12.02 15:22
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/attr-ini.mkiv | 33 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4133 -> 4109 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/lang-mis.mkiv | 33 | ||||
-rw-r--r-- | tex/context/base/node-met.lua | 24 | ||||
-rw-r--r-- | tex/context/base/page-lin.mkiv | 52 | ||||
-rw-r--r-- | tex/context/base/s-youless.mkiv | 10 | ||||
-rw-r--r-- | tex/context/base/spac-par.mkiv | 27 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24707 -> 24638 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 227349 -> 227441 bytes | |||
-rw-r--r-- | tex/context/base/strc-flt.mkvi | 7 | ||||
-rw-r--r-- | tex/context/base/strc-lnt.mkvi | 104 | ||||
-rw-r--r-- | tex/context/base/strc-not.mkvi | 13 | ||||
-rw-r--r-- | tex/context/base/supp-box.lua | 25 | ||||
-rw-r--r-- | tex/context/base/supp-box.mkiv | 148 | ||||
-rw-r--r-- | tex/context/base/util-you.lua | 41 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
18 files changed, 360 insertions, 163 deletions
diff --git a/tex/context/base/attr-ini.mkiv b/tex/context/base/attr-ini.mkiv index e82ab6467..9dfa7baae 100644 --- a/tex/context/base/attr-ini.mkiv +++ b/tex/context/base/attr-ini.mkiv @@ -85,24 +85,25 @@ %D For the moment we put this here (later it will move to where it's used): \definesystemattribute [state] -\definesystemattribute [color] [public] -\definesystemattribute [colormodel] [public,global] +\definesystemattribute [color] [public] +\definesystemattribute [colormodel] [public,global] \definesystemattribute [skip] \definesystemattribute [penalty] -\definesystemattribute [transparency] [public] -\definesystemattribute [background] [public] -\definesystemattribute [alignbackground] [public] -\definesystemattribute [colorintent] [public] -\definesystemattribute [negative] [public] -\definesystemattribute [effect] [public] -\definesystemattribute [viewerlayer] [public] -\definesystemattribute [layoutcomponent] [public] -\definesystemattribute [reference] [public] -\definesystemattribute [destination] [public] -\definesystemattribute [internal] [public] -\definesystemattribute [ruled] [public] -\definesystemattribute [shifted] [public] -\definesystemattribute [checkedbreak] [public] +\definesystemattribute [transparency] [public] +\definesystemattribute [background] [public] +\definesystemattribute [alignbackground] [public] +\definesystemattribute [colorintent] [public] +\definesystemattribute [negative] [public] +\definesystemattribute [effect] [public] +\definesystemattribute [viewerlayer] [public] +\definesystemattribute [layoutcomponent] [public] +\definesystemattribute [reference] [public] +\definesystemattribute [destination] [public] +\definesystemattribute [internal] [public] +\definesystemattribute [ruled] [public] +\definesystemattribute [shifted] [public] +\definesystemattribute [checkedbreak] [public] +\definesystemattribute [vboxtohboxseparator] [public] \unexpanded\def\showattributes{\ctxcommand{showattributes()}} diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 24760c4b6..529c04a22 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.28 19:36} +\newcontextversion{2013.12.02 15:22} %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 27f395740..4e667e642 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 2b9460211..12b88c4d0 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.28 19:36} +\edef\contextversion{2013.12.02 15:22} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/lang-mis.mkiv b/tex/context/base/lang-mis.mkiv index 4d8b8e08a..0c4bc3ac4 100644 --- a/tex/context/base/lang-mis.mkiv +++ b/tex/context/base/lang-mis.mkiv @@ -157,9 +157,9 @@ %D In the main \CONTEXT\ modules these can be tuned by a setup %D command. Watch the (maybe) better looking compound hyphen. -\ifx\compoundhyphen \undefined \def\compoundhyphen {\hbox{-\kern-.25ex-}} \fi -\ifx\beginofsubsentence\undefined \def\beginofsubsentence{\hbox{---}} \fi -\ifx\endofsubsentence \undefined \def\endofsubsentence {\hbox{---}} \fi +\ifx\compoundhyphen \undefined \unexpanded\def\compoundhyphen {\hbox{-\kern-.25ex-}} \fi +\ifx\beginofsubsentence\undefined \unexpanded\def\beginofsubsentence{\hbox{\emdash}} \fi +\ifx\endofsubsentence \undefined \unexpanded\def\endofsubsentence {\hbox{\emdash}} \fi %D The last two variables are needed for subsentences %D |<|like this one|>| which we did not yet mention. @@ -168,10 +168,11 @@ %D compound characters like |-| or || to be separated from the %D words. \TEX\ hackers will recognise the next two macro's: -\ifx\prewordbreak \undefined \def\prewordbreak {\penalty\plustenthousand\hskip\zeropoint\relax} \fi -%ifx\postwordbreak\undefined \def\postwordbreak {\penalty\zerocount \prewordbreak } \fi -\ifx\postwordbreak\undefined \def\postwordbreak {\penalty\zerocount \hskip\zeropoint\relax} \fi -\ifx\hspaceamount \undefined \def\hspaceamount#1#2{.16667em} \fi % language specific +\ifx\prewordbreak \undefined \unexpanded\def\prewordbreak {\penalty\plustenthousand\hskip\zeropoint\relax} \fi +\ifx\postwordbreak\undefined \unexpanded\def\postwordbreak {\penalty\zerocount \hskip\zeropoint\relax} \fi +\ifx\hspaceamount \undefined \def\hspaceamount#1#2{.16667\emwidth} \fi % language specific + +\unexpanded\def\permithyphenation{\ifhmode\prewordbreak\fi} % doesn't remove spaces %D \macros %D {beginofsubsentencespacing,endofsubsentencespacing} @@ -201,21 +202,21 @@ \installcorenamespace{discretionarymath} \installcorenamespace{discretionaryboth} -\def\installdiscretionary#1#2% +\unexpanded\def\installdiscretionary#1#2% {\setevalue{\??discretionarymath\detokenize{#1}}{\detokenize{#1}}% ? \setvalue {\??discretionarytext\detokenize{#1}}{#2}% \setvalue {\??discretionaryboth\detokenize{#1}}{\lang_discretionaries_command#1}% \scratchcounter\expandafter`\detokenize{#1}% \expandafter\uedcatcodecommand\expandafter\ctxcatcodes\expandafter\scratchcounter\csname\??discretionaryboth\detokenize{#1}\endcsname} -\def\handlemathmodediscretionary#1{\executeifdefined{\??discretionarymath\detokenize{#1}}\donothing} -\def\handletextmodediscretionary#1{\executeifdefined{\??discretionarytext\detokenize{#1}}\donothing} +\unexpanded\def\handlemathmodediscretionary#1{\executeifdefined{\??discretionarymath\detokenize{#1}}\donothing} +\unexpanded\def\handletextmodediscretionary#1{\executeifdefined{\??discretionarytext\detokenize{#1}}\donothing} -\def\installdiscretionaries#1#2{\writestatus\m!system{use \string \installdiscretionary}} % obsolete +\unexpanded\def\installdiscretionaries#1#2{\writestatus\m!system{use \string \installdiscretionary}} % obsolete \setnewconstant\discretionarymode\plusone -\def\ignorediscretionaries +\unexpanded\def\ignorediscretionaries {\discretionarymode\zerocount} \def\lang_discretionaries_command @@ -277,7 +278,7 @@ \futurelet\nextnext\next}% \next} -\def\activedododotextmodediscretionary#1#2% +\unexpanded\def\activedododotextmodediscretionary#1#2% {\edef\discretionarytoken{\detokenize{#2}}% \def\textmodediscretionary{\handletextmodediscretionary{#1}}% \lang_discretionaries_check_after @@ -329,7 +330,7 @@ %D In those situations where the nature of characters is %D less predictable, we can use the more direct approach: -\def\directdiscretionary +\unexpanded\def\directdiscretionary {\csname \ifcase\discretionarymode \strippedcsname\lang_discretionaries_process_none @@ -338,7 +339,7 @@ \fi \endcsname} -\def\indirectdiscretionary +\unexpanded\def\indirectdiscretionary {\csname \ifcase\discretionarymode \strippedcsname\lang_discretionaries_process_none @@ -352,7 +353,7 @@ \let\textmodediscretionary\compoundhyphen \executeifdefined{\??discretionaryaction\discretionarytoken}{\indirectdiscretionary{#1}}} -\unexpanded\def\lang_discretionaries_process_indirect#1% +\unexpanded\unexpanded\def\lang_discretionaries_process_indirect#1% {\prewordbreak\discretionary{\hbox{#1}}{}{\hbox{#1}}\allowbreak\postwordbreak} \unexpanded\def\definetextmodediscretionary #1 diff --git a/tex/context/base/node-met.lua b/tex/context/base/node-met.lua index 7d10ce9f8..c85a53c8e 100644 --- a/tex/context/base/node-met.lua +++ b/tex/context/base/node-met.lua @@ -185,18 +185,18 @@ local n_remove_node = node.remove -- not yet nodes.remove -- end local function remove(head,current,free_too) - local t = current - head, current = n_remove_node(head,current) - if t then - if free_too then - n_free_node(t) - t = nil - else - n_setfield(t,"next",nil) - n_setfield(t,"prev",nil) - end - end - return head, current, t + local t = current + head, current = n_remove_node(head,current) + if not t then + -- forget about it + elseif free_too then + n_free_node(t) + t = nil + else + n_setfield(t,"next",nil) + n_setfield(t,"prev",nil) + end + return head, current, t end nodes.remove = remove diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv index 876d2e781..ae293091c 100644 --- a/tex/context/base/page-lin.mkiv +++ b/tex/context/base/page-lin.mkiv @@ -50,7 +50,12 @@ \newcount \c_page_lines_reference \newconstant\c_page_lines_nesting -\newconditional\tracelinenumbering +\newconditional\tracelinenumbering % we keep this for old times sake + +\installtextracker + {lines.numbers.show} + {\settrue \tracelinenumbering} + {\setfalse\tracelinenumbering} % id nr shift width leftskip dir @@ -100,8 +105,8 @@ \normalexpanded{\strc_references_set_named_reference{line}{#2}{conversion=\linenumberingparameter\c!conversion}{\the\c_page_lines_reference}}% kind labels userdata text \endgroup} -\def\page_lines_reference_start#1{\page_lines_some_reference{#1}{lr:b:#1}{}\ignorespaces} -\def\page_lines_reference_stop #1{\removeunwantedspaces\page_lines_some_reference{#1}{lr:e:#1}{}} +% \def\page_lines_reference_start#1{\page_lines_some_reference{#1}{lr:b:#1}{}} % reimplemented later +% \def\page_lines_reference_stop #1{\page_lines_some_reference{#1}{lr:e:#1}{}} % reimplemented later % \def\mklinestartreference#1[#2]{\in{#1}[lr:b:#2]} % not interfaced/ not used % \def\mklinestopreference #1[#2]{\in{#1}[lr:e:#2]} % not interfaced/ not used @@ -498,30 +503,41 @@ \the\everylinenumber \endgroup} -% referencing +% referencing: \permithyphenation, also removes leading spaces (new per 29-11-2013) \unexpanded\def\someline [#1]{\page_lines_reference_start{#1}\page_lines_reference_stop{#1}} % was just a def -\unexpanded\def\startline[#1]{\page_lines_reference_start{#1}} -\unexpanded\def\stopline [#1]{\page_lines_reference_stop {#1}} +\unexpanded\def\startline[#1]{\page_lines_reference_start{#1}\ignorespaces} +\unexpanded\def\stopline [#1]{\removeunwantedspaces\permithyphenation\page_lines_reference_stop{#1}} -\def\page_lines_reference_show_start#1% +\def\page_lines_reference_show_start {\ifconditional\tracelinenumbering - \setbox\scratchbox\hbox{\llap - {\vrule\s!width\onepoint\s!depth\strutdp\s!height.8\strutht\raise.85\strutht\hbox{\llap{\tt\txx#1}}}}% - \smashbox\scratchbox - \box\scratchbox + \expandafter\page_lines_reference_show_start_indeed + \else + \expandafter\gobbleoneargument \fi} -\def\page_lines_reference_show_stop#1% +\def\page_lines_reference_show_stop {\ifconditional\tracelinenumbering - \setbox\scratchbox\hbox{\rlap - {\raise.85\strutht\hbox{\rlap{\tt\txx#1}}\vrule\s!width\onepoint\s!depth\strutdp\s!height.8\strutht}}% - \smashbox\scratchbox - \box\scratchbox + \expandafter\page_lines_reference_show_stop_indeed + \else + \expandafter\gobbleoneargument \fi} -\def\page_lines_reference_start#1{\page_lines_some_reference{#1}{lr:b:#1}{\page_lines_reference_show_start{#1}}\ignorespaces} -\def\page_lines_reference_stop #1{\removeunwantedspaces\page_lines_some_reference{#1}{lr:e:#1}{\page_lines_reference_show_stop{#1}}} + +\def\page_lines_reference_show_start_indeed#1% + {\setbox\scratchbox\hbox{\llap + {\vrule\s!width\onepoint\s!depth\strutdp\s!height.8\strutht\raise.85\strutht\hbox{\llap{\tt\txx#1}}}}% + \smashbox\scratchbox + \box\scratchbox} + +\def\page_lines_reference_show_stop_indeed#1% + {\setbox\scratchbox\hbox{\rlap + {\raise.85\strutht\hbox{\rlap{\tt\txx#1}}\vrule\s!width\onepoint\s!depth\strutdp\s!height.8\strutht}}% + \smashbox\scratchbox + \box\scratchbox} + +\def\page_lines_reference_start#1{\page_lines_some_reference{#1}{lr:b:#1}{\page_lines_reference_show_start{#1}}} +\def\page_lines_reference_stop #1{\page_lines_some_reference{#1}{lr:e:#1}{\page_lines_reference_show_stop {#1}}} % eventually we will do this in lua diff --git a/tex/context/base/s-youless.mkiv b/tex/context/base/s-youless.mkiv index 61cce6f79..247eb5f64 100644 --- a/tex/context/base/s-youless.mkiv +++ b/tex/context/base/s-youless.mkiv @@ -42,6 +42,7 @@ local data = table.load(specification.filename or "youless-watt.lua") if not data or data.variant ~= "watt" then + context("invalid variant") return end @@ -49,9 +50,16 @@ -- for the moment no specific font scaling + local years = data.years + + if not years then + context("no years") + return + end + for y=year,year do - local year = data.years[y] + local year = years[y] local scale = 20 local mark = 3 diff --git a/tex/context/base/spac-par.mkiv b/tex/context/base/spac-par.mkiv index da347c5ba..825cdca46 100644 --- a/tex/context/base/spac-par.mkiv +++ b/tex/context/base/spac-par.mkiv @@ -186,19 +186,28 @@ \let\flushpostponednodedata\relax % hook into everypar \newbox \b_spac_postponed_data -\newcount\c_spac_postponed_data - -\installcorenamespace {postponednodesstack} - -\initializeboxstack\??postponednodesstack +%newcount\c_spac_postponed_data + +% \installcorenamespace {postponednodesstack} +% +% \initializeboxstack\??postponednodesstack +% +% \unexpanded\def\pushpostponednodedata +% {\global\advance\c_spac_postponed_data\plusone +% \savebox\??postponednodesstack{\the\c_spac_postponed_data}{\box\b_spac_postponed_data}} +% +% \unexpanded\def\poppostponednodedata +% {\global\setbox\b_spac_postponed_data\hbox{\foundbox\??postponednodesstack{\the\c_spac_postponed_data}}% +% \global\advance\c_spac_postponed_data\minusone +% \ifvoid\b_spac_postponed_data\else +% \glet\flushpostponednodedata\spac_postponed_data_flush +% \fi} \unexpanded\def\pushpostponednodedata - {\global\advance\c_spac_postponed_data\plusone - \savebox\??postponednodesstack{\the\c_spac_postponed_data}{\box\b_spac_postponed_data}} + {\globalpushbox\b_spac_postponed_data} \unexpanded\def\poppostponednodedata - {\global\setbox\b_spac_postponed_data\hbox{\foundbox\??postponednodesstack{\the\c_spac_postponed_data}}% - \global\advance\c_spac_postponed_data\minusone + {\globalpopbox\b_spac_postponed_data \ifvoid\b_spac_postponed_data\else \glet\flushpostponednodedata\spac_postponed_data_flush \fi} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 491e7e0b7..2d49efa85 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 b954e5736..c020445b2 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 065513db8..a93921317 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -2194,7 +2194,7 @@ \else \directlocalfloatsparameter\c!inbetween \fi - \dontleavehmode\hbox{\foundbox\??localfloatstack\recurselevel}% + \dontleavehmode\hbox{\foundbox\??localfloatstack\recurselevel}% \restorebox... \ifnum\recurselevel=\c_strc_localfloats_n\relax \directlocalfloatsparameter\c!after \fi}} @@ -2203,8 +2203,11 @@ {\getlocalfloats \resetlocalfloats} +% \unexpanded\def\getlocalfloat#1% +% {\normalexpanded{\foundbox{\??localfloatstack}{\number#1}}}% \vbox{\restorebox...} + \unexpanded\def\getlocalfloat#1% - {\normalexpanded{\foundbox{\??localfloatstack}{\number#1}}} + {\foundbox\??localfloatstack{\number#1}} % \vbox{\restorebox...} \unexpanded\def\forcelocalfloats {\let\forcedfloatmethod\v!local} diff --git a/tex/context/base/strc-lnt.mkvi b/tex/context/base/strc-lnt.mkvi index f713ee20b..f84521002 100644 --- a/tex/context/base/strc-lnt.mkvi +++ b/tex/context/base/strc-lnt.mkvi @@ -24,6 +24,7 @@ \let\setuplinenote\setupnote \newcount\c_strc_linenotes +\newtoks\everydefinelinenote \unexpanded\def\definelinenote {\dotripleempty\strc_linenotes_define} @@ -44,10 +45,14 @@ \else \definenote[#1]% \fi\fi - \expandafter\let\csname\??linenote#1\expandafter\endcsname\csname#1\endcsname % use copy command - \setuevalue {#1}{\strc_linenotes_direct{#1}}% - \setuevalue{\e!start#1}{\strc_linenotes_start {#1}}% - \setuevalue{\e!stop #1}{\strc_linenotes_stop }% + \pushmacro\currentnote + \edef\currentnote{#1} + \expandafter\let\csname\??linenote\currentnote\expandafter\endcsname\csname\currentnote\endcsname % use copy command + \setuevalue {\currentnote}{\strc_linenotes_direct{\currentnote}}% + \setuevalue{\e!start\currentnote}{\strc_linenotes_start {\currentnote}}% + \setuevalue{\e!stop \currentnote}{\strc_linenotes_stop }% + \the\everydefinelinenote + \popmacro\currentnote \fi} \unexpanded\def\strc_linenotes_direct#1#2% @@ -113,9 +118,7 @@ \ifconditional\c_page_lines_current_to \xdef\m_page_lines_current_to{\currentreferencelinenumber}% \ifx\m_page_lines_previous_from\m_page_lines_current_from - \ifx\m_page_lines_previous_to\m_page_lines_current_to - \notationparameter\c!compressseparator - \else + \ifx\m_page_lines_previous_to\m_page_lines_current_to \else \page_lines_in_from \ifx\m_page_lines_current_from\m_page_lines_current_to\else\endash\page_lines_in_to\fi \fi @@ -127,9 +130,7 @@ \page_lines_in_from \fi \else - \ifx\m_page_lines_previous_from\m_page_lines_current_from - \notationparameter\c!compressseparator - \else + \ifx\m_page_lines_previous_from\m_page_lines_current_from \else \page_lines_in_from \fi \fi} @@ -143,9 +144,7 @@ \edef\currentlinenotereference{#2}% \xdef\m_page_lines_previous_from{\csname\??linenotespreviousfrom\ifcsname\??linenotespreviousfrom\currentnotation\endcsname\currentnotation\fi\endcsname}% \xdef\m_page_lines_previous_to {\csname\??linenotespreviousto \ifcsname\??linenotespreviousto \currentnotation\endcsname\currentnotation\fi\endcsname}% - \doifelse{\notationparameter\c!compress}\v!yes - {\let\linenotelinenumber\strc_linenotes_range_sparse}% - {\let\linenotelinenumber\strc_linenotes_range_normal}% + \strc_linenotes_check_compression \let\currentnote\currentnotation \letnotationparameter\c!numbercommand\linenotelinenumber% todo: deep hook \letnoteparameter \c!textcommand \gobbleoneargument % todo: deep hook @@ -154,6 +153,73 @@ \expandafter\glet\csname\??linenotespreviousto \currentnotation\endcsname\m_page_lines_current_to \endgroup} +% compression + +\installcorenamespace{linenotescompressmethod} + +% compress=yes|no +% compressmethod=separator|stopper + +\def\c!compressdistance{compressdistance} +\def\c!compressmethod {compressmethod} +\def\c!compressstopper {compressstopper} % c +\def\v!compressstopper {compressstopper} % v + +\def\v!separator {separator} % v + +\setvalue{\??linenotescompressmethod\v!separator}% + {\edef\p_compressseparator{\noteparameter\c!compressseparator}% + \scratchskip\noteparameter\c!compressdistance\relax + \ifx\p_compressseparator\empty + \hskip\scratchskip + \else + \hskip.5\scratchskip + \p_compressseparator + \hskip.5\scratchskip + \fi} + +\setvalue{\??linenotescompressmethod\v!stopper}% + {\edef\p_compressstopper{\noteparameter\c!compressstopper}% + \scratchskip\noteparameter\c!compressdistance\relax + \ifx\p_compressstopper\empty + \hskip\scratchskip + \else + \p_compressstopper + \hskip.5\scratchskip + \fi} + +\setvalue{\??linenotescompressmethod\v!space}% + {\hskip\noteparameter\c!compressdistance\relax} + +\def\strc_linenotes_check_compression +% {\edef\p_linenotes_compress {\notationparameter\c!compress}% +% \edef\p_linenotes_compressmethod{\notationparameter\c!compressmethod}% + {\edef\p_linenotes_compress {\noteparameter\c!compress}% + \edef\p_linenotes_compressmethod{\noteparameter\c!compressmethod}% + \ifx\p_linenotes_compress\v!yes + \let\linenotelinenumber\strc_linenotes_range_sparse + \else + \let\linenotelinenumber\strc_linenotes_range_normal + \fi + \ifcsname\??linenotescompressmethod\p_linenotes_compressmethod\endcsname \else + \let\p_linenotes_compressmethod\v!space + \fi} + +\def\strc_linenotes_inbetween % \ifcsname\??linenote\currentnote\expandafter\endcsname + {\csname\??linenotescompressmethod\p_linenotes_compressmethod\endcsname} + +\def\strc_notes_compress_distance{\emwidth \s!plus .5\emwidth \s!minus .25\emwidth} + +\setupnotes + [%c\compress=\v!no, + \c!compressdistance=\strc_notes_compress_distance, + \c!compressseparator=\symbol{\v!compressseparator}, + \c!compressstopper=\symbol{\v!compressstopper}] + +\appendtoks + \letnoteparameter\c!inbetween\strc_linenotes_inbetween +\to \everydefinelinenote + % where to hook this one in? resetcounter has no hook: \unexpanded\def\doresetlinenotecompression#1% \strc_linenotes_reset_previous @@ -162,11 +228,15 @@ \definesymbol [\v!compressseparator] - [\space\hbox{\vl\thinspace\vl}] + [\hbox{\vl\thinspace\vl}] % \space removed -\setupnotations - [%c\compress=\v!no, - \c!compressseparator=\symbol\v!compressseparator] +\definesymbol + [\v!compressstopper] + [,] + +% \setupnotations +% [%c\compress=\v!no, +% \c!compressseparator=\symbol\v!compressseparator] \let\strc_linenotes_traced\gobbleoneargument diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi index cf1735da8..c78fe842c 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -1177,10 +1177,11 @@ \usesetupsparameter\noteparameter % experimental \doifelse{\noteparameter\c!paragraph}\v!yes {\nointerlineskip - \vboxtohboxslack.5\emwidth % we can instead use \hboxestohboxslack later + \startvboxtohboxseparator + \noteparameter\c!inbetween + \stopvboxtohboxseparator \startvboxtohbox \handlenoteitself{#tag}{#id}% - \strc_notes_between_paragraphs \stopvboxtohbox} {\handlenoteitself{#tag}{#id}}% \egroup @@ -1189,7 +1190,7 @@ \unexpanded\def\betweennoteitself#tag% used ? {\edef\currentnote{#tag}% - \doif{\noteparameter\c!paragraph}\v!yes\strc_notes_between_paragraphs} + \doif{\noteparameter\c!paragraph}\v!yes{\noteparameter\c!inbetween}} \unexpanded\def\handlenoteitself#tag#id% {\edef\currentnotenumber{#id}% @@ -1340,12 +1341,6 @@ % idea: tag with attr and then just flush them again -\def\strc_notes_between_paragraphs % should not be too much - {\noteparameter\c!inbetween} - -\def\strc_notes_between_paragraphs_first - {\glet\strc_notes_between_paragraphs_indeed\strc_notes_between_paragraphs}% shape works reverse - \def\strc_notes_flush_global {\doifelse{\noteparameter\c!paragraph}\v!yes {\vbox\starthboxestohbox diff --git a/tex/context/base/supp-box.lua b/tex/context/base/supp-box.lua index 362c204b5..27078f46f 100644 --- a/tex/context/base/supp-box.lua +++ b/tex/context/base/supp-box.lua @@ -23,6 +23,7 @@ local disc_code = nodecodes.disc local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local glue_code = nodecodes.glue +local kern_code = nodecodes.kern local glyph_code = nodecodes.glyph local new_penalty = nodes.pool.penalty @@ -172,12 +173,16 @@ function commands.processsplit(str,command,how,spaced) end end +local a_vboxtohboxseparator = attributes.private("vboxtohboxseparator") + function commands.vboxlisttohbox(original,target,inbetween) local current = texgetbox(original).list local head = nil local tail = nil while current do - if current.id == hlist_code then + local id = current.id + local next = current.next + if id == hlist_code then local list = current.list if head then if inbetween > 0 then @@ -192,10 +197,26 @@ function commands.vboxlisttohbox(original,target,inbetween) head = list end tail = find_tail(list) + -- remove last separator + if tail.id == hlist_code and tail[a_vboxtohboxseparator] == 1 then + local temp = tail + local prev = tail.prev + if next then + local list = tail.list + prev.next = list + list.prev = prev + tail.list = nil + tail = find_tail(list) + else + tail = prev + end + free_node(temp) + end + -- done tail.next = nil current.list = nil end - current = current.next + current = next end local result = new_hlist() result.list = head diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv index 467fff72b..66f373b72 100644 --- a/tex/context/base/supp-box.mkiv +++ b/tex/context/base/supp-box.mkiv @@ -1077,12 +1077,12 @@ %D \stoptyping \def\dohyphenatednextbox - {\ctxcommand{hyphenatedlist(tex.box[\number\nextbox])}% + {\ctxcommand{hyphenatedlist(tex.box[\number\nextbox].list)}% \unhbox\nextbox} -\unexpanded\def\hyphenatedword {\dowithnextboxcs\dohyphenatednextbox \hbox} -\unexpanded\def\hyphenatedpar {\dowithnextboxcs\dohyphenatednextbox \hbox} -\unexpanded\def\hyphenatedfile#1{\dowithnextboxcs\dohyphenatednextbox \hbox{\readfile{#1}\donothing\donothing}} +\unexpanded\def\hyphenatedword {\dowithnextboxcs\dohyphenatednextbox\hbox} +\unexpanded\def\hyphenatedpar {\dowithnextboxcs\dohyphenatednextbox\hbox} +\unexpanded\def\hyphenatedfile#1{\dowithnextboxcs\dohyphenatednextbox\hbox{\readfile{#1}\donothing\donothing}} %D \macros %D {processtokens} @@ -1773,16 +1773,31 @@ % More modern: +% \definesystemattribute[vboxtohboxseparator][public] + +%newbox\d_syst_boxes_vboxtohbox +\newbox\d_syst_boxes_separator + +\unexpanded\def\startvboxtohboxseparator + {\setbox\d_syst_boxes_separator\hbox attr \vboxtohboxseparatorattribute\plusone\bgroup} + +\unexpanded\def\stopvboxtohboxseparator + {\egroup} + \unexpanded\def\startvboxtohbox - {\bgroup + {\begingroup \setbox\scratchbox\hbox\bgroup} \unexpanded\def\stopvboxtohbox - {\ifcase\vboxtohboxslack\else\hskip\zeropoint\!!minus\vboxtohboxslack\fi + {\ifvoid\d_syst_boxes_separator + \hskip\zeropoint\ifcase\vboxtohboxslack\else\s!minus\vboxtohboxslack\fi % we really need a skip + \else + \box\d_syst_boxes_separator + \fi \egroup \ctxcommand{hboxtovbox(\number\scratchbox)}% \box\scratchbox - \egroup} + \endgroup} % A possible reconstruction: @@ -2435,45 +2450,84 @@ %D \hbox{y:\foundbox{two}{a}} \par %D \stoptyping -\def\@@stackbox{@box@} -\def\@@stacklst{@xob@} +\installcorenamespace {stackbox} +\installcorenamespace {stacklst} \unexpanded\def\setstackbox#1#2% - {\ifcsname\@@stackbox:#1:#2\endcsname\else - \expandafter\newbox\csname\@@stackbox:#1:#2\endcsname + {\ifcsname\??stackbox#1:#2\endcsname\else + \expandafter\newbox\csname\??stackbox#1:#2\endcsname \fi - \global\setbox\csname\@@stackbox:#1:#2\endcsname\vbox} + \global\setbox\csname\??stackbox#1:#2\endcsname\vbox} \unexpanded\def\initializeboxstack#1% {\def\docommand##1{\setstackbox{#1}{##1}{}}% - \ifcsname\@@stacklst#1\endcsname - \processcommacommand[\getvalue{\@@stacklst#1}]\docommand + \ifcsname\??stacklst#1\endcsname + \processcommacommand[\getvalue{\??stacklst#1}]\docommand \fi - \letgvalueempty{\@@stacklst#1}} + \letgvalueempty{\??stacklst#1}} \unexpanded\def\savebox#1#2% stack name {% beware, \setxvalue defines the cs beforehand so we cannot use the % test inside the { } - \ifcsname\@@stacklst#1\endcsname - \setxvalue{\@@stacklst#1}{\csname\@@stacklst#1\endcsname,#2}% + \ifcsname\??stacklst#1\endcsname + \setxvalue{\??stacklst#1}{\csname\??stacklst#1\endcsname,#2}% \else - \setxvalue{\@@stacklst#1}{#2}% + \setxvalue{\??stacklst#1}{#2}% \fi \setstackbox{#1}{#2}} -\unexpanded\def\foundbox#1#2% +\unexpanded\def\restorebox#1#2% unwrapped + {\ifcsname\??stackbox#1:#2\endcsname + \copy\csname\??stackbox#1:#2\endcsname + \else + \emptybox + \fi} + +\unexpanded\def\foundbox#1#2% wrapped {\vbox - {\ifcsname\@@stackbox:#1:#2\endcsname - \copy\csname\@@stackbox:#1:#2\endcsname + {\ifcsname\??stackbox#1:#2\endcsname + \copy\csname\??stackbox#1:#2\endcsname \fi}} \unexpanded\def\doifboxelse#1#2#3#4% - {\ifcsname\@@stackbox:#1:#2\endcsname - \ifvoid\csname\@@stackbox:#1:#2\endcsname#4\else#3\fi + {\ifcsname\??stackbox#1:#2\endcsname + \ifvoid\csname\??stackbox#1:#2\endcsname#4\else#3\fi \else #4% \fi} +%D This one is cheaper (the above is no longer used that much): + +\installcorenamespace {boxstack} + +\newcount\c_syst_boxes_stack +\let \b_syst_boxes_stack\relax + +\unexpanded\def\syst_boxes_stack_allocate + {\newbox\b_syst_boxes_stack + \expandafter\let\csname\??boxstack\number\c_syst_boxes_stack\endcsname\b_syst_boxes_stack} + +\unexpanded\def\syst_boxes_push#1#2% + {\global\advance\c_syst_boxes_stack\plusone + \expandafter\let\expandafter\b_syst_boxes_stack\csname\??boxstack\number\c_syst_boxes_stack\endcsname + \ifx\b_syst_boxes_stack\relax % cheaper then csname check as in most cases it's defined + \syst_boxes_stack_allocate + \fi + #1\setbox\b_syst_boxes_stack\box#2\relax} + +\unexpanded\def\syst_boxes_pop#1#2% + {#1\setbox#2\box\csname\??boxstack\number\c_syst_boxes_stack\endcsname + \global\advance\c_syst_boxes_stack\minusone} + +\unexpanded\def\localpushbox {\syst_boxes_push\relax} +\unexpanded\def\localpopbox {\syst_boxes_pop \relax} + +\unexpanded\def\globalpushbox{\syst_boxes_push\global} +\unexpanded\def\globalpopbox {\syst_boxes_pop \global} + +% \unexpanded\def\pushbox#1{\ctxcommand{pushbox(\number#1)}} +% \unexpanded\def\popbox #1{\ctxcommand{popbox(\number#1)}} + %D \macros %D {removedepth, obeydepth} %D @@ -2514,16 +2568,17 @@ %D \macros %D {makestrutofbox} %D -%D This macro sets the dimensions of a box to those of a strut. +%D This macro sets the dimensions of a box to those of a strut. Sort of obsolete +%D so it will go away. + +\unexpanded\def\makestrutofbox % not used + {\afterassignment\syst_boxes_makestrutofbox\c_boxes_register} -\def\domakestrutofbox +\def\syst_boxes_makestrutofbox {\ht\c_boxes_register\strutht \dp\c_boxes_register\strutdp \wd\c_boxes_register\zeropoint} -\unexpanded\def\makestrutofbox % not used - {\afterassignment\domakestrutofbox\c_boxes_register} - %D \macros %D {raisebox,lowerbox} %D @@ -2632,19 +2687,22 @@ %D \macros %D {setboxllx,setboxlly,gsetboxllx,gsetboxlly,getboxllx,getboxlly} %D -%D A prelude to an extended \TEX: +%D A prelude to an extended \TEX\ feature: + +\installcorenamespace {box_x} +\installcorenamespace {box_y} -\unexpanded\def\setboxllx #1#2{\expandafter\edef\csname boxes_x_\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\setboxlly #1#2{\expandafter\edef\csname boxes_y_\number#1\endcsname{\the\dimexpr#2\relax}} +\unexpanded\def\setboxllx #1#2{\expandafter\edef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} +\unexpanded\def\setboxlly #1#2{\expandafter\edef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\gsetboxllx#1#2{\expandafter\xdef\csname boxes_x_\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\gsetboxlly#1#2{\expandafter\xdef\csname boxes_y_\number#1\endcsname{\the\dimexpr#2\relax}} +\unexpanded\def\gsetboxllx#1#2{\expandafter\xdef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} +\unexpanded\def\gsetboxlly#1#2{\expandafter\xdef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} -\def\getboxllx#1{\ifcsname boxes_x_\number#1\endcsname\csname boxes_x_\number#1\endcsname\else\zeropoint\fi} -\def\getboxlly#1{\ifcsname boxes_y_\number#1\endcsname\csname boxes_y_\number#1\endcsname\else\zeropoint\fi} +\def\getboxllx#1{\ifcsname\??box_x\number#1\endcsname\csname\??box_x\number#1\endcsname\else\zeropoint\fi} +\def\getboxlly#1{\ifcsname\??box_y\number#1\endcsname\csname\??box_y\number#1\endcsname\else\zeropoint\fi} -\def\directgetboxllx#1{\csname boxes_x_\number#1\endcsname} % use when sure existence -\def\directgetboxlly#1{\csname boxes_y_\number#1\endcsname} % use when sure existence +\def\directgetboxllx#1{\csname\??box_x\number#1\endcsname} % use when sure existence +\def\directgetboxlly#1{\csname\??box_y\number#1\endcsname} % use when sure existence %D \macros %D {shownextbox} @@ -2729,14 +2787,14 @@ % a bit of test code: -\hbox \bgroup - \ruledvbox {\hbox{\strut gans}} - \ruledvbox to \lineheight {\hbox{\strut gans}} - \ruledvbox to \lineheight {\hbox {gans}} - \ruledvbox to \strutheight{\hbox {gans}} - \ruledvbox to \strutheight{\hbox{\strut gans}} - \ruledvbox to \strutheight{\vss\hbox{gans}} -\egroup +% \hbox \bgroup +% \ruledvbox {\hbox{\strut gans}} +% \ruledvbox to \lineheight {\hbox{\strut gans}} +% \ruledvbox to \lineheight {\hbox {gans}} +% \ruledvbox to \strutheight{\hbox {gans}} +% \ruledvbox to \strutheight{\hbox{\strut gans}} +% \ruledvbox to \strutheight{\vss\hbox{gans}} +% \egroup % to be considered diff --git a/tex/context/base/util-you.lua b/tex/context/base/util-you.lua index e56db7f76..79a0e83e7 100644 --- a/tex/context/base/util-you.lua +++ b/tex/context/base/util-you.lua @@ -1,15 +1,24 @@ if not modules then modules = { } end modules ['util-you'] = { version = 1.002, - comment = "library for fetching data from youless kwk meter polling device", + comment = "library for fetching data from youless kwh meter polling device", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE", license = "see context related readme files" } -- See mtx-youless.lua and s-youless.mkiv for examples of usage. - +-- -- todo: already calculate min, max and average per hour and discard -- older data, or maybe a condense option +-- +-- maybe just a special parser but who cares about speed here +-- +-- curl -c pw.txt http://192.168.2.50/L?w=pwd +-- curl -b pw.txt http://192.168.2.50/V?... +-- +-- the socket library barks on an (indeed) invalid header ... unfortunately we cannot +-- pass a password with each request ... although the youless is a rather nice gadget, +-- the weak part is in the http polling require("util-jsn") @@ -22,14 +31,17 @@ utilities.youless = youless local lpegmatch = lpeg.match local formatters = string.formatters +-- dofile("http.lua") + local http = socket.http --- maybe just a special parser but who cares about speed here +local f_normal = formatters["http://%s/V?%s=%i&f=j"] +local f_password = formatters["http://%s/L?w=%s"] -local function fetch(url,what,i) - local url = formatters["http://%s/V?%s=%i&f=j"](url,what,i) - local data = http.request(url) - local result = data and utilities.json.tolua(data) +local function fetch(url,password,what,i) + local url = f_normal(url,what,i) + local data, h = http.request(url) + local result = data and utilities.json.tolua(data) return result end @@ -46,12 +58,12 @@ local totime = (lpeg.C(4) / tonumber) * lpeg.P("-") * (lpeg.C(2) / tonumber) * lpeg.P(":") * (lpeg.C(2) / tonumber) -local function get(url,what,i,data,average,variant) +local function get(url,password,what,i,data,average,variant) if not data then data = { } end while true do - local d = fetch(url,what,i) + local d = fetch(url,password,what,i) if d and next(d) then local c_year, c_month, c_day, c_hour, c_minute, c_seconds = lpegmatch(totime,d.tm) if c_year and c_seconds then @@ -119,6 +131,7 @@ function youless.collect(specification) local variant = specification.variant or "kwh" local detail = specification.detail or false local nobackup = specification.nobackup or false + local password = specification.password or "" if host == "" then return end @@ -128,12 +141,12 @@ function youless.collect(specification) data = table.load(filename) or data end if variant == "kwh" then - get(host,"m",1,data,true) + get(host,password,"m",1,data,true) elseif variant == "watt" then - get(host,"d",0,data,true) - get(host,"w",1,data) + get(host,password,"d",0,data,true) + get(host,password,"w",1,data) if detail then - get(host,"h",1,data) -- todo: get this for calculating the precise max + get(host,password,"h",1,data) -- todo: get this for calculating the precise max end else return @@ -141,6 +154,8 @@ function youless.collect(specification) local path = file.dirname(filename) local base = file.basename(filename) data.variant = variant + data.host = host + data.updated = os.now() if nobackup then -- saved but with checking local tempname = file.join(path,"youless.tmp") diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1cb7bb1c1..cd3b5d06b 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/28/13 19:36:42 +-- merge date : 12/02/13 15:22:43 do -- begin closure to overcome local limits and interference |