From: Aditya Mahajan <adityam@umich.edu>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Problem with Filter Module in latent context beta
Date: Tue, 17 Apr 2018 08:03:13 -0400 (EDT) [thread overview]
Message-ID: <alpine.OSX.2.20.1804170758550.36662@nqv-znpobbx> (raw)
In-Reply-To: <839d54c0-b10c-4a94-31fc-4651bcb820f8@xs4all.nl>
[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]
On Tue, 17 Apr 2018, Hans Hagen wrote:
> On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
>> All features of the filter and vim modules work with the latest beta,
>> except for one final bug: leading spaces are stripped from the buffer.
>>
>> \starttext
>>
>> \startbuffer[test]
>> Leading spaces
>> \stopbuffer
>>
>> \savebuffer[file=test-temp.tmp, prefix=no, list=test]
>>
>> \stoptext
>>
>> The leading spaces are stripped before the buffer is saved to the file
>> temp.tmp. Is it possible for the leading space NOT to be stripped? (If
>> not, I'll just document this as a feature :-).
>
> \samplefile{ward}
> \startnarrower
> \samplefile{ward}
> \startbuffer[test]
> Leading spaces
> And some more
> \stopbuffer
> \typebuffer[test]
> \stopnarrower
> \samplefile{ward}
>
> \startbuffer[test]
> Leading spaces
> And some more
> \stopbuffer
> \typebuffer[test]
>
> it is actually a feature to align the left edge relative to the least
> indented so that we can use them inside other constructs
>
> Now, as you're not afraid of low level code:
>
> \unprotect
>
> \unexpanded\def\StartAditya
> {\buff_pickup
> {Aditya}%
> {StartAditya}%
> {StopAditya}%
> {}%
> {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
> \zerocount}
This is perfect as I am already using `\grabbufferdata` in my code. I can
easily adapt it to use `\buff_pickup` instead. Thanks!.
> Does what you want but of course it's sort of ugly for a module to do that.
> What we can do is this which is still ugly but picking up verbatim is
> always ugly:
>
> \def\buff_start_indeed#1#2#3#4%
> {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%
>
> \normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}
>
> \protect
I want this to be configurable at runtime and the vim module already has
code that enables `strip=yes` and `strip=no` options (I do this via a
function in vim so that it works with both mkii and mkiv; although I don't
think that anyone uses the mkii module any longer).
Aditya
[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2018-04-17 12:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-14 12:21 Lutz Haseloff
2018-04-14 13:02 ` Aditya Mahajan
2018-04-14 15:59 ` Hans Hagen
2018-04-14 19:52 ` Lutz Haseloff
2018-04-14 22:07 ` Hans Hagen
2018-04-15 5:08 ` Aditya Mahajan
2018-04-15 10:21 ` Hans Hagen
2018-04-16 16:52 ` Aditya Mahajan
2018-04-16 17:55 ` Hans Hagen
2018-04-16 21:27 ` Aditya Mahajan
2018-04-16 21:59 ` Hans Hagen
2018-04-16 22:01 ` Aditya Mahajan
2018-04-17 8:09 ` Hans Hagen
2018-04-17 12:03 ` Aditya Mahajan [this message]
2018-04-17 17:19 ` Aditya Mahajan
2018-04-17 2:52 ` Aditya Mahajan
2018-04-17 3:48 ` Lutz Haseloff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.OSX.2.20.1804170758550.36662@nqv-znpobbx \
--to=adityam@umich.edu \
--cc=j.hagen@xs4all.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).