On Sat, May 1, 2010 at 8:39 PM, Brad Baxter <bmb@mail.libs.uga.edu> wrote:
On Fri, Apr 30, 2010 at 2:36 PM, Ingy dot Net <ingy@ingy.net> wrote:
> On Sat, May 1, 2010 at 12:21 AM, William Spitzak <spitzak@rhythm.com> wrote:
>> Brad Baxter wrote:
>>> I, for one, would welcome this.
>>> Forgive me for spotting trivia, but the lines
>>> below don't seem to match.  Is that just a typo,
>>> or is there something significant I'm missing.
>>> "notes": ".!!! Awesome !!!",
>>> "notes": ".... add note here ...",
>>> notes: '!!! Awesome !!!'
>>> notes: ... add note here ...
>> He is using a leading dot to quote the next character. Otherwise it would
>> be impossible to make a tag that starts with '!' or '&'.

I suspect my understanding is shallow and logic flawed, but
I'm not sure why the string would need escaping if yaml would
understand it.

For example, the above ought to be just

"notes": "'!!! Awesome !!!'",
"notes": "... add note here ...",

The base encoding is not yaml, it's json. I need to repurpose strings that begin with a ! & or *. So in the rare case that an actual json string begins with one of those, I need to escape it. I do that by putting a '.' in front. Then I make the rule that in JSYNC, a '.' at the start of a string is removed. Therefore I need to encode the string '...' as "....". That's a simple rule. I could make things more complicated by saying I only remove a leading '.' if it comes before a ! & or *, but that seems a little too precious to me.

Make sense?
because yaml would understand them, and ...

> Note that the escape char is the leading char, *after* extra syntax is
> removed.
> [ "!type .&content" ]
> is:
> --- !type '&content'

... the above could be

[ "!type '&content'" ]

I suppose this could also work

[ "!type \"&content\"" ]

but I'm not sure it would ever be needed if
JSON's character notations (vs. YAML's
double-quoted ones) are sufficient.

Single quotes are an option, but I would only add them at the start, like in "'!!!" and "!type '&content".

Hmm, I don't like the ' next to ". Very hard to read. ".!!!" and "!type .&content" read better.

As an escape mechanism, I would find
single quotes much easier to spot.

See original caveat.  :-)