source: branches/bibliolocean/src/genaeres_rtf.sh @ 216

Last change on this file since 216 was 216, checked in by pinsard, 12 years ago

add check tool (to be cont.)

  • Property svn:executable set to *
  • Property svn:keywords set to Id URL
File size: 4.7 KB
Line 
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#-
55set -u
56command=$(basename ${0})
57#
58system=$(uname)
59case "${system}" in
60   AIX|IRIX64)
61      echo "${command} : www : no specific posix checking"
62   ;;
63   *)
64      set -o posix
65   ;;
66esac
67#
68usage=" Usage : ${command}"
69#
70# test if bibtool available
71tool=bibtool
72type ${tool} 1> /dev/null 2>&1
73status=${?}
74if [ ${status} -ne 0 ]
75then
76   echo "${command} : eee : ${tool} unavailable" >&2
77   exit 1
78fi
79unset tool
80unset status
81#
82# default
83# n.a.
84#
85hostname=$(hostname)
86tmpdir=${PROJECT_LOG}/aeres2007_2012rtf/
87dirwww=${PROJECT_OD}/aeres2007_2012rtf/
88rm -rf ${tmpdir} 2> /dev/null
89mkdir -p ${tmpdir}
90rm -rf ${dirwww} 2> /dev/null
91mkdir -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
99biblioref_orig=${PROJECT_ID}/biblioref.bib
100biblioreffull=${tmpdir}/all.bib
101cp ${biblioref_orig} ${biblioreffull}
102#
103list_year="2007 2008 2009 2010 2011 2012"
104#
105# loop on teams and years to build bibliography reference file
106list_fteamyear=""
107iteam=1
108nbteam=${#list_team_bibtool[@]}
109while [ ${iteam} -le ${nbteam} ]
110do
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 ))
147done # end of team loop
148unset iteam
149unset nbteam
150unset list_year
151unset fteam
152#
153echo "${LINENO}: iii: list_fteamyear = ${list_fteamyear}"
154#
155# define jabref header
156# ++ usefull
157jabref_header ${tmpdir}/header_jabref
158#
159# loop on aerestype
160list_aerestype="ACL ACLN ASCL BRE C-INV C-ACTI C-ATCN C-COM C-AFF DO OR OS PV PAT PT AP"
161for aerestype in ${list_aerestype}
162do
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
189done # 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
196exit 0
Note: See TracBrowser for help on using the repository browser.