From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Aditya Mahajan <adityam@umich.edu>
Subject: Re: How can I remove a blank leading line from a buffer
Date: Wed, 15 Aug 2018 09:07:37 +0200 [thread overview]
Message-ID: <a5a07649-eb8a-f8bb-0c53-07b70dcc19fd@xs4all.nl> (raw)
In-Reply-To: <alpine.OSX.2.20.1808142328570.2729@nqv-znpobbx>
On 8/15/2018 5:31 AM, Aditya Mahajan wrote:
> On Tue, 14 Aug 2018, Rik Kabel wrote:
>
>> I really think, though, that a buffers.strip function would be the way
>> to go, instead of futzing after the damage is done.
>
> In lua, buffers.getcontent('name') gives the contents of the buffer
> labelled 'name'. You can post-process this in whatever way you want. For
> example, you could write a lua function userdata.strip that strips the
> leading and ending black spaces from a string, and then call
>
> context(userdata.strip(buffers.getcontent('name)))
local s = [[
foo
bar
bar
]]
print(string.fullstrip(s))
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2018-08-15 7:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-13 3:18 Rik Kabel
2018-08-13 3:44 ` Aditya Mahajan
2018-08-13 3:46 ` Henri Menke
2018-08-13 7:02 ` Hans Hagen
2018-08-13 7:01 ` Hans Hagen
2018-08-13 14:28 ` Rik Kabel
2018-08-13 16:04 ` Wolfgang Schuster
2018-08-13 17:09 ` Rik Kabel
2018-08-13 17:46 ` Wolfgang Schuster
2018-08-13 18:27 ` Rik Kabel
2018-08-13 19:52 ` Wolfgang Schuster
2018-08-13 22:43 ` Rik Kabel
2018-08-14 14:46 ` Rik Kabel
2018-08-15 3:31 ` Aditya Mahajan
2018-08-15 7:07 ` Hans Hagen [this message]
2018-08-15 21:46 ` Rik Kabel
2018-08-16 14:55 ` Aditya Mahajan
2018-08-16 20:02 ` Rik
2018-08-13 16:15 ` Rik Kabel
2018-08-13 17:51 ` Rik Kabel
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=a5a07649-eb8a-f8bb-0c53-07b70dcc19fd@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=adityam@umich.edu \
--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).