connec/yaml-js

Accepting @-symbols

PatrickHeneise opened this issue · 4 comments

I'm trying to use Schema.org conform data in a markdown front matter.


---
  @context: "http://schema.org"
  @type: "Social event"
  location: 
    @type: "Place"
    address: 
      @type: "PostalAddress"
      addressLocality: "Barcelona, Spain"
      postalCode: "08001"
      streetAddress: "C/ Fontanella 2"
    name: "Mobile World Centre"

the @-signs are breaking with found character @ that cannot start any token. There's nothing in YML 1.2 spec that doesn't allow @ characters. Any chance to get this working?

Unfortunately this is a YAML 1.1 parser, which disallows indicators as the first character of plain scalars.

I'm not sure what would be involved in updating the library to YAML 1.2, I'll try and investigate soon.

Actually, it looks like YAML 1.2 has the same restriction...

You can of course make that document compliant by surrounding the @ keys with quotes:

---
  "@context": "http://schema.org"
  "@type": "Social event"
  location: 
    "@type": "Place"
    address: 
      "@type": "PostalAddress"
      addressLocality: "Barcelona, Spain"
      postalCode: "08001"
      streetAddress: "C/ Fontanella 2"
    name: "Mobile World Centre"

Thanks