Hello,
a while ago on this list, Jan Jakob posted a useful AppleScript to further
manipulate templates (see below).  Is there a way to make BibDesk use that
applescript for displaying the template in the preview window.
Thanks,
Jan D.


On Tue, Apr 29, 2014 at 3:56 PM, Jan Jakob Bornheim <[email protected]>
wrote:
>
> > I have one more question with regards to Templates:
> > For titles, is there a way I can get BibDesk to translate Tex Quotation
> > Marks `` and '' into the standard typographic ones also for the Rtf
> > templates?   And the same with -- and --- etc.
> >
> > Thanks!
> >
> > Jan
> >
> >
> > There's nothing to convert TeX quotation marks. For the dashes, there is
> > stringByConvertingHyphensToDashes.
> >
> > Christiaan
>
> You can do further string manipulation in AppleScript. You could
> create a Script Menu for BibDesk and drop the following script in
> there. Then you could either assign a keyboard shortcut to the script
> or use BetterTouchTool to trigger it.
>
> Here is the script (note that I actually wrote that on a Windows
> machine, so I couldn't test it yet). Replace "template name" with the
> name of your template, but keep the quotes. The script formats the
> selected publications according to the selected template and then
> replaces the quotation marks and copies the output to the clipboard.
>
> Cheers
>
> Jan Jakob
>
> set theTemplate to "template name"
>
> tell document 1 of application "BibDesk"
>
> set thePublications to the selection
> set theCitation to (templated text using theTemplate for thePublications)
>
> set theCitation to my replaceString(theCitation "``", """)
> set theCitation to my replaceString(theCitation "\"", """)
> set the clipboard to theCitation
>
> end tell
>
> # http://applescript.bratis-lover.net/library/string/#replaceString
>
> on replaceString(theText, oldString, newString)
> local ASTID, theText, oldString, newString, lst
> set ASTID to AppleScript's text item delimiters
> try
> considering case
> set AppleScript's text item delimiters to oldString
> set lst to every text item of theText
> set AppleScript's text item delimiters to newString
> set theText to lst as string
> end considering
> set AppleScript's text item delimiters to ASTID
> return theText
> on error eMsg number eNum
> set AppleScript's text item delimiters to ASTID
> error "Can't replaceString: " & eMsg number eNum
> end try
> end replaceString
>
>
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to