Expand description
Table rendering and multi-source loading for sheeter view.
expand reads a file, detects its format, decodes it into the canonical
hub, and returns one (label, value) entry per logical table. For
single-table formats (CSV, TSV, JSON, NDJSON, YAML, XML, TOML, single-table
SQL) the label is the filename stem. For XLSX and ODS, every sheet becomes
its own entry, labelled <stem> (<sheet>).
render produces either a sequence of formatted tables (one per entry)
or a JSON document. With to_json = false, each entry is prefixed with
Output table No. N — <label> and rendered as a UTF-8 box table. With
to_json = true and exactly one entry, the raw hub JSON is emitted; with
multiple entries, a JSON object keyed by label is emitted.
§Examples
use sheeter_engine::view;
use std::fs;
let dir = tempfile::tempdir().unwrap();
fs::write(dir.path().join("a.csv"), "name,age\nAlice,30\n").unwrap();
let expanded = view::expand(dir.path().join("a.csv").to_str().unwrap()).unwrap();
assert_eq!(expanded.len(), 1);
assert_eq!(expanded[0].0, "a");
let rendered = view::render(expanded, false).unwrap();
assert!(rendered.contains("Output table No. 1"));
assert!(rendered.contains("Alice"));