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
___________________________________________________________________________________