As noted in the intro to Accessible footnotes with HTML and CSS, I’m using WordPress to manage the contents of this web site. Searching for an offline content manager, I found MarsEdit was consistently praised as both powerful and effective.
Among other features, MarsEdit offers support for AppleScript and intelligent macros using what it calls Text Markup. Combining these two features offers users advanced tools for speeding up their workflow.
In the case of footnotes, I’m using a combination of AppleScript and Text Markup to reduce the process to two simple steps.
- AppleScript creates a unique link and identifier from a selection of text.
<sup><a href="#63911" id="fn1" title="see footnote 1">1</a></sup>
AppleScript then creates the unique identifier and return link. This reference is stored in the clipboard.
<li id="63911">FOOTNOTE <a href="#fn1" title="return to article">↑</a></li>
- Text Markup creates the footnote code block and includes the stored text from the clipboard.
<div id="footnote"> <ol> <li id="63911">FOOTNOTE <a href="#fn1" title="return to article">↑</a></li> </ol> </div>
What the “Create Footnote” AppleScript does
- Check if MarsEdit has a post window open
- If no post window is open, return an error message
- Check if post window contains a text selection
- If no text is selected, return an error
- Store the selection as a variable
- Store the date and time as a unique identifier
- Replace the selected text with unique link and identifier
- Update clipboard with unique identifier and return link
Download: Create Footnote Applescript
What the “Footnote Block” Text Markup does
- Generate a block of html code
- Add the contents of the clipboard to the code block
- Paste the complete code into the post window
Text Markup can’t be exported but the process to create a new macro is simple:
- Open a post in MarsEdit
- Select Edit in the Text Markup menu
- Click the “+” symbol in the window that opens
- Name your new macro “Footnote Block”
- Enter the following Text Markup into the Opening field and click “Ok”
Footnote Block macro
<div id="footnote"> <ol> #pastetext# </ol> </div>
Generating footnotes with AppleScript and MarsEdit
Part 1: Setup
- Download the Create Footnote Applescript.
- Copy the file to your MarsEdit/Scripts folder (to find the folder, click the AppleScript icon in MarsEdit and select “Open Scripts Folder”).
- Create the Foonote Block macro in MarsEdit using the instructions above.
Part 2: Usage
- Open a post in MarsEdit and make a text selection.
- Choose “Create Footnote” from the AppleScript menu.
- Move the cursor to a new location and select “Footnote Block” from the Text Markup menu.
- To create additional footnotes, skip the Text Markup step and paste the stored clipboard item in the ordered list.
This demo video shows how AppleScript and MarsEdit is used with the methods above to create HTML footnotes.
Watch: Create Footnote demo video