markushedvall / plantuml-encoder

PlantUML encoder, works in browser & node.js
MIT License
106 stars 15 forks source link

Resolve PlantUML '!include' statements before encoding #11

Closed akosma closed 4 years ago

akosma commented 4 years ago

This PR provides the basic infrastructure to resolve PlantUML !include statements before encoding.

This can be useful in cases for example in complex setups such as Antora where all PlantUML files share the same configuration through an !include statement. See this issue for a practical example of what kind of problems this could solve.

I have run the npm run build command, and added some tests, they all pass.

Thanks!

akosma commented 4 years ago

Of course this PR is only meant to be used with Node.js on the command line, since it might not be feasible on a browser context.

akosma commented 4 years ago

I just realized you created node-plantuml – hopefully this PR might be useful in that context too!

akosma commented 4 years ago

Any feedback about this PR?

akosma commented 4 years ago

Hello? Anyone?

akosma commented 4 years ago

Anyone here?

anb0s commented 4 years ago

I'm facing the same problem, see https://github.com/eshepelyuk/asciidoctor-plantuml.js/issues/53#issuecomment-569049207

It would bve very usefull for usage in vscode editor plugin

How can we help to integrate this?

Thanks!

anb0s commented 4 years ago

@akosma can you provide your forked version in npm? See the issue asciidoctor-plantuml.js ? This would be perfect :)

anb0s commented 4 years ago

published from my fork as scoped package @anb0s/plantuml-encoder@1.5.1

Thanks @akosma !

markushedvall commented 4 years ago

Hi! Sorry for the long delay and thanks for contributing.

As this is for Node.js only the code should be put somewhere it will not affect the browser code. encoder.js is shared code between browser and Node.js. The easiest solution is probably to put it in index.js which is Node.js only and wrap the encode function.

I also think this feature should be behind an option that is off by default as it could potentially break usage where someone want to encode and decode while keeping the same include.

It could look something like this using an optional options object:

plantumlEncoder.encode(umlWithInclude, { resolveIncludes = true })
akosma commented 4 years ago

I'm not using this code anymore, as I found a solution to stop using asciidoctor-plantuml completely. Closing this PR.

anb0s commented 4 years ago

@akosma That is so sad, but anyway can you share the solution for other PlantUML users?