1 | #! /bin/sh |
---|
2 | #+ |
---|
3 | # |
---|
4 | # =============== |
---|
5 | # genaeres_rtf.sh |
---|
6 | # =============== |
---|
7 | # |
---|
8 | # SYNOPSIS |
---|
9 | # ======== |
---|
10 | # |
---|
11 | # :: |
---|
12 | # |
---|
13 | # genaeres_rtf.sh |
---|
14 | # |
---|
15 | # DESCRIPTION |
---|
16 | # =========== |
---|
17 | # |
---|
18 | # aeres 2007-2012 pour inclusion dans document word |
---|
19 | # |
---|
20 | # EXAMPLES |
---|
21 | # ======== |
---|
22 | # |
---|
23 | # :: |
---|
24 | # |
---|
25 | # genaeres_rtf.sh |
---|
26 | # |
---|
27 | # SEE ALSO |
---|
28 | # ======== |
---|
29 | # |
---|
30 | # genbib.sh |
---|
31 | # |
---|
32 | # genaeres.sh |
---|
33 | # |
---|
34 | # TODO |
---|
35 | # ==== |
---|
36 | # |
---|
37 | # log |
---|
38 | # |
---|
39 | # phybiocar theme |
---|
40 | # |
---|
41 | # look for missing values (aerestype and aeresteam) |
---|
42 | # |
---|
43 | # EVOLUTIONS |
---|
44 | # ========== |
---|
45 | # |
---|
46 | # - fplod 20120629T154955Z cratos (Linux) |
---|
47 | # |
---|
48 | # * reorganize to deal all aeres type |
---|
49 | # |
---|
50 | # - fplod 20120628T101424Z cratos (Linux) |
---|
51 | # |
---|
52 | # * creation |
---|
53 | # |
---|
54 | #- |
---|
55 | set -u |
---|
56 | command=$(basename ${0}) |
---|
57 | # |
---|
58 | system=$(uname) |
---|
59 | case "${system}" in |
---|
60 | AIX|IRIX64) |
---|
61 | echo "${command} : www : no specific posix checking" |
---|
62 | ;; |
---|
63 | *) |
---|
64 | set -o posix |
---|
65 | ;; |
---|
66 | esac |
---|
67 | # |
---|
68 | usage=" Usage : ${command}" |
---|
69 | # |
---|
70 | # test if bibtool available |
---|
71 | tool=bibtool |
---|
72 | type ${tool} 1> /dev/null 2>&1 |
---|
73 | status=${?} |
---|
74 | if [ ${status} -ne 0 ] |
---|
75 | then |
---|
76 | echo "${command} : eee : ${tool} unavailable" >&2 |
---|
77 | exit 1 |
---|
78 | fi |
---|
79 | unset tool |
---|
80 | unset status |
---|
81 | # |
---|
82 | # default |
---|
83 | # n.a. |
---|
84 | # |
---|
85 | hostname=$(hostname) |
---|
86 | tmpdir=${PROJECT_LOG}/aeres2007_2012rtf/ |
---|
87 | dirwww=${PROJECT_OD}/aeres2007_2012rtf/ |
---|
88 | rm -rf ${tmpdir} 2> /dev/null |
---|
89 | mkdir -p ${tmpdir} |
---|
90 | rm -rf ${dirwww} 2> /dev/null |
---|
91 | mkdir -p ${dirwww} |
---|
92 | # |
---|
93 | . define_teams_aeres2007_2012.sh |
---|
94 | . define_phybiocar_theme.sh |
---|
95 | . jabref_rtf.sh |
---|
96 | . jabref_header.sh |
---|
97 | # |
---|
98 | # define bibliography reference file |
---|
99 | biblioref_orig=${PROJECT_ID}/biblioref.bib |
---|
100 | biblioreffull=${tmpdir}/all.bib |
---|
101 | cp ${biblioref_orig} ${biblioreffull} |
---|
102 | # |
---|
103 | list_year="2007 2008 2009 2010 2011 2012" |
---|
104 | # |
---|
105 | # loop on teams and years to build bibliography reference file |
---|
106 | list_fteamyear="" |
---|
107 | iteam=1 |
---|
108 | nbteam=${#list_team_bibtool[@]} |
---|
109 | while [ ${iteam} -le ${nbteam} ] |
---|
110 | do |
---|
111 | echo "${LINENO} : iii: team = ${list_team_bibtool[${iteam}]}" |
---|
112 | fteam=${tmpdir}/${list_team_title[${iteam}]}.bib |
---|
113 | rm ${fteam} 2> /dev/null |
---|
114 | bibtool_command="bibtool -- 'select={aeresteam \"${list_team_bibtool[${iteam}]}\"}' ${biblioreffull} -o ${fteam}" |
---|
115 | eval ${bibtool_command} |
---|
116 | unset bibtool_command |
---|
117 | nbatteam=$(grep -c @ ${fteam}) |
---|
118 | if [ ${nbatteam} -ge 2 ] |
---|
119 | then |
---|
120 | echo "iii : $((${nbatteam} - 1)) ref for aeresteam ${list_team_title[${iteam}]}" |
---|
121 | for iyear in ${list_year} |
---|
122 | do |
---|
123 | echo "${LINENO} : iii: year = ${iyear}" |
---|
124 | fteamyear=${tmpdir}/$(basename ${fteam} .bib)_${iyear}.bib |
---|
125 | rm ${fteamyear} 2> /dev/null |
---|
126 | bibtool_command="bibtool -- 'select={year \"${iyear}\"}' ${fteam} -o ${fteamyear}" |
---|
127 | eval ${bibtool_command} |
---|
128 | unset bibtool_command |
---|
129 | # test if empty |
---|
130 | nbatteamyear=$(grep -c @ ${fteamyear}) |
---|
131 | if [ ${nbatteamyear} -ge 2 ] |
---|
132 | then |
---|
133 | echo "iii : $((${nbatteamyear} - 1)) ref for aeresteam ${list_team_title[${iteam}]} and year ${iyear}" |
---|
134 | list_fteamyear="${list_fteamyear} ${fteamyear}" |
---|
135 | else |
---|
136 | echo "www : no ref for aeresteam ${list_team_title[${iteam}]} and year ${iyear}" |
---|
137 | fi |
---|
138 | unset nbatteamyear |
---|
139 | done # end of year loop |
---|
140 | unset iyear |
---|
141 | else |
---|
142 | echo "www : no ref for aeresteam ${list_team_title[${iteam}]}" |
---|
143 | fi |
---|
144 | unset nbatteam |
---|
145 | unset nbatteamyear |
---|
146 | iteam=$(( ${iteam} + 1 )) |
---|
147 | done # end of team loop |
---|
148 | unset iteam |
---|
149 | unset nbteam |
---|
150 | unset list_year |
---|
151 | unset fteam |
---|
152 | # |
---|
153 | echo "${LINENO}: iii: list_fteamyear = ${list_fteamyear}" |
---|
154 | # |
---|
155 | # define jabref header |
---|
156 | # ++ usefull |
---|
157 | jabref_header ${tmpdir}/header_jabref |
---|
158 | # |
---|
159 | # loop on aerestype |
---|
160 | list_aerestype="ACL ACLN ASCL BRE C-INV C-ACTI C-ATCN C-COM C-AFF DO OR OS PV PAT PT AP" |
---|
161 | for aerestype in ${list_aerestype} |
---|
162 | do |
---|
163 | echo "${LINENO} : iii: aerestype = ${aerestype}" |
---|
164 | for fteamyear in ${list_fteamyear} |
---|
165 | do |
---|
166 | echo "${LINENO} : iii: fteamyear = ${fteamyear}" |
---|
167 | #++ add header |
---|
168 | fteamyeartype=${tmpdir}/$(basename ${fteamyear} .bib)_${aerestype}.bib |
---|
169 | rm ${fteamyeartype} 2> /dev/null |
---|
170 | bibtool_command="bibtool -- 'select={aerestype \"${aerestype}\"}' ${fteamyear} -o ${fteamyeartype}" |
---|
171 | eval ${bibtool_command} |
---|
172 | unset bibtool_command |
---|
173 | # test if empty |
---|
174 | nbatteamyeartype=$(grep -c @ ${fteamyeartype}) |
---|
175 | if [ ${nbatteamyeartype} -ge 2 ] |
---|
176 | then |
---|
177 | echo "iii : $((${nbatteamyeartype} - 1)) ref type ${aerestype} in ${fteamyear}" |
---|
178 | ofteamyeartype=${dirwww}/$(basename ${fteamyeartype} .bib).rtf |
---|
179 | rm ${ofteamyeartype} 2> /dev/null |
---|
180 | jabref_rtf \ |
---|
181 | ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
182 | ${fteamyeartype} ${ofteamyeartype} |
---|
183 | # ++ test si ok |
---|
184 | else |
---|
185 | echo "www : no ref type ${aerestype} in ${fteamyear}" |
---|
186 | fi |
---|
187 | unset nbatteamyeartype |
---|
188 | done # end of loop on fteamyear |
---|
189 | done # end of loop on aerestype |
---|
190 | # |
---|
191 | # clean |
---|
192 | #++rm ${biblioref} 2> /dev/null |
---|
193 | #++rm ${tmpdir}/header_jabref 2> /dev/null |
---|
194 | # |
---|
195 | # end |
---|
196 | exit 0 |
---|