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

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

process all aeres types

  • 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# pour V.8.b 3- Articles de vulgarisation  (presse en général
106# loop on teams and years to build bibliography reference file
107list_fteamyear=""
108iteam=1
109nbteam=${#list_team_bibtool[@]}
110while [ ${iteam} -le ${nbteam} ]
111do
112    echo "${LINENO} : iii: team = ${list_team_bibtool[${iteam}]}"
113    fteam=${tmpdir}/${list_team_title[${iteam}]}.bib
114    rm ${fteam} 2> /dev/null
115    bibtool_command="bibtool -- 'select={aeresteam \"${list_team_bibtool[${iteam}]}\"}' ${biblioreffull} -o ${fteam}"
116    eval ${bibtool_command}
117    unset bibtool_command
118    nbatteam=$(grep -c @ ${fteam})
119    if [ ${nbatteam} -ge 2 ]
120    then
121        echo "iii : $((${nbatteam} - 1)) ref for aeresteam ${list_team_title[${iteam}]}"
122        for iyear in ${list_year}
123        do
124           echo "${LINENO} : iii: year = ${iyear}"
125           fteamyear=${tmpdir}/$(basename ${fteam} .bib)_${iyear}.bib
126           rm  ${fteamyear} 2> /dev/null
127           bibtool_command="bibtool -- 'select={year \"${iyear}\"}' ${fteam} -o ${fteamyear}"
128           eval ${bibtool_command}
129           unset bibtool_command
130           # test if empty
131           nbatteamyear=$(grep -c @ ${fteamyear})
132           if [ ${nbatteamyear} -ge 2 ]
133           then
134               echo "iii : $((${nbatteamyear} - 1)) ref for aeresteam ${list_team_title[${iteam}]} and year ${iyear}"
135               list_fteamyear="${list_fteamyear} ${fteamyear}"
136           else
137               echo "www : no ref for aeresteam ${list_team_title[${iteam}]} and year ${iyear}"
138           fi
139           unset nbatteamyear
140       done # end of year loop
141       unset iyear
142    else
143       echo "www : no ref for aeresteam ${list_team_title[${iteam}]}"
144    fi
145    unset nbatteam
146    unset nbatteamyear
147    iteam=$(( ${iteam} + 1 ))
148done # end of team loop
149unset iteam
150unset nbteam
151unset list_year
152unset fteam
153#
154echo "${LINENO}: iii: list_fteamyear = ${list_fteamyear}"
155#
156# define jabref header
157# ++ usefull
158jabref_header ${tmpdir}/header_jabref
159#
160# loop on aerestype
161list_aerestype="ACL ACLN ASCL BRE C-INV C-ACTI C-ATCN C-COM C-AFF DO OR OS PV PAT PT AP"
162for aerestype in ${list_aerestype}
163do
164   echo "${LINENO} : iii: aerestype = ${aerestype}"
165   for fteamyear in ${list_fteamyear}
166   do
167      echo "${LINENO} : iii: fteamyear = ${fteamyear}"
168      #++ add header
169      fteamyeartype=${tmpdir}/$(basename ${fteamyear} .bib)_${aerestype}.bib
170      rm ${fteamyeartype} 2> /dev/null
171      bibtool_command="bibtool -- 'select={aerestype \"${aerestype}\"}' ${fteamyear} -o ${fteamyeartype}"
172      eval ${bibtool_command}
173      unset bibtool_command
174      # test if empty
175      nbatteamyeartype=$(grep -c @ ${fteamyeartype})
176      if [ ${nbatteamyeartype} -ge 2 ]
177      then
178          echo "iii : $((${nbatteamyeartype} - 1)) ref type ${aerestype} in ${fteamyear}"
179          ofteamyeartype=${dirwww}/$(basename ${fteamyeartype} .bib).rtf
180          rm ${ofteamyeartype} 2> /dev/null
181          jabref_rtf \
182          ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \
183          ${fteamyeartype} ${ofteamyeartype}
184          # ++ test si ok
185      else
186          echo "www : no ref type ${aerestype} in ${fteamyear}"
187      fi
188      unset nbatteamyeartype
189   done # end of loop on fteamyear
190done # end of loop on aerestype
191#
192# clean
193#++rm ${biblioref} 2> /dev/null
194#++rm ${tmpdir}/header_jabref 2> /dev/null
195#
196# end
197exit 0
Note: See TracBrowser for help on using the repository browser.