asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
https://kroki.io/
MIT License
149 stars 50 forks source link

Include in Activity Diagram does not work ( due to "\r" ) #379

Closed mijlouis closed 2 years ago

mijlouis commented 2 years ago

Hello, first of all thanks for this amazing tool. It is very helpful.

Today I came across an issue on Windows where I try to include a stylesheet in an activity diagram. It it related to #201. As I have found out, the path to the included file gets not resolved due to "\r" at line end of include reference.

Error message :

' caused an error:sing of PlantUML include, because reading the referenced local file 'stylesheet.iuml 'rror: ENOENT: no such file or directory, open 'stylesheet.iuml

Please see attached sample project.

asciidoctor-kroki_cr-issue_01

The issue can be tracked down in node_modules/asciidoctor-kroki/src/preprocess.js line 125 as shown in above screen shot.

Maybe it is not the best place to fix it as shown in above screen shot but at least with the modification there it works. Could you please check and maybe fix it where appropriate?

Thanks and Best Regards

Sample Project: adoc-web_cr-issue.zip

ggrossetie commented 2 years ago

Hey!

Good catch, I think we should use \s (any space character equivalent to [\r\n\t\f\v \u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]) instead of \\.

Do you want to submit a pull request? Ideally, we should add a test case in: https://github.com/Mogztter/asciidoctor-kroki/blob/master/test/preprocess.spec.js to make sure that the fix is working as expected.

mijlouis commented 2 years ago

Hello @Mogztter, I have created a pull request. Hopefully you are fine with the changes :-) Thanks and Best Regards