ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Simplified input for natural tables
Date: Thu, 12 Mar 2009 19:05:11 +0100	[thread overview]
Message-ID: <45A1C304-5691-4AAD-BCAA-F82164644866@gmail.com> (raw)
In-Reply-To: <49B9430B.3070009@gmail.com>


Am 12.03.2009 um 18:14 schrieb Vyatcheslav Yatskovsky:

> Hello Hraban,
>
> Simplified table syntax is much appreciated! Thank you for http://wiki.contextgarden.net/wikitable 
> .
>
> However, I cannot understand how to use it. :)

In the same way as Hans wrote them in his exmple.

\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}

\starttext

\startwikitable
^ Heading 1 ^ Heading 2 ^
| Item 1    | Item 2 |
| Item 3    | Item 4 |
\stopwikitable

\stoptext

Wolfgang

___________________________________________________________________________________
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
___________________________________________________________________________________


  reply	other threads:[~2009-03-12 18:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 17:14 Vyatcheslav Yatskovsky
2009-03-12 18:05 ` Wolfgang Schuster [this message]
     [not found] <mailman.19.1236882597.12697.ntg-context@ntg.nl>
2009-03-12 19:51 ` Vyatcheslav Yatskovsky
2009-03-12 20:06   ` Aditya Mahajan
2009-03-12 20:19     ` Wolfgang Schuster
2009-03-13 22:13     ` Mohamed Bana
  -- strict thread matches above, loose matches on Subject: below --
2009-03-08 15:24 Wolfgang Schuster
2009-03-08 16:34 ` Aditya Mahajan
2009-03-08 16:58   ` Hans Hagen
2009-03-08 18:03     ` John Devereux
2009-03-08 18:36       ` Hans Hagen
2009-03-08 19:10         ` John Devereux
2009-03-09 13:35           ` George N. White III
2009-03-12 10:57             ` Henning Hraban Ramm
2009-03-09 12:15       ` Mojca Miklavec
2009-03-08 19:26     ` Wolfgang Schuster
2009-03-08 19:50       ` Hans Hagen

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=45A1C304-5691-4AAD-BCAA-F82164644866@gmail.com \
    --to=schuster.wolfgang@googlemail.com \
    --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).