]> git.lyx.org Git - features.git/blob - lib/scripts/lyxpaperview
Enable Open Citation menu item iff citation contain locator information or external...
[features.git] / lib / scripts / lyxpaperview
1 #!/bin/bash
2
3 #This is just an example of an external script for finding corresponding file to the citation of the form Author + Year.
4 #You will need to accomodate it to your particular situation.
5 #
6 #Syntax: paperview Year Author
7 #Output: absolute path to the file(s)
8 #
9 #Dependencies:
10 #1) mlocate/updatedb or similar package installed and running.
11 #2) stored papers must contain first author name and year of publication in filename.
12
13 VIEWER=qpdfview
14 MAX_RESULTS=2
15
16 name="$2"
17 year="$1"
18
19 if [ -z "$name" ]; then exit; fi
20
21 FILE=`locate -i "$name" | grep -Ei '\.pdf$|\.ps$' | grep "$year" | head -n $MAX_RESULTS`
22
23
24 #Putting in background necessary so that LyX does not wait for viewer to end
25 $VIEWER ${FILE} &
26