diff options
| author | Hans Hagen <pragma@wxs.nl> | 2011-08-23 12:04:00 +0200 | 
|---|---|---|
| committer | Hans Hagen <pragma@wxs.nl> | 2011-08-23 12:04:00 +0200 | 
| commit | 5c3555d544222b53dfce35eed7104795371d07c3 (patch) | |
| tree | 24229d86efaae44d399f982c96108621c9b92bc1 | |
| parent | 5a562b27ffed58d4496cb1051f1e949902502763 (diff) | |
| download | context-5c3555d544222b53dfce35eed7104795371d07c3.tar.gz | |
beta 2011.08.23 12:04
22 files changed, 225 insertions, 51 deletions
| diff --git a/scripts/context/lua/mtx-rsync.lua b/scripts/context/lua/mtx-rsync.lua new file mode 100644 index 000000000..b549d5bcb --- /dev/null +++ b/scripts/context/lua/mtx-rsync.lua @@ -0,0 +1,168 @@ +if not modules then modules = { } end modules ['mtx-rsync'] = { +    version   = 1.000, +    comment   = "companion to mtxrun.lua", +    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL", +    copyright = "PRAGMA ADE / ConTeXt Development Team", +    license   = "see context related readme files" +} + +-- This is an experimental script that will be extended over time and +-- is used by myself. An example or a copy spec: +-- +-- +-- local devdir = "m:/develop/services" +-- local orgdir = "m:/pod/m4all" +-- +-- return { +--     { +--         origin = { devdir, "framework/scripts/d-dispatchers.lua"}, +--         target = { orgdir, "framework/scripts" }, +--     }, +--     { +--         origin = { devdir, "framework/scripts/common/*"}, +--         target = { orgdir, "framework/scripts/common" }, +--     }, +--     { +--         origin = { devdir, "framework/scripts/d-buildtool.lua"  }, +--         target = { orgdir, "framework/scripts" } +--     }, +--     { +--         origin = { devdir, "framework/scripts/buildtool/*"}, +--         target = { orgdir, "framework/scripts/buildtool" }, +--     }, +--     { +--         origin = { devdir, "framework/m4all*" }, +--         target = { orgdir, "framework" }, +--     }, +--     { +--         origin = { devdir, "framework/configurations/*m4all*"}, +--         target = { orgdir, "framework/configurations" }, +--     }, +--     { +--         recurse = true, +--         origin  = { devdir, "context/tex/texmf-project/tex/context/user/m4all/*" }, +--         target  = { orgdir, "context/tex/texmf-project/tex/context/user/m4all" }, +--     }, +-- } + +local helpinfo = [[ +--job                 use given file as specification +--dryrun              show what would happen +--force               force run +]] + +local application = logs.application { +    name     = "mtx-rsync", +    banner   = "Rsync Helpers 0.10", +    helpinfo = helpinfo, +} + +local format, gsub = string.format, string.gsub +local concat = table.concat + +local report_message = logs.new("rsync message") +local report_dryrun  = logs.new("rsync dryrun") +local report_normal  = logs.new("rsync normal") +local report_command = logs.new("rsync command") + +local cleanup + +if os.platform == "mswin" then +    os.setenv("CYGWIN","nontsec") +    cleanup = function(name) +        return (gsub(name,"([a-zA-Z]):/", "/cygdrive/%1/")) +    end +else +    cleanup = function(name) +        return name +    end +end + +function rsynccommand(dryrun,recurse,origin,target) +    local command = "rsync -ptlv " +    if dryrun then +        command = command .. "-n " +    end +    if recurse then +        command = command .. "-r " +    end +    return format('%s %s %s',command,origin,target) +end + +scripts       = scripts or { } +scripts.rsync = scripts.rsync or { } +local rsync   = scripts.rsync + +rsync.mode = "command" + +function rsync.run(origin,target,message,recurse) +    if type(origin) == "table" then +        origin = concat(origin,"/") +    end +    if type(target) == "table" then +        target = concat(target,"/") +    end +    origin = cleanup(origin) +    target = cleanup(target) +    if message then +        report_message(message) +    end +    if rsync.mode == "dryrun" then +        local command = rsynccommand(true,recurse,origin,target) +        report_dryrun(command.."\n") +        os.execute(command) +    elseif rsync.mode == "force" then +        local command = rsynccommand(false,recurse,origin,target) +        report_normal(command.."\n") +        os.execute(command) +    else +        local command = rsynccommand(true,recurse,origin,target) +        report_command(command) +    end +end + +function rsync.job(list) +    if type(list) == "string" and lfs.isfile(list) then +        list = dofile(list) +    end +    if type(list) ~= "table" then +        report_message("invalid job specification") +        return +    end +    for i=1,#list do +        local li = list[i] +        local origin  = li.origin +        local target  = li.target +        local message = li.message +        local recurse = li.recurse +        if origin and #origin > 0 and target and #target > 0 then -- string or table +            rsync.run(origin,target,message,recurse) +        else +            report_message("invalid job specification at index %s",i) +        end +    end +end + +if environment.ownscript then +    -- stand alone +else +    report(application.banner) +    return rsync +end + +local arguments = environment.arguments +local files     = environment.files + +if arguments.dryrun then +    rsync.mode = "dryrun" +elseif arguments.force then +    rsync.mode = "force" +end + +if arguments.job then +    rsync.job(files[1]) +elseif files[1] and files[2] then +    rsync.run(files[1],files[2]) +else +    application.help() +end diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv index 256d7f64a..cbd53c040 100644 --- a/tex/context/base/buff-ini.mkiv +++ b/tex/context/base/buff-ini.mkiv @@ -151,7 +151,16 @@  \definebuffer[\v!hiding] \setupbuffer[\v!hiding][\c!before=,\c!after=] -\let\processTEXbuffer\getbuffer % handy synonym +% \let\processTEXbuffer\getbuffer % handy synonym + +\unexpanded\def\processTEXbuffer +  {\dosingleempty\doprocessTEXbuffer} + +\def\doprocessTEXbuffer[#1]% +  {\pushcatcodetable +   \catcodetable\ctxcatcodes +   \getbuffer[#1]% +   \popcatcodetable}  \setupbuffer    [\c!before=, diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 64e8683b9..5fb5670d0 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@  %C therefore copyrighted by \PRAGMA. See mreadme.pdf for  %C details. -\newcontextversion{2011.08.21 18:42} +\newcontextversion{2011.08.23 12:04}  %D This file is loaded at runtime, thereby providing an  %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index d18ac6e38..0f5bb0d96 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{2011.08.21 18:42} +\newcontextversion{2011.08.23 12:04}  %D This file is loaded at runtime, thereby providing an  %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdfBinary files differ index c04f17305..f53ba87b3 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.pngBinary files differ index ce32261f6..38a66bac9 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index bac2a1d6b..4dcb714a5 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@  %D your styles an modules.  \edef\contextformat {\jobname} -\edef\contextversion{2011.08.21 18:42} +\edef\contextversion{2011.08.23 12:04}  %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 7db364025..e2cc12234 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@  %D your styles an modules.  \edef\contextformat {\jobname} -\edef\contextversion{2011.08.21 18:42} +\edef\contextversion{2011.08.23 12:04}  %D For those who want to use this: diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv index d044aaf75..31cf63948 100644 --- a/tex/context/base/lxml-ini.mkiv +++ b/tex/context/base/lxml-ini.mkiv @@ -26,7 +26,7 @@  \registerctxluafile{lxml-dir}{1.001} % ctx hacks -\unprotect +\unprotect % todo \!!bs \!!es  \def\c!entities{entities} % to be internationalized diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 70d450c2e..c6743117c 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -885,6 +885,8 @@     \getparameters[\@@framed][#2]% here !     \dodolocalframed} +% will probably move +  \def\installinheritedframed#1%    {\normalexpanded{\doinstallinheritedframed       \expandafter\noexpand\csname current#1\endcsname @@ -908,6 +910,12 @@        \let\framedparameterhash#3%        \dodolocalframed}} +\unexpanded\def\installframedcommandhandler#1#2#3% +  {\installcommandhandler{#1}{#2}{#3}% +   \installinheritedframed{#2}} + +% done +  \def\c!fr!analyze{fr:analyze} % private option  % we can make macros for the offset, width, and height branches or do an \csname @@ -2699,9 +2707,7 @@  %D  %D The next definition shows the defaults. -\installcommandhandler \??kd {framedtext} \??kd - -\installinheritedframed {framedtext} +\installframedcommandhandler \??kd {framedtext} \??kd  \let\setupframedtexts\setupframedtext diff --git a/tex/context/base/scrn-bar.mkvi b/tex/context/base/scrn-bar.mkvi index e0b26f087..de67a6ee5 100644 --- a/tex/context/base/scrn-bar.mkvi +++ b/tex/context/base/scrn-bar.mkvi @@ -57,9 +57,7 @@  %D \stoptext  %D \stoptyping -\installcommandhandler \??ib {interactionbar} \??ib - -\installinheritedframed {interactionbar} +\installframedcommandhandler \??ib {interactionbar} \??ib  \unexpanded\def\interactionbar    {\dodoubleempty\scrn_bar_direct} diff --git a/tex/context/base/scrn-but.mkvi b/tex/context/base/scrn-but.mkvi index 67b92ce7a..7ee9f5473 100644 --- a/tex/context/base/scrn-but.mkvi +++ b/tex/context/base/scrn-but.mkvi @@ -44,9 +44,7 @@  %D  %D \showsetup{setupbuttons} -\installcommandhandler \??bt {button} \??bt - -\installinheritedframed {button} +\installframedcommandhandler \??bt {button} \??bt  \let\setupbuttons\setupbutton @@ -318,9 +316,7 @@  %D \setupinteractionmenu[right][samepage=none, unknownreference=none]  %D \stoptyping -\installcommandhandler \??am {interactionmenu} \??am - -\installinheritedframed {interactionmenu} +\installframedcommandhandler \??am {interactionmenu} \??am  \let\setupinteractionmenus\setupinteractionmenu diff --git a/tex/context/base/scrn-fld.mkvi b/tex/context/base/scrn-fld.mkvi index 452f4ca3c..f25685788 100644 --- a/tex/context/base/scrn-fld.mkvi +++ b/tex/context/base/scrn-fld.mkvi @@ -384,9 +384,9 @@  \installsetuphandler         \??wc {fieldcontentframed}  \installsetuphandler         \??wt {fieldtotalframed} -\installinheritedframed {fieldlabelframed} -\installinheritedframed {fieldcontentframed} -\installinheritedframed {fieldtotalframed} +\installinheritedframed            {fieldlabelframed} +\installinheritedframed            {fieldcontentframed} +\installinheritedframed            {fieldtotalframed}  \unexpanded\def\setupfield {\doquintupleempty\scrn_field_setup_field}  \unexpanded\def\setupfields{\doquadrupleempty\scrn_field_setup_fields} @@ -639,9 +639,7 @@  \newbox  \scrn_tooltip_box_text  \newcount\scrn_tooltip_n -\installcommandhandler \??wh {tooltip} \??wh - -\installinheritedframed {tooltip} +\installframedcommandhandler \??wh {tooltip} \??wh  \setuptooltip    [\c!location=\v!right, diff --git a/tex/context/base/scrn-hlp.mkvi b/tex/context/base/scrn-hlp.mkvi index f5754bf3c..b1a8a10d4 100644 --- a/tex/context/base/scrn-hlp.mkvi +++ b/tex/context/base/scrn-hlp.mkvi @@ -60,9 +60,7 @@  \definesystemattribute[help][public] -\installcommandhandler \??wp {help} \??wp - -\installinheritedframed {help} +\installframedcommandhandler \??wp {help} \??wp  \setuphelp    [\c!frame=\v!off, diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdfBinary files differ index 2c6e9e21a..96c00b7c7 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.pdfBinary files differ index a425dcf9c..0aaf89540 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-doc.mkiv b/tex/context/base/strc-doc.mkiv index a677c4d2d..7813eb7f8 100644 --- a/tex/context/base/strc-doc.mkiv +++ b/tex/context/base/strc-doc.mkiv @@ -60,8 +60,21 @@     \c!command=\showstructuredata]  % maybe flags for list, bm, mark -% -% hm messed up + +\def\structurereferenceprefixon {+} +\def\structurereferenceprefixoff{-} + +\def\setstructurereferenceprefix +  {\ifx\currentstructurereferenceprefix\empty +     % nothing +   \else\ifx\currentstructurereferenceprefix\structurereferenceprefixon +     \setupglobalreferenceprefix[\currentstructurereference]% +   \else\ifx\currentstructurereferenceprefix\structurereferenceprefixoff +     \setupglobalreferenceprefix[]% +   \else +     \setupglobalreferenceprefix[\currentstructurereferenceprefix]% +   \fi\fi\fi +   \let\currentstructurereferenceprefix\referenceprefix}  \def\dostructurecomponent[#1][#2]% #1=interfaced-settings, #2=optional user data (not yet supported)    {\begingroup @@ -115,6 +128,7 @@       \globallet\currentstructurecoding\s!tex     \fi     \setnextinternalreference +   \setstructurereferenceprefix     \xdef\currentstructurenumber{\ctxlua{ % todo: combine with next call, adapt marks accordingly          structures.sections.somelevel {              references = { diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv index bddf90227..09bdd79bf 100644 --- a/tex/context/base/strc-lst.mkiv +++ b/tex/context/base/strc-lst.mkiv @@ -23,9 +23,7 @@  \unprotect -\installcommandhandler \??li {list} \??li - -\installinheritedframed {list} +\installframedcommandhandler \??li {list} \??li  \def\donestedlistattributes#1#2% will change    {\dosetlistattributes#1#2% diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv index 02174496e..5800f677f 100644 --- a/tex/context/base/strc-ref.mkiv +++ b/tex/context/base/strc-ref.mkiv @@ -728,6 +728,9 @@       \edef\referenceprefix{\@@rfprefix:}%     \fi\fi\fi\fi} +\unexpanded\def\setupglobalreferenceprefix[#1]% +  {\xdef\referenceprefix{#1:}} +  %D The most straightforward way of retrieving references is  %D using \type{\ref}. Consider the reference:  %D diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index ece7ebb3a..33ab047d0 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -283,17 +283,6 @@  \newconditional\headshownumber  \newconditional\headisdisplay -\let\headprefix\empty \def\headprefixplus{+} - -\def\setheadreference -  {\edef\headreference      {\headparameter\c!reference}% -   \edef\headreferenceprefix{\headparameter\c!prefix}% -   \ifx\headreferenceprefix\empty -     \let\headreferenceprefix\referenceprefix -   \else -     \setupreferenceprefix[\headreferenceprefix]% currenty no pop -   \fi} -  \setvalue{\??nh:\c!incrementnumber:\v!yes  }{\settrue \headdoincrement\settrue \headtolist}  \setvalue{\??nh:\c!incrementnumber:\v!no   }{\setfalse\headdoincrement\setfalse\headtolist}  \setvalue{\??nh:\c!incrementnumber:\v!list }{\setfalse\headdoincrement\settrue \headtolist} @@ -429,8 +418,8 @@        \c!sectionstopper=\headparameter\c!sectionstopper,        \c!sectionset=\headparameter\c!sectionset,        \c!sectionsegments=\headparameter\c!sectionsegments, -      \c!reference=\headreference, -      \c!referenceprefix=\headreferenceprefix, +      \c!reference=\headparameter\c!reference, +      \c!referenceprefix=\headparameter\c!referenceprefix,        \c!backreference=,        \c!command=,        #2]% @@ -482,7 +471,6 @@     %writestatus\m!system{setup: \currenthead,\currentheadcoupling,\currentheadsection,\currentheadlevel}%     %     \setautostructurelevel -   \setheadreference % does not do much currently     \setheadincrement     \setheadplacement     \setheaddisplay diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv index c39ddcba9..6e3a8f157 100644 --- a/tex/context/base/typo-mar.mkiv +++ b/tex/context/base/typo-mar.mkiv @@ -99,10 +99,8 @@  %D argument concerns the data, the second the framed. Not sharing the setup is  %D on purpose: location, offset, alignment and other parameters might clash. -\installcommandhandler \??mc {margindata}   \??mc -\installcommandhandler \??mf {marginframed} \??mf - -\installinheritedframed {marginframed} +\installcommandhandler       \??mc {margindata}   \??mc +\installframedcommandhandler \??mf {marginframed} \??mf  \setupmargindata    [\c!location=\v!left, diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 4b34ca571..1fb3259b4 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/21/11 18:42:00 +-- merge date  : 08/23/11 12:04:56  do -- begin closure to overcome local limits and interference | 
