SWI-Prolog/swish

Using graphviz in client side

Closed this issue · 1 comments

Hi @JanWielemaker

I'm trying to develop a html example which render the result of a pengine request by using graphviz 🌵
See more on this pull request: #63
So, i saw you already developed some javascript to do it.
However, i'm getting troubles to integrate this example with what you did since i'm not soo expert on javascript.
Could you please help me in howto use what you did here: answer.js in my html script?

Best Regards,
Silvio

If I understand you correctly you basically want to reuse a minimal part of SWISH without making it look like SWISH, no? Not sure how easy that is. It might be worth a try and might require some work to relax dependencies inside swish. I'm happy to give pointers and/or merge pull requests that achieve this.

SWISH's answer handling is in runner.js, handleSuccess(), which eventually calls the method
renderAnswer. In the end that boils down to creating a div with class answer and calling

$(div).prologAnswer(answer);

It might be that simple, but I'm not entirely convinced.

P.s. This isn't a pull request on SWISH. I'm happy that this is discussed here, but please turn this into an issue rather than a pull request. I'll close the pull request.

P.s. You can quite easily make SWISH not look like SWISH. Just create a notebook with a single HTML cell. There you can define your entire application, using all SWISH' infrastructure. The only SWISH part visible is the top navigation bar and the hamburger menu. You simply disable these using a CSS rule in your HTML cell.