[NTG-context] Trimming strings and Lua string.trim question
schuster.wolfgang at gmail.com
Thu Mar 6 16:27:44 CET 2014
Am 06.03.2014 um 16:04 schrieb Rik Kabel <context at rik.users.panix.com>:
> Could you please ensure that this handles text in buffers the same way that it handles other strings? I noticed that this is handled a bit differently, as the following shows,but perhaps it is my clumsy coding. The buffer result is closer to what I expect in terms of internal whitespace, but still does not show expected trimming of leading and trailing whitespace. That trimming, of course, is the point of the exercise.
This can’t work because \getbuffer is a unexpandable command and what you pass to Lua is the string
and not the content of the buffer. When you want to manipulate the content of a buffer you have to access the content at the Lua side with the buffers.getcontent(…) function.
BTW: You don’t need \long in MkIV because definitions use it by default.
More information about the ntg-context