From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/39823 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: luatex feature question/request Date: Fri, 04 Apr 2008 10:52:55 +0200 Message-ID: <47F5EC67.9020903@elvenkind.com> References: <20080404050924.GA21356@atos.labs.wmid.amu.edu.pl> <47F5DDDF.9040304@wxs.nl> <47F5E7D3.407@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1207299201 31343 80.91.229.12 (4 Apr 2008 08:53:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Apr 2008 08:53:21 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Apr 04 10:53:53 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1JhhgF-0008E7-Mt for gctc-ntg-context-518@m.gmane.org; Fri, 04 Apr 2008 10:53:51 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 95E7F1FC1A; Fri, 4 Apr 2008 10:53:12 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23166-02; Fri, 4 Apr 2008 10:53:02 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 912C91FBDB; Fri, 4 Apr 2008 10:53:01 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5BEFF1FBDB for ; Fri, 4 Apr 2008 10:53:00 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23109-01 for ; Fri, 4 Apr 2008 10:52:55 +0200 (CEST) Original-Received: from tullamore.elvenkind.com (elvenknd.xs4all.nl [82.95.203.226]) by ronja.ntg.nl (Postfix) with ESMTP id A68FA1FB3C for ; Fri, 4 Apr 2008 10:52:55 +0200 (CEST) Original-Received: from glenlivet.elvenkind.com (glenlivet.elvenkind.com [10.10.0.6]) by tullamore.elvenkind.com (Postfix) with ESMTP id 897723050282 for ; Fri, 4 Apr 2008 10:52:55 +0200 (CEST) User-Agent: Thunderbird 2.0.0.0 (X11/20070522) In-Reply-To: X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:39823 Archived-At: luigi scarso wrote: >> There actually is a way to modify the input lines just before they >> are parsed by luatex, but that is really only suitable for converting >> 8-bit encodings to utf-8. (I was going to post an example abusing >> that method, but there are way many things that can go wrong, so I >> changed my mind) > Post it anyway. > We are all adults. If you say so ... % engine=luatex \startluacode function add_ties (line) return line:gsub(' ','~') end \stopluacode \def\startfiltered {\ctxlua {callback.register('process_input_buffer', add_ties)}} \def\stopfiltered {\ctxlua {callback.register('process_input_buffer', nil)}} \starttext \startfiltered Thus, I came to the conclusion that the designer of a new system must not only be the implementer and first large||scale user; the designer should also write the first user manual. \stopfiltered \stoptext Notice how it breaks only at hyphens? If you think that is because those are the only valid breakpoints, you are actually slightly wrong: there are still 'normal' spaces between 'system' and 'must' and between 'the' and 'designer' (because EOL is converted to a space *after* reading in the line buffer). The lua function is _much_ too simple. It will happily convert '\ ' into '\~', $a = 2~$ into $a~=~2~$, and "\TEX is" into "\TEX~is". Best wishes, Taco ___________________________________________________________________________________ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________