Skip to content

πŸ‘Œ Name the needtable CSV download after its captionΒ #1926

Description

@chrisjsewell

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpkg: sphinx-needsThe sphinx-needs distribution (packages/sphinx-needs): its code, tests and docs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions