summaryrefslogtreecommitdiff
path: root/tex/context/modules
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-05-17 19:01:59 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-05-17 19:01:59 +0200
commit2e8819dad63db17febca68fd6b7ba9a06f9c50b5 (patch)
treef5aa568ff0149001855d6899a91ab3f9984b2dd7 /tex/context/modules
parent77e216e323271fb85d508b7206b13c980540b74b (diff)
downloadcontext-2e8819dad63db17febca68fd6b7ba9a06f9c50b5.tar.gz
2018-05-17 18:39:00
Diffstat (limited to 'tex/context/modules')
-rw-r--r--tex/context/modules/mkiv/s-present-steps.mkiv114
1 files changed, 114 insertions, 0 deletions
diff --git a/tex/context/modules/mkiv/s-present-steps.mkiv b/tex/context/modules/mkiv/s-present-steps.mkiv
new file mode 100644
index 000000000..dbfabf9cd
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-steps.mkiv
@@ -0,0 +1,114 @@
+%D \module
+%D [ file=s-present-steps,
+%D version=2018.05.17,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Repeated Steps,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This a preliminary module, a quick hack and not entirely proper \CONTEXT, but
+%D let's see what more is needed.
+
+\startmodule[present-steps]
+
+\startluacode
+
+moduledata.steps = moduledata.steps or { }
+
+local steps = moduledata.steps
+local data = { }
+local name = "unknown"
+local set = 0
+local settings = nil
+
+function steps.startsteps(buffername)
+ set = set + 1
+ data = { }
+ name = buffername
+end
+
+function steps.startstep(str)
+ settings = utilities.parsers.settings_to_hash(str)
+end
+
+function steps.stopstep()
+ settings.content = buffers.getcontent(name)
+ data[#data+1] = settings
+end
+
+function steps.stopsteps()
+ for i=1,#data do
+ for j=1,i do
+ local step = data[j]
+ if step then
+ local option = step.option
+ local flush = true
+ if option == interfaces.variables["title"] then
+ if i > 1 then
+ flush = false
+ end
+ elseif option == interfaces.variables["repeat"] then
+ if i == 1 then
+ flush = false
+ end
+ end
+ if flush then
+ context(function()
+ buffers.assign("step",step.content)
+ context.processstep("step",set,j,i)
+ end)
+ end
+ end
+ end
+ end
+end
+
+\stopluacode
+
+\definebuffer
+ [step]
+
+\def\currentstep{0}
+
+\unexpanded\def\processstep#1#2#3#4%
+ {\par
+ \edef\currentstep{#4}%
+ \ifnum#3=#4\relax
+ \setupreferencing[prefix=#2:#3]
+ \getbuffer[#1]%
+ \page
+ \else
+ \getbuffer[#1]%
+ \par
+ \fi}
+
+\let\normalstartstep\startstep
+
+\unexpanded\def\startstep
+ {\dosingleempty\startstepindeed}
+
+\def\startstepindeed[#1]%
+ {\ctxlua{moduledata.steps.startstep("#1")}%
+ \normalstartstep}
+
+\unexpanded\def\stopstep
+ {\ctxlua{moduledata.steps.stopstep()}}
+
+\unexpanded\def\startsteps
+ {\ctxlua{moduledata.steps.startsteps("\thedefinedbuffer{step}")}}
+
+\unexpanded\def\stopsteps
+ {\ctxlua{moduledata.steps.stopsteps()}}
+
+\stopmodule
+
+\continueifinputfile{s-present-steps.mkiv}
+
+\usemodule[present-common]
+
+\inputpresentationfile{examples/present-steps-001.tex}