Thanks for Adam and Christiaan's excellent pointers.

The goal here, Adam, is to integrate BibDesk with any rich-text Mac note-taking 
or journaling app (DevonTHINK, Journler, MacJournal, Scrivener, VoodooPad, 
etc.), or really any app that uses rich text, via text hyperlinks to 
publications in BibDesk.

The easiest way to do this would be via an export template that outputs rich 
text linked via the x-bdsk URL scheme. By setting one of the copying and 
dragging formats in BibDesk's citation behavior preferences to this export 
template, one could paste or drag x-bdsk hyperlinks into any app that uses rich 
text. (I personally would find this most useful in the mentioned note-taking 
and 
journaling apps, even in Skim notes.)

Christiaan's helpful addition of the <$bdskURL.linkedText/> key would output, I 
think:

{\field{\*\fldinst{HYPERLINK "x-bdsk://Smith:2007ya"}}{\fldrslt 
x-bdsk://Smith:2007ya}}

However, since I want to have anchor text that is other than <$bdskURL/> (and 
since I am running Mac OS X Tiger and cannot benefit from Christiaan's 
Leopard-only build anyway), I found another solution. It involves creating a 
plain-text export template in BibDesk, using it as one of the copying and 
dragging formats in BibDesk, copying publications, then running a shell script 
which converts the plain text on the clipboard to hyperlinked rich text.

The export template, which is saved and added in BibDesk as plain text, looks 
like this in my case, although the value key in {\fldrslt <$citeKey/>} could be 
changed to any other key and the font in {\fonttbl {\f0\fnil LucidaGrande;}} 
could be changed to any other font, etc.

{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf480
{\fonttbl {\f0\fnil LucidaGrande;}}
{\colortbl;\red255\green255\blue255;}
<$publications>
{\field{\*\fldinst{HYPERLINK 
"x-bdsk://<$citeKey.stringByAddingPercentEscapes/>"}}{\fldrslt <$citeKey/>}}\
</$publications>}

The shell script is simply:

pbpaste | pbcopy -Prefer rtf

It can also be run as AppleScript:

do shell script "pbpaste | pbcopy -Prefer rtf"

Note that these will paste nothing into applications that don't recognize rich 
text.

Using ThisService.app, you can create a system-wide service (and hotkey) to run 
the script in any field or window that accepts rich text.

Summary:

1. Save a plain text template and set it to one of the copying and dragging 
formats in BibDesk's citation behavior preferences

2. Save the script either as AppleScript or as a shell script and make it into 
a 
system-wide service using the ThisService.app

3. Copy the publications in BibDesk

4. Switch to a rich-text window and run the script via the service

5. Paste those yummy x-bdsk links into your window!



----- Original Message ----
From: Christiaan Hofman <[email protected]>
To: For general discussion about using BibDesk 
<[email protected]>
Sent: Sat, August 7, 2010 4:36:28 PM
Subject: Re: [Bibdesk-users] Export template for x-bdsk URL scheme?

On Aug 7, 2010, at 23:26, Adam R. Maxwell wrote:

> On Aug 7, 2010, at 2:15 PM, slow down wrote:
> 
>> Has anyone written any export template for BibDesk that incorporates cite 
>> keys 
>
>> hyperlinked with the x-bdsk://citekey URL scheme?
>> 
>> I understand why the following code wouldn't work in an RTF template, but I 
>> can't think of an alternative:
>> 
>> <$publications>
>> {\field{\*\fldinst{HYPERLINK "x-bdsk://<$citeKey/>"}}{<$citeKey/>}}
>> </$publications>
> 
> There are a couple of things that might work, but it would help to know what 
>you're trying to do with this.  I suspect HTML would be a better format 
>choice, 
>if you're trying to create a complete document, but Christiaan is the expert 
>on 
>templates.

Another thing you should be careful about is that the URL is not exactly the 
cite key, as special non-URI characters need to be %-escaped. In a template 
it's 
really x-bdsk://<$citeKey.stringByAddingPercentEscapes/>, but you can also get 
it as <$bdskURL/>. I added <$linkedText/> doing exactly what you want in 
tomorrow's nightly.

Christiaan


      

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to