[NTG-context] Re: combining \definetyping and \definebuffer

2023-07-30 Thread Henning Hraban Ramm

Am 29.07.23 um 23:16 schrieb Hans Hagen:

On 7/29/2023 10:35 PM, Henning Hraban Ramm wrote:


The setup for MyCode is not applied to \typeMyBuffer, and I don’t know 
how it could; something like \typeMyBuffer[MyCode] doesn’t work.


These commands inherit from buffer, so \setupbuffer will work. But as I 
need to prevent you to come up with some ugly hack (after all your 
upcoming book should be hack free) ...


;-D

I’m not sure my book will even go so deep, it’s already too big and will 
never contain everything I’d like it to.
For the code examples therein I used some hacks (getting rid of them one 
by one), but I’m working on a module (more like a LaTeX-style document 
class) for DANTE’s DTK, to be able to write my articles about ConTeXt in 
ConTeXt and have them included as PDFs. For other authors, I’d like the 
syntax to be as simple as possible (using generic ConTeXt macros), so I 
use \setuptyping for the general style with a background box. But that 
conflicts with the setups for special cases like code and result side by 
side.

I guess I’ll also include this in the CGJ setup.

... attached an extension that supports inheritance (via category), 
still honors 'buffer' otherwise and accepts an optional category instead 
of settings. take your choice ...


You can put the patch in cont-new.mkxl assuming you wikify it too.


Thank you! Will do. I guess it’ll be in the next upload, too?

Hraban

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: combining \definetyping and \definebuffer

2023-07-29 Thread Hans Hagen

On 7/29/2023 10:35 PM, Henning Hraban Ramm wrote:

Am 29.07.23 um 22:06 schrieb Bruce Horrocks:
Your example seems to work: I see the \getbuffer[MyBuffer] command 
typed (not executed) with colour coding on the keyword and line 
numbered; then the block text fakewords from the visual module; then 
the \fakewords macro shown (again not executed) as per the default for 
typing.


The setup for MyCode is not applied to \typeMyBuffer, and I don’t know 
how it could; something like \typeMyBuffer[MyCode] doesn’t work.


These commands inherit from buffer, so \setupbuffer will work. But as I 
need to prevent you to come up with some ugly hack (after all your 
upocoming book should be hack free) ...


... attached an extension that supports inheritance (via category), 
still honors 'buffer' otherwise and accepts an optional category instead 
of settings. take your choice ...


You can put the patch in cont-new.mkxl assuming you wikify it too.

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
\unprotect \pushoverloadmode

\appendtoks
\frozen\instance\protected\edefcsname\e!type\currentbuffer\endcsname
  
{\buff_verbatim_type_defined_buffer[\currentbuffer][\currentdefinedbuffer]}%
\to \everydefinebuffer

\tolerant\protected\def\buff_verbatim_type_defined_buffer[#1]#*[#2]#*[#3]% 
category name settings
  {\begingroup
   \cdef\currenttyping{\namedbufferparameter{#1}\c!category}%
   \ifempty\currenttyping
 \let\currenttyping\v!buffer
   \fi
   \ifhastok={#3}%
 \setupcurrenttyping[#3]%
   \orelse\ifempty{#3}\else
 \cdef\currenttyping{#3}
   \fi
   \buff_verbatim_type_buffer_indeed{\currenttyping}{#2}%
   \useindentnextparameter\typingparameter
   \endgroup
   \dorechecknextindentation}

\popoverloadmode \protect

\usemodule[visual]

\definetyping[MyCode]

\setuptyping
  [MyCode]
  [option=tex,
   numbering=file]

\definebuffer
  [MyBuffer]
  [category=MyCode]

\setuptyping
  [MyBuffer]
  [option=TEX,
   numbering=file]

% \setuptyping
%   [buffer]
%   [option=TEX,
%numbering=file]

\startMyBuffer
\fakewords{10}{20}
\stopMyBuffer

\starttext

\startMyCode
\fakeword
\stopMyCode

\getMyBuffer

\typeMyBuffer

\typeMyBuffer[MyCode]

\typeMyBuffer[option=TEX]

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: combining \definetyping and \definebuffer

2023-07-29 Thread Henning Hraban Ramm

Am 29.07.23 um 22:49 schrieb Max Chernoff:

I'm on mobile now so I can't type out a complete solution, but I think that 
what you're looking for is in this file:

 
https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/documentation/unemoji-manual.mkxl

It doesn't exactly do what you specifically asked for, but I think that it's 
pretty similar to your end goal. There's a .tex file with example usage in the 
same folder and a link to the compiled PDF from the main repo page.


Thank you!
Well, I’m sure it’s in there, and it’s an impressive module, but I don’t 
understand the code – too many commands I never heard of.


I’ll try again tomorrow when my head hopefully hurts less and there 
won’t be concerts on both sides of my quarter…


Hraban

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: combining \definetyping and \definebuffer

2023-07-29 Thread Max Chernoff
I'm on mobile now so I can't type out a complete solution, but I think that 
what you're looking for is in this file:


https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/documentation/unemoji-manual.mkxl

It doesn't exactly do what you specifically asked for, but I think that it's 
pretty similar to your end goal. There's a .tex file with example usage in the 
same folder and a link to the compiled PDF from the main repo page. 

Thanks,
-- Max
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: combining \definetyping and \definebuffer

2023-07-29 Thread Henning Hraban Ramm

Am 29.07.23 um 22:06 schrieb Bruce Horrocks:

Your example seems to work: I see the \getbuffer[MyBuffer] command typed (not 
executed) with colour coding on the keyword and line numbered; then the block 
text fakewords from the visual module; then the \fakewords macro shown (again 
not executed) as per the default for typing.


The setup for MyCode is not applied to \typeMyBuffer, and I don’t know 
how it could; something like \typeMyBuffer[MyCode] doesn’t work.


Hraban

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: combining \definetyping and \definebuffer

2023-07-29 Thread Henning Hraban Ramm

Am 29.07.23 um 22:06 schrieb Bruce Horrocks:

Your example seems to work: I see the \getbuffer[MyBuffer] command typed (not 
executed) with colour coding on the keyword and line numbered; then the block 
text fakewords from the visual module; then the \fakewords macro shown (again 
not executed) as per the default for typing.


The setup for MyCode is not applied to \typeMyCode, and I don’t know how 
it could; something like \typeMyBuffer[MyCode] doesn’t work.


Hraban

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: combining \definetyping and \definebuffer

2023-07-29 Thread Bruce Horrocks
Your example seems to work: I see the \getbuffer[MyBuffer] command typed (not 
executed) with colour coding on the keyword and line numbered; then the block 
text fakewords from the visual module; then the \fakewords macro shown (again 
not executed) as per the default for typing.

What were you exepcting if not this?

(onTeXt  ver: 2023.07.18 22:07 LMTX)

> On 29 Jul 2023, at 20:09, Henning Hraban Ramm  wrote:
> 
> Hi,
> I’d like to use a custom buffer ("MyBuffer") to use a custom typing style 
> ("MyCode"). How does that work?
> 
> 
> """
> \usemodule[visual]
> 
> \definetyping[MyCode]
> 
> \setuptyping[MyCode][
>  option=tex,
>  numbering=file,
> ]
> 
> \definebuffer[MyBuffer]
> 
> \startMyBuffer
> \fakewords{10}{20}
> \stopMyBuffer
> 
> \starttext
> 
> \startMyCode
> \fakeword
> \stopMyCode
> 
> \getMyBuffer
> 
> \typeMyBuffer
> 
> \stoptext
> """

—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___