ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* New module: simplesteps.
@ 2012-12-13 22:56 Andre Caldas
  2012-12-14  1:04 ` Philipp Gesang
  0 siblings, 1 reply; 25+ messages in thread
From: Andre Caldas @ 2012-12-13 22:56 UTC (permalink / raw)
  To: ConTeXt users

Well.... since Raw Steps did not work with mkiv, I tried making a very
very simple module for a "beamer-like" behaviour.

I don't really know how to write a module... but here is what I did:
https://bitbucket.org/andrecaldas/math-video-classes/src/9116599821fc246cb54d3e6d7b8e6304649eaffb/lib?at=default

I use \startbuffer and \stopbuffer, and also Lua. As I said, I don't
really know how to write a module... comments are very welcome.

Is it ok if I send a PDF sample to the list?


Cheers,
André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-13 22:56 New module: simplesteps Andre Caldas
@ 2012-12-14  1:04 ` Philipp Gesang
  2012-12-14 11:21   ` Andre Caldas
  2012-12-14 23:07   ` Andre Caldas
  0 siblings, 2 replies; 25+ messages in thread
From: Philipp Gesang @ 2012-12-14  1:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1.1: Type: text/plain, Size: 2391 bytes --]

Hey André,

thanks for the interesting contribution! Have a look at the patch
I hopefully don’t forget to append.

···<date: 2012-12-13, Thursday>···<from: Andre Caldas>···

> Well.... since Raw Steps did not work with mkiv, I tried making a very
> very simple module for a "beamer-like" behaviour.
> 
> I don't really know how to write a module... but here is what I did:
> https://bitbucket.org/andrecaldas/math-video-classes/src/9116599821fc246cb54d3e6d7b8e6304649eaffb/lib?at=default
> 
> I use \startbuffer and \stopbuffer, and also Lua. As I said, I don't
> really know how to write a module... comments are very welcome.

Honestly, it doesn’t work, but that’s a minor flaw! If you want
to use buffers with indirection you have to take care of the
argument delimiters. \grabbufferdata is excellent for that.

I did some rewriting: stray globals and rough namespacing,
mostly. On the practice of calling TeX macros from Lua, the cld
manual can give you a boost:

    http://www.pragma-ade.com/general/manuals/cld-mkiv.pdf

This explains how to properly use the context.*() namespace
instead of tex.print and the likes.

I could not figure out how exactly the section block thingy is
supposed to work. It does not create the \startframe macro at all
-- is this something custom? I infer it’s about the slide title
so I have \startframe call \section but that should be taken as a
placeholder at most. In my own slide module I use
\{start,stop}section with the option placehead=no and rely on the
page header to display the slide title (i.e. current section
running head). That was the laziest way I could imagine :P

Some remarks:

  - you should rename simplesteps.mkiv to t-simplesteps.mkiv,
    indicating that it is a thirdparty module
  - if you plan on expanding the code you eventually will come to
    love this bit: http://wiki.contextgarden.net/System_Macros
  - Context has a namespacing system which you might consider
    switching to in the long term:
      http://tex.stackexchange.com/q/58654
    but it’s arguably an advanced method
  - maybe switch to mkvi as named parameters make rewriting
    macros a breeze

> Is it ok if I send a PDF sample to the list?

For uploading docs and such to the “downloads” section on
bitbucket is great. Then just post a link.

Happy TeXing!
Philipp


[-- Attachment #1.1.2: simplesteps.patch --]
[-- Type: text/plain, Size: 3301 bytes --]

diff -r 9116599821fc lib/simplesteps.lua
--- a/lib/simplesteps.lua	Thu Dec 13 20:49:38 2012 -0200
+++ b/lib/simplesteps.lua	Fri Dec 14 01:59:00 2012 +0100
@@ -7,10 +7,12 @@
     license   = "GPL version 3.0 or any later version"
 }
 
-simplesteps = simplesteps or {}
+thirddata               = thirddata or {}
+thirddata.simplesteps   = thirddata.simplesteps or {}
+local simplesteps       = thirddata.simplesteps
 
-local stepcounter = 0
-local maxstepcount = 1
+local stepcounter   = 0
+local maxstepcount  = 1
 
 
 function simplesteps.distance_to_step(str)
@@ -51,7 +53,7 @@
 function simplesteps.update_maxstepcount(steps)
   for i=1,#steps
   do
-    step = steps[i]
+    local step = steps[i]
     if maxstepcount < step
     then
       maxstepcount = step
diff -r 9116599821fc lib/simplesteps.mkiv
--- a/lib/simplesteps.mkiv	Thu Dec 13 20:49:38 2012 -0200
+++ b/lib/simplesteps.mkiv	Fri Dec 14 01:59:00 2012 +0100
@@ -18,7 +18,7 @@
 \unprotect
 
 %D \macros
-%D   {simplesteps}
+%D   {startframe,stopframe}
 %D
 %D \startframe[Slide 1]
 %D   \startitemize
