1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
:
trap 'rm $TMP1 $TMP2 $TMP3 $TMP4 $TMP5' 0
TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1
TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1
TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1
TMP4=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1
TMP5=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1
# Make a Refer database with bibliographic data
#
cat >$TMP1 <<-EOF
%L LABEL1
%T Title One
%A Author One
%L LABEL2
%T Title Two
%A Author Two
%A Another Author
%D 2013
EOF
# Make an auxiliary file with a list of labels
#
cat >$TMP2 <<-EOF
LABEL2
LABEL2
LABEL1
EOF
# Make a template for the generated bibliography
#
cat >$TMP3 <<-EOF
Bibliography
# %L sorted by label
%{L:%L
%A
%T
%{D:%D%}%{!D:no date%}
%}End
EOF
# The expected output of hxmkbib
#
cat >$TMP4 <<-EOF
Bibliography
# sorted by label
LABEL1
Author One
Title One
no date
LABEL2
Author Two; Another Author
Title Two
2013
End
EOF
# Run hxmkbib with the above three files
#
./hxmkbib -a $TMP2 $TMP1 $TMP3 >$TMP5
# Compare to the expected output
#
cmp -s $TMP4 $TMP5
|