On 21 May 2014, at 9:43 AM, David Weinberger <[email protected]> wrote:
> I'm writing something with frequent endnotes and would like to automate how I
> insert them. I currently have a Keyboard Maestro macro that lets me insert
> [^][^]: with a keystroke. But, in a perfect world, I'd have a script in
> BBedit that lets me automate that further, possibly as follows:
>
> A keystroke pops up a dialogue box that has a field for the keyword to insert
> into the endnote markup and a field for the content of the endnote
> With a button press, that dialogue box
> creates the anchor note (e.g., [^example]) and the note itself (e.g.,
> [^example]This is an example of an endnote),
> inserts the anchor note at the current cursor position, and
> inserts the note itself at the end of the document
> (and also adds two carriage returns, as we used to call them)
> Possible? Plausible? Is there a better way?
>
> Thanks so much for any pointers or advice.
You asked for "pointers" and "advice," and this is they. It's not a worked-out
solution.
I wrote my current book (Xcode 5 Start to Finish -- cheap compared to the
riches it will bring you) in LaTeX. There were many, many chains of menu
commands, and many, many \figures. (Also a lot of short-span markup for bold,
mono, italic, and what-have-you, but that's not helpful in this case.)
The front-end problem you're trying to solve is really pretty easy once you let
go of the dialog box. I'd write a menu chain into my manuscript like: Xcode
Schemes
Edit Scheme\ellipsis
\cmd{}<
I'd select from "Xcode" to the end of the key equivalent, and invoke a text
filter I'd written. It styled each line as a UI element, and put
space-separator-space between them. If the last line began with a backslash, it
would append comma-space-(-text-)-period. The output replaced the selection.
Ruby calling out to osascript for the BBEdit selection.
I also had a \figure filter that would take an in-file keyword, find the
same-named image file (any image suffix, optionally with a numeric prefix), and
construct a standard \figure section to import the file, label the section, and
format the figure. Also, a script that takes long identifiers, camel-cased or
underscore-delimited, and \defines a macro expanding a stripped-down version of
the symbol into escaped and hyphenated markup.
Four points:
* I AM L33T!!1! BUY MY BUK!!11!!!
* (Religious brotherhood) It doesn't have to be Ruby; I just like
Smalltalk-family languages.
* (Design advice) Letting go of GUI features and taking your parameters from
document content is much easier to code and use.
* (Advocacy) You don't need a domain-specific language to have a powerful,
customizable editor. BBEdit's design (I am guessing) assumes the system already
has more-powerful, more-diverse, better-debugged processing assets than Bare
Bones could ever create or maintain.
-- F
--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].