@@ -31,49 +31,53 @@
 
 \unexpanded\def\uncover[#1]%
   {\ctxlua{
-     distance = simplesteps.distance_to_step("#1")
+     local distance = thirddata.simplesteps.distance_to_step("#1")
      if 0 == distance
       then
       elseif 1 == distance
       then
-        tex.sprint('\\simplestepscoverednext')
+        context.simplestepscoverednext()
       elseif 2 == distance
       then
-        tex.sprint('\\simplestepscoveredfar')
+        context.simplestepscoveredfar()
       else
-        tex.sprint('\\simplestepscoveredveryfar')
+        context.simplestepscoveredveryfar()
       end
   }}
 
 \unexpanded\def\only[#1]%
   {\ctxlua{
-      if not simplesteps.instep("#1")
+      if not thirddata.simplesteps.instep("#1")
       then
-        tex.sprint('\\simplestepshidden')
+        context.simplestepshidden()
       end
   }}
 
 \unexpanded\def\simplestepsplaybuffer%
-  {\ctxlua{simplesteps.playbuffer()}}
+  {\ctxlua{thirddata.simplesteps.playbuffer()}}
 
-\definecolor[hidden1][s=0.75]
-\definecolor[hidden2][s=0.90]
-\definecolor[hidden3][s=0.95]
+\definecolor[simplesteps:hidden1][s=0.75]
+\definecolor[simplesteps:hidden2][s=0.90]
+\definecolor[simplesteps:hidden3][s=0.95]
 
 \unexpanded\def\simplestepshidden#1{}
-\unexpanded\def\simplestepscoverednext#1{\color[hidden1]{#1}}
-\unexpanded\def\simplestepscoveredfar#1{\color[hidden2]{#1}}
-\unexpanded\def\simplestepscoveredveryfar#1{\color[hidden3]{#1}}
+\unexpanded\def\simplestepscoverednext#1{\color[simplesteps:hidden1]{#1}}
+\unexpanded\def\simplestepscoveredfar#1{\color[simplesteps:hidden2]{#1}}
+\unexpanded\def\simplestepscoveredveryfar#1{\color[simplesteps:hidden3]{#1}}
+
+
+\unexpanded\def\startframe{\dosingleempty\frame_start}
+
+\def\frame_start[#1]{%
+  \iffirstargument
+    \section{#1}%% solution needed here!
+  \fi
+  \begingroup
+  \grabbufferdata[simplesteps][startframe][stopframe]%
+}
+
+\let\stopframe\simplestepsplaybuffer
 
 \protect
 
-
-\setupsectionblock
-  [frame]
-  [before=\initframe,after=\endframe]
-
-\def\initframe{\startbuffer[simplesteps]}
-\def\endframe{\stopbuffer\simplestepsplaybuffer}
-
-
 \endinput

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14  1:04 ` Philipp Gesang
@ 2012-12-14 11:21   ` Andre Caldas
  2012-12-14 12:50     ` Wolfgang Schuster
  2012-12-14 20:57     ` Otared Kavian
  2012-12-14 23:07   ` Andre Caldas
  1 sibling, 2 replies; 25+ messages in thread
From: Andre Caldas @ 2012-12-14 11:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 3048 bytes --]

Hello!

> thanks for the interesting contribution! Have a look at the patch
> I hopefully don’t forget to append.

Thank you! I will take a look and learn... ;-)


>> [...]
>> I use \startbuffer and \stopbuffer, and also Lua. As I said, I don't
>> really know how to write a module... comments are very welcome.
>
> Honestly, it doesn’t work, but that’s a minor flaw!

Sorry! I forgot to mention. Only a little subset of it works. I have
(already - so I don't forget to) attached a "tex" file that works.


> [**lots of advices I will study carefully latter**]
> [...]
> I could not figure out how exactly the section block thingy is
> supposed to work. It does not create the \startframe macro at all
> -- is this something custom?

I don't know how to use this "startframe" yet. So, I am doing like
this right now: (numbers like 2-3 or 2- don't work yet)

=== START code snip ===
\startbuffer[simplesteps]
  \startitemize
    \item First item
    \uncover[2,3,4]{\item Second item}
    \uncover[3,4]{\item Second item}
    \uncover[4]{\item Second item}
  \stopitemize
\stopbuffer
\simplestepsplaybuffer
=== STOP code snip ===

The "simplestepsplaybuffer" macro simply calls the
simplesteps.playbuffer() lua function. This function plays the buffer
and determines if it has to be played again or not. If it does, then
it tex.print('\simplestepsplaybuffer').

The macros "uncover" determine how far the specification is from being
played. If it is being played now, then show. If it is played "next",
then show in gray. And so on.


> I infer it’s about the slide title
> so I have \startframe call \section but that should be taken as a
> placeholder at most. In my own slide module I use
> \{start,stop}section with the option placehead=no and rely on the
> page header to display the slide title (i.e. current section
> running head). That was the laziest way I could imagine :P

I guess that's what I want to do. I just don't have the necessary
knowledge yet. ;-)


> Some remarks:
>
>   - you should rename simplesteps.mkiv to t-simplesteps.mkiv,
>     indicating that it is a thirdparty module

I will. I think I will have a bitbucket repository exclusively for
modules. Then I will have the proper directory structure, the proper
naming scheme and hopefully proper documentation, xml, etc. (lots of
things to learn!)


>   - if you plan on expanding the code you eventually will come to
>     love this bit: http://wiki.contextgarden.net/System_Macros
>   - Context has a namespacing system which you might consider
>     switching to in the long term:
>       http://tex.stackexchange.com/q/58654
>     but it’s arguably an advanced method

Well, I do want to do it the right (recommended) way!


>   - maybe switch to mkvi as named parameters make rewriting
>     macros a breeze

Would you elaborate a bit further?


>> Is it ok if I send a PDF sample to the list?

I hope you can use the TEX file attached.


Cheers,
André Caldas.

[-- Attachment #2: simpletest.tex --]
[-- Type: application/x-tex, Size: 2177 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 11:21   ` Andre Caldas
@ 2012-12-14 12:50     ` Wolfgang Schuster
  2012-12-14 15:43       ` Andre Caldas
  2012-12-14 20:57     ` Otared Kavian
  1 sibling, 1 reply; 25+ messages in thread
From: Wolfgang Schuster @ 2012-12-14 12:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 14.12.2012 um 12:21 schrieb Andre Caldas <andre.em.caldas@gmail.com>:

>>  - maybe switch to mkvi as named parameters make rewriting
>>    macros a breeze
> 
> Would you elaborate a bit further?


You can use for the parameter in your macros names instead of number,
as you can see below the first definition uses “#1” for the argument while
the second uses “#text”.

You can force MkIV mode when you add “% macros=mkvi” at the top
of the file. When your code is a external file (e.g. a module) you can
give it “mkvi” as file extension (instead of the normal “tex” or “mkiv”)
and don’t need this line anymore.

%%%% begin example
% macros=mkvi

\def\mkivhighlight#1{{\red #1}}

\def\mkvihighlight#text{{\green #text}}

\starttext

\mkivhighlight{MkIV}

\mkvihighlight{MkVI}

\stoptext
%%%% end example

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 12:50     ` Wolfgang Schuster
@ 2012-12-14 15:43       ` Andre Caldas
  2012-12-14 16:02         ` Wolfgang Schuster
  0 siblings, 1 reply; 25+ messages in thread
From: Andre Caldas @ 2012-12-14 15:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>>>  - maybe switch to mkvi as named parameters make rewriting
>>>    macros a breeze
>>
>> Would you elaborate a bit further?
>
> You can use for the parameter in your macros names instead of number,
> as you can see below the first definition uses “#1” for the argument while
> the second uses “#text”.
>
> You can force MkIV mode when you add “% macros=mkvi” at the top
> of the file. When your code is a external file (e.g. a module) you can
> give it “mkvi” as file extension (instead of the normal “tex” or “mkiv”)
> and don’t need this line anymore.

I had tried named parameters and I didn't know why it was not
working... now I know! :-)

I have one question:
- What does it happen when there is a quotation mark (") inside the
parameter? Do I need to "escape" the contents passed to the macro?


André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 15:43       ` Andre Caldas
@ 2012-12-14 16:02         ` Wolfgang Schuster
  2012-12-14 16:18           ` Andre Caldas
  0 siblings, 1 reply; 25+ messages in thread
From: Wolfgang Schuster @ 2012-12-14 16:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 14.12.2012 um 16:43 schrieb Andre Caldas <andre.em.caldas@gmail.com>:

>>>> - maybe switch to mkvi as named parameters make rewriting
>>>>   macros a breeze
>>> 
>>> Would you elaborate a bit further?
>> 
>> You can use for the parameter in your macros names instead of number,
>> as you can see below the first definition uses “#1” for the argument while
>> the second uses “#text”.
>> 
>> You can force MkIV mode when you add “% macros=mkvi” at the top
>> of the file. When your code is a external file (e.g. a module) you can
>> give it “mkvi” as file extension (instead of the normal “tex” or “mkiv”)
>> and don’t need this line anymore.
> 
> I had tried named parameters and I didn't know why it was not
> working... now I know! :-)

The file extension/first line is necessary because TeX itself still expects numbered
parameters and context has to convert the names to numbers before TeX sees them.

To know when such a conversion is necessary the file extension is a hint for context.

> I have one question:
> - What does it happen when there is a quotation mark (") inside the
> parameter? Do I need to "escape" the contents passed to the macro?


No you don’t have to but you could have checked yourself :)

\starttext
\bold{"}
\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 16:02         ` Wolfgang Schuster
@ 2012-12-14 16:18           ` Andre Caldas
  2012-12-14 16:34             ` Wolfgang Schuster
  0 siblings, 1 reply; 25+ messages in thread
From: Andre Caldas @ 2012-12-14 16:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>> I have one question:
>> - What does it happen when there is a quotation mark (") inside the
>> parameter? Do I need to "escape" the contents passed to the macro?
>
>
> No you don’t have to but you could have checked yourself :)

Sorry... I didn't try it when I asked, but I had the impression I did
try it before. In my case, if I use
\uncover[2,"3]{xxxx}
I get the error: =P
! LuaTeX error <main ctx instance>:1: ')' expected near '3'.

system          > tex > error on line 6 in file
virtual://buffer.simplesteps.5: LuaTeX error  ...

<empty file>


\uncover ...t('\\simplestepscoveredveryfar') end }

l.6     \uncover[2,"3]
                      {\item The {\em second main message} of your talk in o...
?


Cheers,
André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 16:18           ` Andre Caldas
@ 2012-12-14 16:34             ` Wolfgang Schuster
  2012-12-14 16:38               ` Andre Caldas
  0 siblings, 1 reply; 25+ messages in thread
From: Wolfgang Schuster @ 2012-12-14 16:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 14.12.2012 um 17:18 schrieb Andre Caldas <andre.em.caldas@gmail.com>:

>>> I have one question:
>>> - What does it happen when there is a quotation mark (") inside the
>>> parameter? Do I need to "escape" the contents passed to the macro?
>> 
>> 
>> No you don’t have to but you could have checked yourself :)
> 
> Sorry... I didn't try it when I asked, but I had the impression I did
> try it before. In my case, if I use
> \uncover[2,"3]{xxxx}
> I get the error: =P
> ! LuaTeX error <main ctx instance>:1: ')' expected near '3'.

You’re trying to pass a single " to Lua which doesn’t work because you use "" in your Lua code for the string.

When you change your definition for \uncover to

\unexpanded\def\uncover[#1]%
  {\ctxlua{
     distance = simplesteps.distance_to_step(\!!bs#1\!!es)
     ...
  }}

it works because the " is now only part of the string.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 16:34             ` Wolfgang Schuster
@ 2012-12-14 16:38               ` Andre Caldas
  2012-12-14 17:32                 ` Philipp Gesang
  0 siblings, 1 reply; 25+ messages in thread
From: Andre Caldas @ 2012-12-14 16:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> \unexpanded\def\uncover[#1]%
>   {\ctxlua{
>      distance = simplesteps.distance_to_step(\!!bs#1\!!es)
>      ...
>   }}
>
> it works because the " is now only part of the string.

Thanks. That's what I needed. I guess
bs = begin string
es = end string.


Cheers,
André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 16:38               ` Andre Caldas
@ 2012-12-14 17:32                 ` Philipp Gesang
  2012-12-14 20:35                   ` Andre Caldas
  0 siblings, 1 reply; 25+ messages in thread
From: Philipp Gesang @ 2012-12-14 17:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 720 bytes --]

···<date: 2012-12-14, Friday>···<from: Andre Caldas>···

> > \unexpanded\def\uncover[#1]%
> >   {\ctxlua{
> >      distance = simplesteps.distance_to_step(\!!bs#1\!!es)
> >      ...
> >   }}
> >
> > it works because the " is now only part of the string.
> 
> Thanks. That's what I needed. I guess
> bs = begin string
> es = end string.

These expand to Lua long strings, [===[ and ]===] respectively,
without checking, so theoretically the same issue will arise iff
your string contains ]===]. I consider the likelihood for this to
happen to be too low to bother, but if you want to be absolutely
on the safe side you can also use \luaescapestring. See the
Luatex manual, section 2.3.6.

Philipp


[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 17:32                 ` Philipp Gesang
@ 2012-12-14 20:35                   ` Andre Caldas
  0 siblings, 0 replies; 25+ messages in thread
From: Andre Caldas @ 2012-12-14 20:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> These expand to Lua long strings, [===[ and ]===] respectively,
> without checking, so theoretically the same issue will arise iff
> your string contains ]===]. I consider the likelihood for this to
> happen to be too low to bother, but if you want to be absolutely
> on the safe side you can also use \luaescapestring. See the
> Luatex manual, section 2.3.6.

The luaescapestring will also escape the quotation marks... :-)

I will use it, then.
I used to develop WEB systems. Very vulnerable to injection attacks. I
really like things properly escaped...


Cheers,
André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 11:21   ` Andre Caldas
  2012-12-14 12:50     ` Wolfgang Schuster
@ 2012-12-14 20:57     ` Otared Kavian
  2012-12-14 22:26       ` Andre Caldas
  1 sibling, 1 reply; 25+ messages in thread
From: Otared Kavian @ 2012-12-14 20:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi André,

You were so quick to write your module…
Thanks for sharing, but I could not typeset the example file you sent: I didn't get whether your file simplesteps.mkiv should be renamed 
simplesteps.mkiv
or
simplesteps.tex
or even
t-simplesteps.tex
or any other suffix.
Maybe after you apply the changes suggested by Wolfgang and Philip you are going to repost your moudle?

Best regards: OK

On 14 déc. 2012, at 12:21, Andre Caldas <andre.em.caldas@gmail.com> wrote:

> Hello!
> 
>> thanks for the interesting contribution! Have a look at the patch
>> I hopefully don’t forget to append.
> 
> Thank you! I will take a look and learn... ;-)
> 
> 
>>> [...]
>>> I use \startbuffer and \stopbuffer, and also Lua. As I said, I don't
>>> really know how to write a module... comments are very welcome.
>> 
>> Honestly, it doesn’t work, but that’s a minor flaw!
> 
> Sorry! I forgot to mention. Only a little subset of it works. I have
> (already - so I don't forget to) attached a "tex" file that works.
> 
> 
>> [**lots of advices I will study carefully latter**]
>> [...]
>> I could not figure out how exactly the section block thingy is
>> supposed to work. It does not create the \startframe macro at all
>> -- is this something custom?
> 
> I don't know how to use this "startframe" yet. So, I am doing like
> this right now: (numbers like 2-3 or 2- don't work yet)
> 
> === START code snip ===
> \startbuffer[simplesteps]
>  \startitemize
>    \item First item
>    \uncover[2,3,4]{\item Second item}
>    \uncover[3,4]{\item Second item}
>    \uncover[4]{\item Second item}
>  \stopitemize
> \stopbuffer
> \simplestepsplaybuffer
> === STOP code snip ===
> 
> The "simplestepsplaybuffer" macro simply calls the
> simplesteps.playbuffer() lua function. This function plays the buffer
> and determines if it has to be played again or not. If it does, then
> it tex.print('\simplestepsplaybuffer').
> 
> The macros "uncover" determine how far the specification is from being
> played. If it is being played now, then show. If it is played "next",
> then show in gray. And so on.
> 
> 
>> I infer it’s about the slide title
>> so I have \startframe call \section but that should be taken as a
>> placeholder at most. In my own slide module I use
>> \{start,stop}section with the option placehead=no and rely on the
>> page header to display the slide title (i.e. current section
>> running head). That was the laziest way I could imagine :P
> 
> I guess that's what I want to do. I just don't have the necessary
> knowledge yet. ;-)
> 
> 
>> Some remarks:
>> 
>>  - you should rename simplesteps.mkiv to t-simplesteps.mkiv,
>>    indicating that it is a thirdparty module
> 
> I will. I think I will have a bitbucket repository exclusively for
> modules. Then I will have the proper directory structure, the proper
> naming scheme and hopefully proper documentation, xml, etc. (lots of
> things to learn!)
> 
> 
>>  - if you plan on expanding the code you eventually will come to
>>    love this bit: http://wiki.contextgarden.net/System_Macros
>>  - Context has a namespacing system which you might consider
>>    switching to in the long term:
>>      http://tex.stackexchange.com/q/58654
>>    but it’s arguably an advanced method
> 
> Well, I do want to do it the right (recommended) way!
> 
> 
>>  - maybe switch to mkvi as named parameters make rewriting
>>    macros a breeze
> 
> Would you elaborate a bit further?
> 
> 
>>> Is it ok if I send a PDF sample to the list?
> 
> I hope you can use the TEX file attached.
> 
> 
> Cheers,
> André Caldas.
> <simpletest.tex>___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 20:57     ` Otared Kavian
@ 2012-12-14 22:26       ` Andre Caldas
  0 siblings, 0 replies; 25+ messages in thread
From: Andre Caldas @ 2012-12-14 22:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello, OK!

> You were so quick to write your module…
> Thanks for sharing,

:-)


> but I could not typeset the example file you sent:
> I didn't get whether your file simplesteps.mkiv should be renamed

I did this on my machine:
1. Copy simplesteps.{lua,mkiv} to
texmf-local/tex/context/third/simplesteps/
In my case, it is here:
/home/andre/context_standalone/tex/texmf-local/tex/context/third/simplesteps

2. Clear the cache.
I don't really know the proper way to do that. So, I just removed the
directory texmf-cache. In my case:
rm /home/andre/context_standalone/tex/texmf-cache/ -rf

3. Compile:
context simpletest.tex


> Maybe after you apply the changes suggested
> by Wolfgang and Philip you are going to repost your moudle?

The module will be here:
https://bitbucket.org/andrecaldas/context-simplesteps

Hopefully, one day, here... ;-)
http://modules.contextgarden.net/
I will let you know.


Cheers,
André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14  1:04 ` Philipp Gesang
  2012-12-14 11:21   ` Andre Caldas
@ 2012-12-14 23:07   ` Andre Caldas
  2012-12-15  6:02     ` Wolfgang Schuster
  1 sibling, 1 reply; 25+ messages in thread
From: Andre Caldas @ 2012-12-14 23:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> thanks for the interesting contribution! Have a look at the patch
> I hopefully don’t forget to append.

I didn't quite understood how this works:
\unexpanded\def\startframe{\dosingleempty\frame_start}

\def\frame_start[#1]{%
  \iffirstargument
    \section{#1}%% solution needed here!
  \fi
  \begingroup
  \grabbufferdata[simplesteps][startframe][stopframe]%
}

\let\stopframe\simplestepsplaybuffer


Cheers,
André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-14 23:07   ` Andre Caldas
@ 2012-12-15  6:02     ` Wolfgang Schuster
  2012-12-15 10:28       ` Sietse Brouwer
  2012-12-15 11:49       ` Hans Hagen
  0 siblings, 2 replies; 25+ messages in thread
From: Wolfgang Schuster @ 2012-12-15  6:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 15.12.2012 um 00:07 schrieb Andre Caldas <andre.em.caldas@gmail.com>:

>> thanks for the interesting contribution! Have a look at the patch
>> I hopefully don’t forget to append.
> 
> I didn't quite understood how this works:
> \unexpanded\def\startframe{\dosingleempty\frame_start}

This creates the new command \startframe which calls the internal command \frame_start which has one optional argument.

> \def\frame_start[#1]{%
>  \iffirstargument
>    \section{#1}%% solution needed here!
>  \fi

This block checks if the optional argument is used by the user, when the argument is used the content is typeset as \section.

>  \begingroup
>  \grabbufferdata[simplesteps][startframe][stopframe]%
> }

With the \grabbufferdata command the content beginning from \startframe until \stopframe is stored in a buffer with the name “simplesteps”.

> \let\stopframe\simplestepsplaybuffer

This makes the \stopframe command a synonym for \simplestepsplaybuffer which is now called when the frame environment ends.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15  6:02     ` Wolfgang Schuster
@ 2012-12-15 10:28       ` Sietse Brouwer
  2012-12-15 10:40         ` Philipp Gesang
                           ` (3 more replies)
  2012-12-15 11:49       ` Hans Hagen
  1 sibling, 4 replies; 25+ messages in thread
From: Sietse Brouwer @ 2012-12-15 10:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>>  \begingroup
>>  \grabbufferdata[simplesteps][startframe][stopframe]%
>> }
>
> With the \grabbufferdata command the content beginning from \startframe until \stopframe is stored in a buffer with the name “simplesteps”.

(1) What does the \begingroup do? I could not find a \endgroup in the
patch, nor in the module code.

(2) I've approximately documented grabbufferdata here:
http://wiki.contextgarden.net/Command/grabbufferdata
But when I tried to write a minimal example, I couldn't get it to compile.

%% begin example
\grabbufferdata[mybuffer][thisisthestart][thisistheend]
\thisisthestart
My friend, you would not tell with such high zest
To children ardent for some desparate glory,
The old Lie: Dulce et decorum est
Pro patria mori.
\thisistheend

\typebuffer[mybuffer]
%% end example

What am I doing wrong? And is the description I put on the wiki correct?

Cheers,
Sietse
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15 10:28       ` Sietse Brouwer
@ 2012-12-15 10:40         ` Philipp Gesang
  2012-12-15 12:07           ` Wolfgang Schuster
  2012-12-15 11:30         ` Andre Caldas
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 25+ messages in thread
From: Philipp Gesang @ 2012-12-15 10:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 560 bytes --]

···<date: 2012-12-15, Saturday>···<from: Sietse Brouwer>···

> >>  \begingroup
> >>  \grabbufferdata[simplesteps][startframe][stopframe]%
> >> }
> >
> > With the \grabbufferdata command the content beginning from \startframe until \stopframe is stored in a buffer with the name “simplesteps”.
> 
> (1) What does the \begingroup do? I could not find a \endgroup in the
> patch, nor in the module code.

It’s in the definition of \buff_stop in buff-ini.mkiv. The first
thing \startbuffer does is to insert a bgroup, too.

Philipp


[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15 10:28       ` Sietse Brouwer
  2012-12-15 10:40         ` Philipp Gesang
@ 2012-12-15 11:30         ` Andre Caldas
  2012-12-15 11:44         ` Marco Patzer
  2012-12-15 12:38         ` Wolfgang Schuster
  3 siblings, 0 replies; 25+ messages in thread
From: Andre Caldas @ 2012-12-15 11:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> %% begin example
> \grabbufferdata[mybuffer][thisisthestart][thisistheend]
> \thisisthestart
> My friend, you would not tell with such high zest
> To children ardent for some desparate glory,
> The old Lie: Dulce et decorum est
> Pro patria mori.
> \thisistheend
>
> \typebuffer[mybuffer]
> %% end example
>
> What am I doing wrong? And is the description I put on the wiki correct?

It's just a guess... but I think the \grabbufferdata has to be invoked
*after* the \thisisthestart, \thisistheend pair.


André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15 10:28       ` Sietse Brouwer
  2012-12-15 10:40         ` Philipp Gesang
  2012-12-15 11:30         ` Andre Caldas
@ 2012-12-15 11:44         ` Marco Patzer
  2012-12-15 12:38         ` Wolfgang Schuster
  3 siblings, 0 replies; 25+ messages in thread
From: Marco Patzer @ 2012-12-15 11:44 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 888 bytes --]

On 2012–12–15 Sietse Brouwer wrote:

> But when I tried to write a minimal example, I couldn't get it to compile.
> 
> %% begin example
> \grabbufferdata[mybuffer][thisisthestart][thisistheend]
> \thisisthestart
> My friend, you would not tell with such high zest
> To children ardent for some desparate glory,
> The old Lie: Dulce et decorum est
> Pro patria mori.
> \thisistheend
> 
> \typebuffer[mybuffer]
> %% end example
> 
> What am I doing wrong?

You have to wrap it in a macro:

\starttext

\define\thisisthestart
  {\grabbufferdata[mybuffer][thisisthestart][thisistheend]}

\let\thisistheend\relax %% not necessary

\thisisthestart
My friend, you would not tell with such high zest
To children ardent for some desparate glory,
The old Lie: Dulce et decorum est
Pro patria mori.
\thisistheend

\typebuffer[mybuffer]

\stoptext


Marco

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15  6:02     ` Wolfgang Schuster
  2012-12-15 10:28       ` Sietse Brouwer
@ 2012-12-15 11:49       ` Hans Hagen
  2012-12-15 12:03         ` Wolfgang Schuster
  1 sibling, 1 reply; 25+ messages in thread
From: Hans Hagen @ 2012-12-15 11:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Wolfgang Schuster

On 12/15/2012 7:02 AM, Wolfgang Schuster wrote:
>
> Am 15.12.2012 um 00:07 schrieb Andre Caldas <andre.em.caldas@gmail.com>:
>
>>> thanks for the interesting contribution! Have a look at the patch
>>> I hopefully don’t forget to append.
>>
>> I didn't quite understood how this works:
>> \unexpanded\def\startframe{\dosingleempty\frame_start}
>
> This creates the new command \startframe which calls the internal command \frame_start which has one optional argument.
>
>> \def\frame_start[#1]{%
>>   \iffirstargument
>>     \section{#1}%% solution needed here!
>>   \fi
>
> This block checks if the optional argument is used by the user, when the argument is used the content is typeset as \section.
>
>>   \begingroup
>>   \grabbufferdata[simplesteps][startframe][stopframe]%
>> }
>
> With the \grabbufferdata command the content beginning from \startframe until \stopframe is stored in a buffer with the name “simplesteps”.
>
>> \let\stopframe\simplestepsplaybuffer
>
> This makes the \stopframe command a synonym for \simplestepsplaybuffer which is now called when the frame environment ends.

best use a namespace: \simplesteps_start_frame

(dangerous name: \startframe ... could be core name)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15 11:49       ` Hans Hagen
@ 2012-12-15 12:03         ` Wolfgang Schuster
  0 siblings, 0 replies; 25+ messages in thread
From: Wolfgang Schuster @ 2012-12-15 12:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 15.12.2012 um 12:49 schrieb Hans Hagen <pragma@wxs.nl>:

> (dangerous name: \startframe ... could be core name)

It depends, using it asa global name isa no go but defining it inside group is useful, e.g.

\def\mycommand_start
  {\begingroup
   \let\startframe\mycommand_frame_start
   \let\stopframe \mycommand_frame_stop}

\def\mycommand_Stop
  {\endgroup}

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15 10:40         ` Philipp Gesang
@ 2012-12-15 12:07           ` Wolfgang Schuster
  2012-12-15 12:34             ` Philipp Gesang
  0 siblings, 1 reply; 25+ messages in thread
From: Wolfgang Schuster @ 2012-12-15 12:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 15.12.2012 um 11:40 schrieb Philipp Gesang <Philipp.Gesang@alumni.uni-heidelberg.de>:

> ···<date: 2012-12-15, Saturday>···<from: Sietse Brouwer>···
> 
>>>> \begingroup
>>>> \grabbufferdata[simplesteps][startframe][stopframe]%
>>>> }
>>> 
>>> With the \grabbufferdata command the content beginning from \startframe until \stopframe is stored in a buffer with the name “simplesteps”.
>> 
>> (1) What does the \begingroup do? I could not find a \endgroup in the
>> patch, nor in the module code.
> 
> It’s in the definition of \buff_stop in buff-ini.mkiv. The first
> thing \startbuffer does is to insert a bgroup, too.

The \begingroup shouldn’t be here because the buffer code does end all groups it opens
and the extra group you open is never closed.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15 12:07           ` Wolfgang Schuster
@ 2012-12-15 12:34             ` Philipp Gesang
  0 siblings, 0 replies; 25+ messages in thread
From: Philipp Gesang @ 2012-12-15 12:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1051 bytes --]

···<date: 2012-12-15, Saturday>···<from: Wolfgang Schuster>···

> 
> Am 15.12.2012 um 11:40 schrieb Philipp Gesang <Philipp.Gesang@alumni.uni-heidelberg.de>:
> 
> > ···<date: 2012-12-15, Saturday>···<from: Sietse Brouwer>···
> > 
> >>>> \begingroup
> >>>> \grabbufferdata[simplesteps][startframe][stopframe]%
> >>>> }
> >>> 
> >>> With the \grabbufferdata command the content beginning from \startframe until \stopframe is stored in a buffer with the name “simplesteps”.
> >> 
> >> (1) What does the \begingroup do? I could not find a \endgroup in the
> >> patch, nor in the module code.
> > 
> > It’s in the definition of \buff_stop in buff-ini.mkiv. The first
> > thing \startbuffer does is to insert a bgroup, too.
> 
> The \begingroup shouldn’t be here because the buffer code does end all groups it opens
> and the extra group you open is never closed.

Argh, yes of course, there it is: “\end occurred inside group.”
Tracing back I think it’s a leftover. Thanks for checking!

Philipp


[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15 10:28       ` Sietse Brouwer
                           ` (2 preceding siblings ...)
  2012-12-15 11:44         ` Marco Patzer
@ 2012-12-15 12:38         ` Wolfgang Schuster
  2012-12-15 16:47           ` Sietse Brouwer
  3 siblings, 1 reply; 25+ messages in thread
From: Wolfgang Schuster @ 2012-12-15 12:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 15.12.2012 um 11:28 schrieb Sietse Brouwer <sbbrouwer@gmail.com>:

>>> \begingroup
>>> \grabbufferdata[simplesteps][startframe][stopframe]%
>>> }
>> 
>> With the \grabbufferdata command the content beginning from \startframe until \stopframe is stored in a buffer with the name “simplesteps”.
> 
> (1) What does the \begingroup do? I could not find a \endgroup in the
> patch, nor in the module code.
> 
> (2) I've approximately documented grabbufferdata here:
> http://wiki.contextgarden.net/Command/grabbufferdata
> But when I tried to write a minimal example, I couldn't get it to compile.
> 
> %% begin example
> \grabbufferdata[mybuffer][thisisthestart][thisistheend]
> \thisisthestart
> My friend, you would not tell with such high zest
> To children ardent for some desparate glory,
> The old Lie: Dulce et decorum est
> Pro patria mori.
> \thisistheend
> 
> \typebuffer[mybuffer]
> %% end example
> 
> What am I doing wrong? And is the description I put on the wiki correct?


The \grabbufferdata command reads only all text until the end command (e.g. \thisistheend)
but the beginning command for the buffer (e.g. thisisthestart) has to be defined by the user.

You have to give the name of begin command because context has to know it when buffers
are nested (I will a explanation about this in another thread).

\starttext

\def\thisisthestart
  {\grabbufferdata[mybuffer][thisisthestart][thisistheend]}

\thisisthestart
My friend, you would not tell with such high zest
To children ardent for some desparate glory,
The old Lie: Dulce et decorum est
Pro patria mori.
\thisistheend

\typebuffer[mybuffer]

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: New module: simplesteps.
  2012-12-15 12:38         ` Wolfgang Schuster
@ 2012-12-15 16:47           ` Sietse Brouwer
  0 siblings, 0 replies; 25+ messages in thread
From: Sietse Brouwer @ 2012-12-15 16:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you both, Philipp and Wolfgang, I've updated the wiki.

Wolfgang wrote:
> You have to give the name of begin command because context has to know it when buffers
> are nested (I will a explanation about this in another thread).

Ah, I was wondering about that. Yes, I'd be interested in the
background explanation.
Cheers,
Sietse

On Sat, Dec 15, 2012 at 1:38 PM, Wolfgang Schuster
<wolfgang.schuster@gmail.com> wrote:
>
> Am 15.12.2012 um 11:28 schrieb Sietse Brouwer <sbbrouwer@gmail.com>:
>
>>>> \begingroup
>>>> \grabbufferdata[simplesteps][startframe][stopframe]%
>>>> }
>>>
>>> With the \grabbufferdata command the content beginning from \startframe until \stopframe is stored in a buffer with the name “simplesteps”.
>>
>> (1) What does the \begingroup do? I could not find a \endgroup in the
>> patch, nor in the module code.
>>
>> (2) I've approximately documented grabbufferdata here:
>> http://wiki.contextgarden.net/Command/grabbufferdata
>> But when I tried to write a minimal example, I couldn't get it to compile.
>>
>> %% begin example
>> \grabbufferdata[mybuffer][thisisthestart][thisistheend]
>> \thisisthestart
>> My friend, you would not tell with such high zest
>> To children ardent for some desparate glory,
>> The old Lie: Dulce et decorum est
>> Pro patria mori.
>> \thisistheend
>>
>> \typebuffer[mybuffer]
>> %% end example
>>
>> What am I doing wrong? And is the description I put on the wiki correct?
>
>
> The \grabbufferdata command reads only all text until the end command (e.g. \thisistheend)
> but the beginning command for the buffer (e.g. thisisthestart) has to be defined by the user.
>
> You have to give the name of begin command because context has to know it when buffers
> are nested (I will a explanation about this in another thread).
>
> \starttext
>
> \def\thisisthestart
>   {\grabbufferdata[mybuffer][thisisthestart][thisistheend]}
>
> \thisisthestart
> My friend, you would not tell with such high zest
> To children ardent for some desparate glory,
> The old Lie: Dulce et decorum est
> Pro patria mori.
> \thisistheend
>
> \typebuffer[mybuffer]
>
> \stoptext
>
> Wolfgang
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-12-15 16:47 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-13 22:56 New module: simplesteps Andre Caldas
2012-12-14  1:04 ` Philipp Gesang
2012-12-14 11:21   ` Andre Caldas
2012-12-14 12:50     ` Wolfgang Schuster
2012-12-14 15:43       ` Andre Caldas
2012-12-14 16:02         ` Wolfgang Schuster
2012-12-14 16:18           ` Andre Caldas
2012-12-14 16:34             ` Wolfgang Schuster
2012-12-14 16:38               ` Andre Caldas
2012-12-14 17:32                 ` Philipp Gesang
2012-12-14 20:35                   ` Andre Caldas
2012-12-14 20:57     ` Otared Kavian
2012-12-14 22:26       ` Andre Caldas
2012-12-14 23:07   ` Andre Caldas
2012-12-15  6:02     ` Wolfgang Schuster
2012-12-15 10:28       ` Sietse Brouwer
2012-12-15 10:40         ` Philipp Gesang
2012-12-15 12:07           ` Wolfgang Schuster
2012-12-15 12:34             ` Philipp Gesang
2012-12-15 11:30         ` Andre Caldas
2012-12-15 11:44         ` Marco Patzer
2012-12-15 12:38         ` Wolfgang Schuster
2012-12-15 16:47           ` Sietse Brouwer
2012-12-15 11:49       ` Hans Hagen
2012-12-15 12:03         ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).