Re: meta-data in the VTT file header, a strawman proposal

On Tue, Feb 28, 2012 at 4:39 AM, David Singer <singer@apple.com> wrote:
>>
>> Message-Header style gives us another way to escape continued lines,
>> which is to indent them with whitespace. This isn't any harder
>> programmatically, but is easier to read. (You did it anyway in your
>> example!) Might be more confusing to debug blank line escapes though.
>
> Yes. I also toyed with SMTP-like multi-line (no opening bracket, and the end is a period on a line by itself), but I don't think that's so easy to read, visually, and seems more error-prone.  Few people read SMTP input; people do expect to read VTT files.  I am guessing that for many cases, no escaping at all will be needed (']]' on a line by itself is pretty unlikely in CSS, as are lines starting with \, and stylesheets don't need to have blank lines).
>
>>
>>> Examples:
>>>
>>> kind=captions examplecompany-test = for steve
>>> initialTStimestamp=162642774
>>> stylesheetURL=http://www.example.com/vtt-plain.css stylesheet=
>>> [[ p { font-size: 100px; } \ p::first-line { background:
>>> url(http://www.w3.org/StyleSheets/TR/logo-REC) no-repeat;
>>> font-size: 10px; span { border-left: solid 1em black; } } ]]
>>> srclang=en-US label=Zeroes for King!
>>
>> My suggestion would look like:
>>
>> Kind: captions
>> X-examplecompany-test: for steve
>> Timestamp-offset: 162642774
>> StylesheetURL: http://www.example.com/vtt-plain.css
>> Style:
>> p { font-size: 100px; }
>>
>> p::first-line {
>>   background: url(http://www.w3.org/StyleSheets/TR/logo-REC) no-repeat;
>>   font-size: 10px;
>>   span { border-left: solid 1em black; }
>> }
>> srclang: en_US
>> Label: 𝟎s for 王!
>>
>
> what terminates the block, in your syntax?

A line that starts without white space is not part of a block,
according to RFC822 (it's called "folding").

I actually think it's more easily readable than the "[[ ... ]]" escape
mechanism and does not require us to escape any further characters
(such as if  "]]" was required as part of the value of an attribute).

Also, plenty of parsers already exist for RFC822 headers, e.g.

http://docs.python.org/library/rfc822.html (python)
http://php.net/manual/en/function.imap-rfc822-parse-headers.php (php)
https://github.com/mikel/mail (ruby)
http://www.courier-mta.org/maildrop/rfc822.html (C)

and there are likely already libraries included in the browsers that support it.

Finally, the conversion to a JavaScript Dictionary as proposed by
Glenn would be trivial and not require removal of the "[[..]]" escape
characters.

So, I guess, overall I would probably prefer the RFC822 format.

Cheers,
Silvia.

Received on Tuesday, 10 April 2012 05:38:29 UTC