From: trans. (T. Onoma) <tra...@ru...> - 2004-11-12 12:55:15
|
On Friday 12 November 2004 07:20 am, Oren Ben-Kiki wrote: | On Friday 12 November 2004 13:00, Damian Cugley wrote: | > > ... if we go Brian's way - require top-level scalars to be | > > indented - can we also change the start/end lines to be "%---" and | > > "%===" (or some other pair of lines starting with "%")? | > | > Writers need to know to quote keys starting with '%' (I recently had | > to do this in a table of units of measure, which included '%' as a | > unit). Having to do the same with '---' used as a key is just the | > same, right? | | No. The '%' is a (reserved) indicator, like '!', '|', '>', '&', '*' etc. | As such, it can't appear as the first character in a plain scalar | anywhere - not just in unindented ones. | | In contrast, we can't forbid '-' from being a leading character because | of negative numbers ("foo: -123"). So, the '---' can't start a plain | scalar only if its unindented: What's wrong with quoting it? --- "---" : Ok, quoted ... | --- | --- : Error, not indented | ... | | I'd like to avoid this special case if possible. Of all exceptions I can think of, that's about the most obvious. BTW, does '---' and '...' really have to be two different things? Why not just use '---' for both. It there is nothing but blank space below the final '---' the parser would know that it is a end stream marker. | > Consider the log-file use-case. The following fictional log is | > readable without knowing anything about YAML: | > | > --- | > date: 2004-11-12 | > message: overflow in silo 12 | > --- | > date: 2004-11-13 | > message: underflow in silo 11 | > | > Using '%---' (or even %{...%}) would be distracting at best. | | I admit that "%---" stands out more. But, this is a document boundary, | you'd expect it to stand out: | | %--- | date: 2004-11-12 | message: overflow in silo 12 | %--- | date: 2004-11-13 | message: underflow in silo 11 | %=== | | Using %{ %} is more quiet: | | %{ | date: 2004-11-12 | message: overflow in silo 12 | %{ | date: 2004-11-13 | message: underflow in silo 11 | %} | | There are a zillion more possibilities we could use. Surely we can find | one that looks good: | | %- | date: 2004-11-12 | message: overflow in silo 12 | %- | date: 2004-11-13 | message: underflow in silo 11 | %= | | %--- | date: 2004-11-12 | message: overflow in silo 12 | %--- | date: 2004-11-13 | message: underflow in silo 11 | %+++ | | %---% | date: 2004-11-12 | message: overflow in silo 12 | %---% | date: 2004-11-13 | message: underflow in silo 11 | %+++% | | %%%%% | date: 2004-11-12 | message: overflow in silo 12 | %%%%% | date: 2004-11-13 | message: underflow in silo 11 | % % % | | We could also co-opt other indicators, like ">" and "|": | | | date: 2004-11-12 | message: overflow in silo 12 | | date: 2004-11-13 | message: underflow in silo 11 | | | Hmmm. I think I like this one. Much more quiet than using '%' and still | doesn't conflict with anything. How about it? Please, no. Stick with '---'. (Oddly, my email program clobbered those last ones) T. |