Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace newlines in a platform-independent way #51

Closed
sualeh opened this issue Feb 18, 2018 · 0 comments
Closed

Replace newlines in a platform-independent way #51

sualeh opened this issue Feb 18, 2018 · 0 comments

Comments

@sualeh
Copy link

sualeh commented Feb 18, 2018

@nidi3 - great library! Unfortunately, I cannot build yet, or I would have submitted a patch.

I am reading a DOT file, and then using a JavaScript engine to generate a graph image. My code is roughly

Graphviz.useEngine(new GraphvizV8Engine(), new GraphvizJdkEngine());
Graphviz.fromFile(dotFile).render(format).toFile(outputFile);

If the DOT file has newlines, this will fail. Please could you make the following modification on my behalf?
In guru.nidi.graphviz.engine.AbstractJsGraphvizEngine, replace newlines in a platform-independent way:

protected String jsEscape(String js) {
		return js.replace("\\R", " ").replace("\\", "\\\\").replace("'", "\\'");
}
@nidi3 nidi3 closed this as completed in 7232d03 Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant