mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-20 18:10:07 +00:00
* Publish an epub of the docs on Read the Docs (#1835) Read the Docs' built-in formats support (the existing formats: all in .readthedocs.yaml) only produces epub/PDF for Sphinx projects, and is a silent no-op for MkDocs ones. Instead, per RTD's documented build-customization path, generate the epub ourselves in a post_build job and place it in $READTHEDOCS_OUTPUT/epub/, which RTD then publishes on the project Downloads page and in the docs flyout menu. The epub itself is built by the new docs/build-epub.sh: it takes the committed, generated Markdown pages in docs/src in mkdocs.yml nav order, strips the HTML-only quicklinks header from each page, and runs pandoc (installed on RTD via build.apt_packages). Locally, `make -C docs epub` does the same for anyone with pandoc installed; nothing here is part of `make dev` or any default build path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix misrender --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Quick links:
Flags
Verbs
Functions
Glossary
Release docs
# Data-cleaning examples
Here are some ways to use the type-checking options as described in the Type-checking page. Suppose you have the following data file, with inconsistent typing for boolean. (Also imagine that, for the sake of discussion, we have a million-line file rather than a four-line file, so we can't see it all at once and some automation is called for.)
cat data/het-bool.csv
name,reachable barney,false betty,true fred,true wilma,1
One option is to coerce everything to boolean, or integer:
mlr --icsv --opprint put '$reachable = boolean($reachable)' data/het-bool.csv
name reachable barney false betty true fred true wilma true
mlr --icsv --opprint put '$reachable = int(boolean($reachable))' data/het-bool.csv
name reachable barney 0 betty 1 fred 1 wilma 1
A second option is to flag badly formatted data within the output stream:
mlr --icsv --opprint put '$format_ok = is_string($reachable)' data/het-bool.csv
name reachable format_ok barney false true betty true true fred true true wilma 1 false
Or perhaps to flag badly formatted data outside the output stream:
mlr --icsv --opprint put '
if (!is_string($reachable)) {eprint "Malformed at NR=".NR}
' data/het-bool.csv
name reachable barney false betty true fred true wilma 1 Malformed at NR=4
A third way is to abort the process on first instance of bad data:
mlr --csv put '$reachable = asserting_string($reachable)' data/het-bool.csv
mlr: is_string type-assertion failed at NR=4 FNR=4 FILENAME=data/het-bool.csv