Re: [NTG-context] Simplified input for natural tables
Hello Hraban, Simplified table syntax is much appreciated! Thank you for http://wiki.contextgarden.net/wikitable. However, I cannot understand how to use it. :) Best, Vyatcheslav
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
participants (2)
-
Vyatcheslav Yatskovsky
-
Wolfgang Schuster