cl-yaml
cl-yaml copied to clipboard
emit with block styles instead of flow styles
Given this input:
---
title: ABBOTT, Fernando
autor:
- Izabel Noll
cargos:
- const. 1891
- gov. RS 1891
- dep. fed.RS 1891-1892
- gov. RS 1892-1893
- dep.fed. RS 1893-1894
- emb. Bras. Argentina 1894-1897
---
We can only dump the flow styles:
TEST> (cl-yaml:emit (cl-yaml:parse #P"1.tmp") *standard-output*)
{ cargos: [const. 1891, gov. RS 1891, dep. fed.RS 1891-1892, gov. RS 1892-1893, dep.fed. RS 1893-1894, emb. Bras. Argentina 1894-1897], autor: [Izabel Noll], title: ABBOTT, Fernando }
It would be nice to output the block styles too! Any idea? How difficult would be to extend the library for produce it?
Please also note that in the flow styles I believe the strings with commas must be protected with double-quote, right? The parse of the output above would give us a wrong result, see the title key being splitted:
TEST> (alexandria:hash-table-alist (cl-yaml:parse "{ cargos: [const. 1891, gov. RS 1891, dep. fed.RS 1891-1892, gov. RS 1892-1893, dep.fed. RS 1893-1894, emb. Bras. Argentina 1894-1897], autor: [Izabel Noll], title: ABBOTT, Fernando }"))
(("Fernando" . "") ("title" . "ABBOTT") ("autor" "Izabel Noll")
("cargos" "const. 1891" "gov. RS 1891" "dep. fed.RS 1891-1892" "gov. RS 1892-1893" "dep.fed. RS 1893-1894" "emb. Bras. Argentina 1894-1897"))
Oh yes, the emitter is very low effort. We definitely need to have a way to emit things in the pretty human-readable style.
+1