Since keyboard commands are iffy on the iPad, I figure I'll need a way to do things with the selected text, so I poke around the DW menu and there's an example using a verb that looks close, op.getLineText(). #
Normally with Drumkit snippets you just put them on a node by themselves and hit command-slash and Drummer runs it. But to test something that uses the current selection, you need a different way to call the script. #
So, enable the Scripts menu, and add the command there. Highlight a node in the outline, select Get Line Text from my new menu command, and voila, it works. In fact, you can test it on the entry in the Scripts menu itself. I love things like that.#
So, pull up Docserver and go looking for something that will get me the selection. It's got to be possible because Drummer has a "make link" icon. And there it is, op.getSelectedText(). Add that as a new command to the Scripts menu, and... the dialog box is empty, no text at all. I was all set to file a bug, but while getting repro steps—absolutely the most critical part of reporting any bug—I realized what was going on. When you tap on the Scripts menu, that takes the selection focus away from the outline, so by the time the script runs, there's nothing to select. So I can't really report that as a bug.#
But I still want to be able to do it, so let's try putting it in the Iconbar. I have no idea what icon names are available, but the top one is a big plus sign. Turns out, we do in fact have an icon named "minus", and my new "click the minus sign to show an alert dialog with the highlighted text" feature I just added to Drummer works great!#
It is going to be weird working in an outliner for code, but for short snippets I think I can get used to it. For longer stuff I think I will probably still prefer a full IDE. #
Boom! You can use an IDE for navigating that source, with function outlines and everything else. You can't run or debug code, but so far I like it much better than the regular GitHub UI for browsing and viewing project files. (Though I have to say, viewing Jupyter books inline is pretty sweet.)#
This is probably documented somewhere, but one of the things I want to use Drummer for is the ability to publish standalone pages that aren't actually blog posts. Turns out, Old School can do this! The source for Old School is up on GitHub, and what do you know, there are some functions with "standalone" in the name.#
I am extremely excited about this, because it means out of the box, more or less, Old School will do a huge chunk of stuff I was afraid I'd need to write myself.#
Since keyboard commands are iffy on the iPad, I figure I'll need a way to do things with the selected text, so I poke around the DW menu and there's an example using a verb that looks close, op.getLineText(). #
Normally with Drumkit snippets you just put them on a node by themselves and hit command-slash and Drummer runs it. But to test something that uses the current selection, you need a different way to call the script. #
So, enable the Scripts menu, and add the command there. Highlight a node in the outline, select Get Line Text from my new menu command, and voila, it works. In fact, you can test it on the entry in the Scripts menu itself. I love things like that.#
So, pull up Docserver and go looking for something that will get me the selection. It's got to be possible because Drummer has a "make link" icon. And there it is, op.getSelectedText(). Add that as a new command to the Scripts menu, and... the dialog box is empty, no text at all. I was all set to file a bug, but while getting repro steps—absolutely the most critical part of reporting any bug—I realized what was going on. When you tap on the Scripts menu, that takes the selection focus away from the outline, so by the time the script runs, there's nothing to select. So I can't really report that as a bug.#
But I still want to be able to do it, so let's try putting it in the Iconbar. I have no idea what icon names are available, but the top one is a big plus sign. Turns out, we do in fact have an icon named "minus", and my new "click the minus sign to show an alert dialog with the highlighted text" feature I just added to Drummer works great!#
It is going to be weird working in an outliner for code, but for short snippets I think I can get used to it. For longer stuff I think I will probably still prefer a full IDE. #
Boom! You can use an IDE for navigating that source, with function outlines and everything else. You can't run or debug code, but so far I like it much better than the regular GitHub UI for browsing and viewing project files. (Though I have to say, viewing Jupyter books inline is pretty sweet.)#
This is probably documented somewhere, but one of the things I want to use Drummer for is the ability to publish standalone pages that aren't actually blog posts. Turns out, Old School can do this! The source for Old School is up on GitHub, and what do you know, there are some functions with "standalone" in the name.#
I am extremely excited about this, because it means out of the box, more or less, Old School will do a huge chunk of stuff I was afraid I'd need to write myself.#
Copyright 2021 Gary Teter
Last update: Wednesday December 8, 2021; 1:56 AM EST.