On 10 Oct 2019, at 20:49, Dru Kepple wrote:
Let's suppose I have a command written in Ruby, that is outputting to HTML in a new window.
Is there a way to create a link in the HTML output that, when clicked, will actually execute a Ruby function that I define in the command?
Not functions from your command, but you can have JavaScript call ruby scripts, so you would have to create an external script (in the `Support/` folder of the bundle) and then provide argument when calling this script, as to what function it should execute.
The documentation is rather sparse: https://macromates.com/textmate/manual/html-output#javascript-api
Basically you can do `<script>TextMate.system(«command»)</script>` in your HTML output to call `«command»`.
We have a few examples of this, for example ⌃H in a ruby file on a word will lookup documentation (`ri`) for that word, and there will be links in the output which calls `ri` again.
The script for this is here: https://github.com/textmate/ruby.tmbundle/blob/master/Support/bin/linked_ri....