Am 24.06.2015 um 07:41 schrieb David Kastrup: > Urs Liska <u...@openlilylib.org> writes: > >> Hey all, >> >> I'm testing a way to integrate syntax highlighted LilyPond code in a >> GitBook book. I'm quite happy so far with everything (particularly >> because I could finally pick up an idea that might eventually lead to >> colored code examples in the LilyPond manuals). > > Not likely: we are not going to run server-side on-demand colorization. > Too expensive.
I probably wasn't explicit enough. At the core of this function is a Python script that calls python-ly (which can be installed through pip). What I'm thinking about is integrating this script in the doc build process, which should definitely be worth the effort and "cost" IMO. > >> But I'm stuck with the problem of getting to the highlighted HTML out of >> the function and back into the book. The problem is obviously related to >> asynchronuous function calling, which I simply don't understand well >> enough (well, I don't really know JavaScript/Node.js). >> >> I'd be glad if someone with the relevant experience could have a look at >> this: >> https://git.ursliska.de/openlilylib/book/commit/e37710bf6523536aaff7b17ba67b9fcc2718f6da >> >> It's somewhat sketchy, not everything expresses my real ideas. >> I assume that when line 87 tries to read the temporary file this hasn't >> been written by the called Python script yet. > > I have no clue about JavaScript, but if the Exec call returns a "child", > you should be able to wait for completion of that child with a function > called sys.wait or similar. > > It might also be possible to make the output file a "named pipe" before > starting the program, but that's very system-specific and tricky. It > might be easier to tell the program to write its output to standard > output and find a corresponding JavaScript call that calls a program and > collects its output. > Johan's suggestion brought me to the right track already. I'll comment on that as soon as I have something to show. Urs _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user