Difference between revisions of "Wikitable"
Jump to navigation
Jump to search
m (added Category:Tables) |
Latest revision as of 16:28, 10 September 2012
< Tables_Overview | TABLE >
In March 2009 on request from John Devereux, Hans Hagen provided us with another syntax for tables:
\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