Am 03.10.24 um 14:15 schrieb Wolfgang Schuster:
%%%% begin example \setuplayout[tight]
\setuppapersize[A8,landscape]
\starttext
\startbuffer[cattle] "Year","Cattle, total","Dairy cows" "2009","3968","1489" "2010","3975","1479" "2011","3885","1470" "2012","3879","1484" "2013","4000","1553" "2014","4068","1572" "2015","4134","1622" "2016","4251","1745" "2017","4096","1694" \stopbuffer
% \savebuffer [list=cattle,prefix=no,file=cattle.csv]
\startluacode
local csvsplitter = utilities.parsers.rfc4180splitter()
local tablecontent, tableheader = csvsplitter(buffers.getcontent("cattle"),true) -- local tablecontent, tableheader = csvsplitter(io.loaddata("cattle.csv"),true)
context.bTABLE{ split = "repeat" } context.bTABLEhead() context.bTR() for _, tablecell in next, tableheader do context.bTH() context(tablecell) context.eTH() end context.eTR() context.eTABLEhead() context.bTABLEbody() for _, tablerow in next, tablecontent do context.bTR() for _, tablecell in next, tablerow do context.bTD() context(tablecell) context.eTD() end context.eTR() end context.eTABLEbody() context.eTABLE()
\stopluacode
\stoptext %%%% end example
This works perfectly with commas and doublequotes. Is it possible to configure the splitter so that it works with semicolons as column separator and no char as data separator? Something like: foo;bar;baz second foo; second bar; second baz TIA juh