My workflow is therefore to invoke the script, using Alfred (although you could put the script in the Bookends script folder and select it from the script menu). The script will ask for the name of the static group that I want to generate a bibliography for. This will then place a BibTex formatted bibliography in my dropbox folder that is accessible by both Pandoc (via the command line or via Marked http://marked2app.com with a custom processor command) and Editorial (using the Pandoc workflow).
If you do use the script below you need to change "/your/path" to the path where you will store your BibTex bibliography.
Another alternative to manually triggering the script is to make it run automatically by using a tool like Lingon - (although if I was doing this I would modify the script to generate a particular bibliography that I always wanted to keep up-to-date)
Code: Select all
--Applescript for generating a BibTex bibliography from Bookends
--Created by kseggleton
--Change /your/path/ to the name of the path to your BibTex files
display dialog "Enter name of group" default answer ""
set refGroup to text returned of the result
set permBibPath to "/your/path/" & refGroup & "-bibliography.bib"
set tempBibPath to "/your/path/" & refGroup & "-bibliography.bib.tmp"
tell application "Bookends"
set refList to («event ToySGUID» («event ToySRUID» refGroup) given «class RRTF»:"false", string:"BibTex") as string
end tell
do shell script "echo '" & refList & "' | tr '\\r' '\\n' >" & permBibPath
do shell script "sed -E 's/(title = )({.*})/\\1{\\2}/' " & permBibPath & " > " & tempBibPath & " && mv " & tempBibPath & " " & permBibPath