lotas / contentful-graph

Visual representation of contentful content models in form of graphs
https://www.contentful.com/blog/2017/08/08/how-to-quickly-visualize-your-content-model/
MIT License
59 stars 6 forks source link

Hyphens and spaces in element names lead to syntax error with dot #5

Closed miemo closed 7 years ago

miemo commented 7 years ago

I'm getting this error message Error: <stdin>: syntax error in line 31 near '-' when running CONTENTFUL_SPACE_ID=OMITTED CONTENTFUL_MANAGEMENT_TOKEN=OMITTED node_modules/contentful-graph/import.js | dot -Tpdf > model.pdf

import.js seems to run without issues, line #31 in the output looks like this: UICOPYView:strings -> UI-COPY-String [dir=forward,label="0..*"];

So I'm wondering is the - character in the element name UI-COPY-String causing these issues? Should it be somehow escaped for dot to read correctly?

miemo commented 7 years ago

That does seem to be the issue, also would look like spaces produce similar errors. Was able to edit the script output manually into something more suitable to input to dot, but I guess these could/should be escaped with the script.

lotas commented 7 years ago

Hi @miemo, thanks for pointing this problem out! There is no escaping indeed, so it is likely a problem for such cases, will have a look. Thanks!

lotas commented 7 years ago

This was finally fixed in 45d0220f08fc2abe6f765376b6c32febbe2c5b0d I'll prepare a release soon.

Thank you for the contribution