The CSV download that #1920 added names its file after the table's id, so a page with three tables produces needtable-index-0-table_node.csv, needtable-index-1-table_node.csv, needtable-index-2-table_node.csv β deterministic and documented in design/needstable-contract.md, but not what a reader would name them.
Proposed: when the table has a <caption> (the needtable directive's argument), derive the file name from it (lower-cased, whitespace and punctuation collapsed to -, length-capped), falling back to the id. The csv() / downloadCsv() pair in libs/html/needstable.js is where the name is chosen; tests/test_needstable_js.py::test_csv_download_bytes is the test to extend. This is a contract-level change (the file name is specified), so bump NEEDSTABLE_VERSION and note it in the design document.
Follow-up from #1920.
The CSV download that #1920 added names its file after the table's
id, so a page with three tables producesneedtable-index-0-table_node.csv,needtable-index-1-table_node.csv,needtable-index-2-table_node.csvβ deterministic and documented indesign/needstable-contract.md, but not what a reader would name them.Proposed: when the table has a
<caption>(the needtable directive's argument), derive the file name from it (lower-cased, whitespace and punctuation collapsed to-, length-capped), falling back to the id. Thecsv()/downloadCsv()pair inlibs/html/needstable.jsis where the name is chosen;tests/test_needstable_js.py::test_csv_download_bytesis the test to extend. This is a contract-level change (the file name is specified), so bumpNEEDSTABLE_VERSIONand note it in the design document.Follow-up from #1920.