jelovirt / pdf-generator

DITA-OT PDF plug-in generator
https://dita-generator.elovirta.com/
Apache License 2.0
12 stars 5 forks source link

Add schema for theme files #89

Closed jelovirt closed 1 year ago

jelovirt commented 2 years ago

Add JSON schema for theme files. The schema file can be associated to a theme file with ´$schema´ key.

{
  "$schema": "../../../main/resources/schema.json",

  "page": {
    "size": "A4"
  }
}

Some editors support JSON schema validation of YAML files

$schema: ../../../main/resources/schema.json

page:
  size: A4
infotexture commented 1 year ago

@jelovirt Looks like the schema is stricter than the actual parser, as it rejects as invalid various constructs in the DITA-OT docs theme that work in practice.

For example, when validating with this schema in oXygen, it complains about all of the $brand-color-… variables, and chokes on things like start-indent: '6pt + from-parent(start-indent)'.

I'm happy to correct any syntax errors in the docs sample, but at first glance, I'm not sure if I can trust the schema.

jelovirt commented 1 year ago

@infotexture Yes, that's a problem with the schema. I don't really know how to solve it, because the schema would have to be so lax that it will end up allowing invalid constructs.