From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/48097 Path: news.gmane.org!not-for-mail From: John Devereux Newsgroups: gmane.comp.tex.context Subject: Re: Simplified input for natural tables Date: Sun, 08 Mar 2009 19:10:24 +0000 Message-ID: <87k56zhlun.fsf@cordelia.devereux.me.uk> References: <1C61EC31-CF0E-4A26-9EA9-2B26C14116CD@gmail.com> <49B3F93F.5080707@wxs.nl> <87ocwbhoyc.fsf@cordelia.devereux.me.uk> <49B41021.5090000@wxs.nl> 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 1236539480 30924 80.91.229.12 (8 Mar 2009 19:11:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Mar 2009 19:11:20 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Mar 08 20:12:36 2009 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 1LgOQN-0004F1-Va for gctc-ntg-context-518@m.gmane.org; Sun, 08 Mar 2009 20:12:36 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CE5741FB1F; Sun, 8 Mar 2009 20:11:08 +0100 (CET) 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 03637-05-8; Sun, 8 Mar 2009 20:10:46 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 06F441FADB; Sun, 8 Mar 2009 20:10:46 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 96BEF1FADB for ; Sun, 8 Mar 2009 20:10:44 +0100 (CET) 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 03637-05-7 for ; Sun, 8 Mar 2009 20:10:34 +0100 (CET) Original-Received: from filter4-nij.mf.surf.net (filter4-nij.mf.surf.net [195.169.124.155]) by ronja.ntg.nl (Postfix) with ESMTP id 945881FA41 for ; Sun, 8 Mar 2009 20:10:34 +0100 (CET) Original-Received: from cordelia.devereux.me.uk (devereux.me.uk [217.169.15.178]) by filter4-nij.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n28JATa2016764 for ; Sun, 8 Mar 2009 20:10:32 +0100 Original-Received: from [217.169.15.178] (helo=cordelia.devereux.me.uk ident=jd) by cordelia.devereux.me.uk with esmtp (Exim 4.69) (envelope-from ) id 1LgOOH-0004yH-FU for ntg-context@ntg.nl; Sun, 08 Mar 2009 19:10:25 +0000 In-Reply-To: <49B41021.5090000@wxs.nl> (Hans Hagen's message of "Sun\, 08 Mar 2009 19\:36\:17 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=217.169.15.178; country=GB; region=L6; city=Much Wenlock; latitude=52.6000; longitude=-2.5500; http://maps.google.com/maps?q=52.6000,-2.5500&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 190304234 - 5afae889ae09 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.155 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.11 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:48097 Archived-At: Hans Hagen writes: > John Devereux wrote: >> Hans Hagen writes: >> >> >> [...] >> >> Hi Hans, >> >> Is there any possible way to use the wiki-style tables like: >> >> ^ Heading 1 ^ Heading 2 ^ >> | Item 1 | Item 2 | >> | Item 3 | Item 4 | >> >> (Probably with some wrapper) >> >> Perhaps this boils down to asking if it is possible to (re)define >> "special" characters, within a region of text. > > doing that in the running text is asking for troubles (catcode mess) > > if there is real interest in that kind of stuff we can make a module > that does something > > \starttext > > \startluacode > function commands.wiki_to_table(str) -- wrong namespace > str = string.gsub(str,"%^ *[\n\r]","\\NC\\NR\n") > str = string.gsub(str,"%^","\\NC ") > str = string.gsub(str,"| *[\n\r]","\\NC\\NR\n") > str = string.gsub(str,"|","\\NC ") > tex.sprint(tex.ctxcatcodes,"\\startTABLE") > tex.sprint(tex.ctxcatcodes,str) > tex.sprint(tex.ctxcatcodes,"\\stopTABLE") > end > \stopluacode > > \def\startwikitable > {\bgroup > \obeylines > \dostartwikitable} > > \long\def\dostartwikitable#1\stopwikitable > {\ctxlua{commands.wiki_to_table([[\detokenize{#1}]])}% > \egroup} > > \startwikitable > ^ Heading 1 ^ Heading 2 ^ > | Item 1 | Item 2 | > | Item 3 | Item 4 | > \stopwikitable > > \startTABLE > \NC Text 1 \NC Text 2 \NC \NR > \NC Text 3 \NC Text 4 \NC \NR > \stopTABLE > > \stoptext That appears to be exactly what I was after! (Sorry I don't have MKIV set up right now but will try it when I can). I don't know if it is of general interest. I find that writing documents for context - once you get used to it - is much nicer than using a wordprocessor. But the process of entering tables remains tedious and error prone, compared to e.g. the Word equivalent that many will be used to. -- John Devereux ___________________________________________________________________________________ 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 ___________________________________________________________________________________