-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateweb
More file actions
executable file
·671 lines (633 loc) · 20.3 KB
/
createweb
File metadata and controls
executable file
·671 lines (633 loc) · 20.3 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
#!/bin/bash
# Script for creating the relacs website in WEBDEST from the templates
# in WEBBASE.
# (c) 2008-2013 by Jan Benda
RELACSBASE=../relacs
WEBBASE=web
WEBDEST=relacsweb
# directories and names for the main menu:
MAINMENU=".:Home: \
features:Features:i \
screenshots:Screenshots:i \
download:Download:i \
doc:Documentation:i \
plugins:Plugins: \
faq:FAQ:i \
publications:Publications:i \
contributors:Contributors:i \
links:Links:i"
# directories and descriptions of plugin sets:
PLUGINSETS="base:Base \
calibration:Calibration \
ephys:EPhys \
acoustic:Acoustic \
auditory:Auditory \
auditoryprojects:Auditory-Projects \
efield:E-Fields \
efish:E-Fish \
patchclamp:Patch-Clamp \
patchclampprojects:Patch-Clamp-Projects"
# directories and descriptions of device plugin sets:
DEVICEPLUGINSETS="linuxdevices/comedi:Comedi \
linuxdevices/rtaicomedi:RTAI-Comedi \
linuxdevices/daqflex:DAQFlex \
linuxdevices/attcs3310:Att-CS3310 \
linuxdevices/misc:Miscellaneous"
# names of plugin types:
PLUGINTYPES="RePro:Research protocols for online data analysis, visualization and stimulus generation.|\
Control:General information about a recording, passive analysis, and control of additional hardware.|\
Filter:Filter analog input traces and events.|\
Detector:Detect events (e.g.spikes) in analog input traces and events.|\
Model:A model for the simulation mode.|\
ModelLib:Libraries to be used by model plugins.|\
Lib:Libraries to be used by other plugins."
# names of plugin types:
DEVICEPLUGINTYPES="AnalogInput:Record data from the analog input channels of the data acquisition board.|\
AnalogOutput:Write stimuli to the analog output channels of the data acquisition board.|\
DigitalIO:Digital I/O lines of the data acquisition board.|\
Trigger:Configure an analog trigger device.|\
Attenuator:Set a requested attenuation level.|\
Attenuate:Specify attenuation of single output channels.|\
Manipulator:Control motorized manipulators.|\
Temperature:Measure temperatures.|\
Device:Any other device."
# clean previous web site:
CLEANALL="no"
if test "x$1" = "x-d"; then
CLEANALL="yes"
shift
fi
# no plugins:
DOPLUGINS="yes"
if test "x$1" = "x-n"; then
DOPLUGINS="no"
shift
fi
##### the script: ########################################################
function insertnavigation
{
local CURRENTDIR="$1"
local LINK="$2"
local BASEDIR="$3"
local CURRENTSUBDIR="$4"
local MENUSAVEIFS="$IFS"
echo "${HTMLSPACES}<td class="navigation">"
echo "${HTMLSPACES} <ul>"
IFS=" "
for MENUENTRY in $MAINMENU; do
local MENUDIR=${MENUENTRY%%:*}
local MENUNAME="${MENUENTRY#*:}"
MENUNAME="${MENUNAME%%:*}"
if test "x$MENUDIR" = "x$CURRENTDIR" ; then
local TEXT="<a href="$LINK">$MENUNAME</a>"
if test "x$LINK" = "xno" ; then
TEXT="$MENUNAME"
fi
if test -f $WEBBASE/$MENUDIR/menu.dat ; then
echo "${HTMLSPACES} <li>$TEXT"
echo "${HTMLSPACES} <ul>"
local SUBLINK=""
local SUBNAME=""
local SUBTAG=""
IFS="|"
while read SUBLINK SUBNAME SUBTAG; do
local SUBTITLE=""
if test "x$SUBTAG" = "xt"; then
SUBTITLE=" class=\"title\""
fi
if test "x$SUBLINK" = "x$CURRENTSUBDIR"; then
echo "${HTMLSPACES} <li${SUBTITLE}>$SUBNAME</li>"
else
echo "${HTMLSPACES} <li${SUBTITLE}><a href=\"$SUBLINK\">$SUBNAME</a></li>"
fi
done < $WEBBASE/$MENUDIR/menu.dat
IFS=" "
echo "${HTMLSPACES} </ul>"
echo "${HTMLSPACES} </li>"
else
echo "${HTMLSPACES} <li>$TEXT</li>"
fi
else
if test "x$MENUDIR" = "x." ; then
MENUDIR=index.html
fi
echo "${HTMLSPACES} <li><a href="${BASEDIR}${MENUDIR}">$MENUNAME</a></li>"
fi
done
echo "${HTMLSPACES} </ul>"
echo "${HTMLSPACES}</td>"
IFS="$MENUSAVEIFS"
}
function createhtml
{
local SRCHTML="$1"
local HTMLTITLE="$2"
local NAVICURRENTDIR="$3"
local NAVILINK="$4"
local NAVICURRENTSUBDIR="$5"
local HTMLBASE=""
local SRCHTML1="$SRCHTML"
local SRCHTML2="${SRCHTML1#*/}"
until test "x$SRCHTML1" = "x$SRCHTML2"; do
HTMLBASE="../$HTMLBASE"
SRCHTML1="$SRCHTML2"
SRCHTML2="${SRCHTML1#*/}"
done
local HTMLSAVEIFS="$IFS"
IFS=""
local HTMLLINE=""
while read HTMLLINE; do
local HTMLSTRIPLINE="${HTMLLINE##* }"
HTMLSPACES="${HTMLLINE%$HTMLSTRIPLINE}"
if test "x${HTMLSTRIPLINE:0:16}" = "xINSERTNAVIGATION"; then
insertnavigation "$NAVICURRENTDIR" "$NAVILINK" "$HTMLBASE" "$NAVICURRENTSUBDIR"
elif test "x${HTMLSTRIPLINE:0:10}" = "xINSERTBODY"; then
local BODYLINE=""
local BODYPRE="no"
while read BODYLINE; do
local HTMLBODYSPACE="${HTMLSPACES}"
test "$BODYPRE" = "yes" && HTMLBODYSPACE=""
echo "${HTMLBODYSPACE}${BODYLINE}"
[ $(expr match "$BODYLINE" ".*<pre.*>.*") -gt 0 ] && BODYPRE="yes"
[ $(expr match "$BODYLINE" ".*</pre>.*") -gt 0 ] && BODYPRE="no"
done < $WEBBASE/$SRCHTML
else
HTMLLINE="${HTMLLINE//INSERTTITLE/$HTMLTITLE}"
HTMLLINE="${HTMLLINE//INSERTBASEDIR/$HTMLBASE}"
HTMLLINE="${HTMLLINE//INSERTDATE/$(date)}"
echo "$HTMLLINE"
fi
done < $WEBBASE/skeleton.html > "$WEBDEST/$SRCHTML"
IFS="$HTMLSAVEIFS"
}
SAVEIFS="$IFS"
# clean and create destination folder:
if test $CLEANALL = yes; then
echo "clean and setup destination folder $WEBDEST ..."
rm -r -f $WEBDEST
else
echo "setup destination folder $WEBDEST ..."
fi
mkdir -p $WEBDEST
# create subdirectories:
for dir in $WEBBASE/*; do
if test -d $dir && ! test -d $WEBDEST/${dir#$WEBBASE/}; then
echo "creat directory ${dir#$WEBBASE/} ..."
mkdir $WEBDEST/${dir#$WEBBASE/}
fi
done
# copy html, css, png, and pdf files:
echo "copy html, css, png, and pdf files to $WEBDEST ..."
for file in $(find $WEBBASE/publications -name '*abstract.html') $(find $WEBBASE -name '*.css' -o -name '*.png' -o -name '*.jpg' -o -name '*.pdf'); do
cp -p $file $WEBDEST/${file#$WEBBASE/}
done
# links to documentation:
echo "create links to RELACS documentation ... "
cd $WEBDEST/doc
test -f api || ln -f -s ../../$RELACSBASE/doc/html api
test -f userman || ln -f -s ../../$RELACSBASE/doc/userman/html userman
cd - > /dev/null
# translate other index.html files:
for MAINMENUENTRY in $MAINMENU; do
MAINMENUDIR=${MAINMENUENTRY%%:*}
MAINMENUNAME="${MAINMENUENTRY#*:}"
MAINMENUTAG="${MAINMENUNAME##*:}"
MAINMENUNAME="${MAINMENUNAME%%:*}"
if test "x$MAINMENUTAG" = "xi" ; then
echo "translate $MAINMENUDIR/index.html ..."
createhtml $MAINMENUDIR/index.html "RELACS - $MAINMENUNAME" "$MAINMENUDIR" "no"
fi
done
# NEWS in index.html:
echo "create main index.html file ... "
FILE="$RELACSBASE/NEWS"
IFS=""
while read LINE; do
if [ $(expr match "$LINE" "INSERTNEWS.*") -gt 0 ]; then
COUNT=0
DDOPEN="no"
while read CLINE; do
if [ $(expr match "$CLINE" "\w.*") -gt 0 ]; then
[ $COUNT -gt 1 ] && break;
if [ $DDOPEN = "yes" ]; then
echo " </dd>"
echo ""
DDOPEN="no"
fi
echo " <dt>$CLINE</dt>"
echo " <dd>"
DDOPEN="yes"
let COUNT+=1
else
[ $(expr match "$CLINE" ".*\w.*") -gt 0 ] && echo " $CLINE"
fi
done < $FILE
[ $DDOPEN = "yes" ] && echo " </dd>"
else
echo "$LINE"
fi
done < $WEBBASE/index.tmpl > $WEBBASE/index.html
IFS="$SAVEIFS"
createhtml index.html "RELACS ... enjoy your recordings" "." "no"
rm $WEBBASE/index.html
# README, INSTALL:
echo "format README and INSTALL files ... "
for FILE in $RELACSBASE/README.md $RELACSBASE/INSTALL; do
FILENAME=${FILE##*/}
WEB=$(echo $FILENAME | tr [:upper:] [:lower:])
{
echo "<a name=\"$WEB\"></a>"
echo "<h2>$FILENAME</h2>"
echo "<pre>"
cat $FILE
echo "</pre>"
} > $WEBBASE/doc/$WEB.html
createhtml doc/$WEB.html "RELACS - $FILENAME" "doc" "index.html" "$WEB.html"
rm $WEBBASE/doc/$WEB.html
done
# changelog:
echo "format ChangeLog file ... "
FILE="$RELACSBASE/ChangeLog"
WEB=$(echo $FILE | tr [:upper:] [:lower:])
WEB=${WEB##*/}
DLOPEN="no"
DDOPEN="no"
IFS=""
{
echo "<a name="changelog"></a>"
echo "<h2>Change Log</h2>"
while read CLINE; do
[ $(expr match "$CLINE" "=====.*") -gt 0 ] && break
if [ $(expr match "$CLINE" "------.*") -gt 0 ]; then
if [ $DDOPEN = "yes" ]; then
echo " </dd>"
DDOPEN="no";
fi
if [ $DLOPEN = "yes" ]; then
echo " </dl>"
DLOPEN="no"
fi
echo ""
elif [ $(expr match "$CLINE" "Version.*") -gt 0 ]; then
echo " <h3>$CLINE</h3>"
echo " <dl>"
DLOPEN="yes"
elif [ $(expr match "$CLINE" "20.*") -gt 0 ]; then
if [ $DDOPEN = "yes" ]; then
echo " </dd>"
DDOPEN="no";
fi
echo " <dt>$CLINE</dt>"
elif [ $(expr match "$CLINE" ".*\w.*") -gt 0 ]; then
if echo "$CLINE" | grep '^\s*[A-Z]' &> /dev/null; then
if [ $DDOPEN = "no" ]; then
echo " <dd>"
DDOPEN="yes";
else
echo " </dd>"
echo " <dd>"
fi
fi
if [ $DDOPEN = "no" ]; then
echo " <dd>"
DDOPEN="yes";
fi
echo " $CLINE"
fi
done < $FILE
[ $DDOPEN = "yes" ] && echo " </dd>"
[ $DLOPEN = "yes" ] && echo " </dl>"
} > $WEBBASE/doc/$WEB.html
IFS="$SAVEIFS"
createhtml doc/$WEB.html "RELACS - ChangeLog" "doc" "no" "$WEB.html"
rm $WEBBASE/doc/$WEB.html
# NEWS in doc/news.html:
echo "format NEWS file ... "
IFS=""
{
echo "<a name="news"></a>"
echo "<h2>NEWS</h2>"
DDOPEN="no"
while read CLINE; do
if [ $(expr match "$CLINE" "\w.*") -gt 0 ]; then
if [ $DDOPEN = "yes" ]; then
echo " </dd>"
echo ""
DDOPEN="no"
fi
echo " <dt>$CLINE</dt>"
echo " <dd>"
DDOPEN="yes"
else
[ $(expr match "$CLINE" ".*\w.*") -gt 0 ] && echo " $CLINE"
fi
done < "$RELACSBASE/NEWS"
[ $DDOPEN = "yes" ] && echo " </dd>"
} > $WEBBASE/doc/news.html
IFS="$SAVEIFS"
createhtml doc/news.html "RELACS - NEWS" "doc" "no" "news.html"
rm $WEBBASE/doc/news.html
if test $DOPLUGINS = yes; then
# plugin navigation:
echo "extract plugin set navigation ... "
{
echo "../index.html#pluginsets|By Plugin Set|t"
for SET in $PLUGINSETS; do
DIR=${SET%%:*}
DESCR=${SET##*:}
echo "../${DIR##*/}|$DESCR"
done
IFS="|"
echo "../index.html#plugintypes|By Plugin Type|t"
for TYPE in $PLUGINTYPES; do
PTYPE=${TYPE%%:*}
DESCR=${TYPE##*:}
echo "../$(echo $PTYPE | tr [:upper:] [:lower:])s.html|$PTYPE"
done
IFS="$SAVEIFS"
echo "../index.html#devicesets|By Device Set|t"
for SET in $DEVICEPLUGINSETS; do
DIR=${SET%%:*}
DESCR=${SET##*:}
echo "../${DIR##*/}|$DESCR"
done
IFS="|"
echo "../index.html#devicetypes|By Device Type|t"
for TYPE in $DEVICEPLUGINTYPES; do
PTYPE=${TYPE%%:*}
DESCR=${TYPE##*:}
echo "../$(echo $PTYPE | tr [:upper:] [:lower:])s.html|$PTYPE"
done
IFS="$SAVEIFS"
} > navigation.tmp
# plugin descriptions:
rm -f *plugins.dat
PREVDIR=""
for SET in $PLUGINSETS $DEVICEPLUGINSETS; do
DIR=${SET%%:*}
DESCR=${SET##*:}
echo "create index for plugin set $DESCR ... "
mkdir -p $WEBBASE/plugins/${DIR##*/}
mkdir -p $WEBDEST/plugins/${DIR##*/}
cp -u $RELACSBASE/plugins/$DIR/help/*.jpg $RELACSBASE/plugins/$DIR/help/*.png $WEBDEST/plugins/${DIR##*/}/ 2> /dev/null
{
# navigation:
NEXT="no"
for NEXTSET in $PLUGINSETS $DEVICEPLUGINSETS; do
test "$NEXT" = "yes" && break
test "$NEXTSET" = "$SET" && NEXT="yes"
NEXTSET=""
done
NEXTDIR=${NEXTSET%%:*}
echo "<table class=\"navigationtop\">"
echo " <tr>"
if test -n "$PREVDIR"; then
echo " <td class=\"previous\">previous: <a href=\"../${PREVDIR##*/}\">$PREVDESCR</a></td>"
fi
if test -n "$NEXTDIR"; then
echo " <td class=\"next\">next: <a href=\"../${NEXTDIR##*/}\">${NEXTSET##*:}</a></td>"
fi
echo " </tr>"
echo "</table>"
echo ""
# title:
echo "<h2>$DESCR Plugins</h2>"
echo ""
# brief description:
if [ -f $RELACSBASE/plugins/$DIR/doc/${DIR##*/}.doc ]; then
echo "<p>"
sed -n '/\\brief/{s/\\brief //; s/%//; p}' $RELACSBASE/plugins/$DIR/doc/${DIR##*/}.doc
echo "</p>"
echo ""
fi
# plugin list:
if [ -d $RELACSBASE/plugins/$DIR/help ]; then
for PLUGIN in $RELACSBASE/plugins/$DIR/help/*.html; do
PLUGINTYPE="$(sed -n -e "6{s|<h2>\(.*\) \+\[\(.*\)\]</h2>|\2|; p;}" $PLUGIN )"
echo "$PLUGINTYPE|$PLUGIN"
done > plugins.tmp
echo "<table class=\"plugins\" width=\"100%\">"
ALLTYPES="$PLUGINTYPES|$DEVICEPLUGINTYPES"
PREVPTYPE="OTHER"
IFS="|"
for TYPE in $ALLTYPES; do
PTYPE=${TYPE%%:*}
while read PLUGINTYPE PLUGIN; do
PLUGINFILE=${PLUGIN##*/}
PLUGINNAME=${PLUGINFILE%%.*}
PLUGINNAME=${PLUGINNAME##*-}
PLUGINTYPEFILEBASE="$(echo $PLUGINTYPE | tr [:upper:] [:lower:])"
sed -e "1,5d; \$d; s|<h2>\(.*\) \+\[.*\]</h2>|<h2>\1<span class=\"pluginset\">\ \ [<a href=\"../${PLUGINTYPEFILEBASE}s.html\">$PLUGINTYPE</a>]\ \ [<a href=\"index.html\">$DESCR Plugins</a>]</span></h2>|" $PLUGIN > $WEBBASE/plugins/${DIR##*/}/$PLUGINFILE
cp navigation.tmp $WEBBASE/plugins/menu.dat
createhtml plugins/${DIR##*/}/$PLUGINFILE "RELACS - $DESCR Plugins: $PLUGINNAME" "plugins" "../index.html"
rm $WEBBASE/plugins/${DIR##*/}/$PLUGINFILE
echo "$DESCR $PLUGINNAME ${DIR##*/}/$PLUGINFILE" >> ${PLUGINTYPEFILEBASE}plugins.dat
# plugin type section:
if test "x$PTYPE" != "x$PREVPTYPE"; then
echo " <tr>"
echo " <th colspan=\"3\"><a href=\"../${PLUGINTYPEFILEBASE}s.html\">$PLUGINTYPE</a> Plugins:</th>"
echo " </tr>"
fi
echo " <tr>"
# plugin name:
echo " <td><a href=\"$PLUGINFILE\">$PLUGINNAME</a>:</td>"
# brief description:
echo " <td><span class=\"brief\">$(sed -n '/<h2>/,/<\/p>/p' $PLUGIN |sed '1d; 2s/^<div.*">//')</span></td>"
# plugin image:
PLUGINIMAGE="$(echo ${PLUGINFILE%%.*} | tr [:upper:] [:lower:]).png"
if test -f "$WEBDEST/plugins/${DIR##*/}/$PLUGINIMAGE"; then
PLUGINIMAGESMALL="${PLUGINIMAGE%.png}-small.png"
convert -resize 150 "$WEBDEST/plugins/${DIR##*/}/$PLUGINIMAGE" "$WEBDEST/plugins/${DIR##*/}/$PLUGINIMAGESMALL"
echo " <td><img src=\"$PLUGINIMAGESMALL\" alt=\"$PLUGINIMAGE\"></td>"
else
echo " <td></td>"
fi
echo " </tr>"
PREVPTYPE="$PTYPE"
done < <(grep -i "^$PTYPE|" plugins.tmp)
done
IFS="$SAVEIFS"
echo "</table>"
rm plugins.tmp
else
echo "<p>Sorry - no plugin descriptions available!</p>"
fi
# navigation:
echo ""
echo "<table class=\"navigationbottom\">"
echo " <tr>"
if test -n "$PREVDIR"; then
echo " <td class=\"previous\">previous: <a href=\"../${PREVDIR##*/}\">$PREVDESCR</a></td>"
fi
if test -n "$NEXTDIR"; then
echo " <td class=\"next\">next: <a href=\"../${NEXTDIR##*/}\">${NEXTSET##*:}</a></td>"
fi
echo " </tr>"
echo "</table>"
echo ""
# detailed description:
sed -n '/<div class=\"contents\">/,/<\/div><!-- contents -->/p;' $RELACSBASE/plugins/$DIR/doc/html/index.html | sed 's/<h/\n<h/; s/<\(\/\?\)h4/<\1h5/; s/<\(\/\?\)h3/<\1h4/; s/<\(\/\?\)h2/<\1h3/; s/<\(\/\?\)h1/<\1h2/;' > tmp.txt
if [ "$(cat tmp.txt | wc -l)" -gt 0 ]; then
echo ""
echo "<h2>$DESCR Plugins</h2>"
echo ""
cat tmp.txt
echo ""
fi
rm -f tmp.txt
} > $WEBBASE/plugins/${DIR##*/}/index.html
cp navigation.tmp $WEBBASE/plugins/menu.dat
createhtml plugins/${DIR##*/}/index.html "RELACS - $DESCR Plugins" "plugins" "../index.html" "../${DIR##*/}"
# rm $WEBBASE/plugins/${DIR##*/}/index.html
# rm -r $WEBBASE/plugins/${DIR##*/}
PREVDIR="$DIR"
PREVDESCR="$DESCR"
done
# plugin type lists:
ALLTYPES="$PLUGINTYPES|$DEVICEPLUGINTYPES"
PREVTYPE=""
IFS="|"
for PLUGINTYPE in $ALLTYPES; do
PTYPE=${PLUGINTYPE%%:*}
PDESCR=${PLUGINTYPE##*:}
echo "create $PTYPE plugins index ... "
PLUGINLABEL=$(echo $PTYPE | tr [:upper:] [:lower:])
PLUGINFILE=${PLUGINLABEL}s.html
{
# navigation:
NEXT="no"
for NEXTTYPE in $ALLTYPES; do
test "$NEXT" = "yes" && break
test "$NEXTTYPE" = "$PLUGINTYPE" && NEXT="yes"
NEXTTYPE=""
done
NEXTDIR="${NEXTTYPE%%:*}"
NEXTFILE="$(echo "$NEXTDIR" | tr [:upper:] [:lower:])s.html"
echo "<table class=\"navigationtop\">"
echo " <tr>"
if test -n "$PREVTYPE"; then
echo " <td class=\"previous\">previous: <a href=\"$PREVFILE\">$PREVTYPE</a></td>"
fi
if test -n "$NEXTTYPE"; then
echo " <td class=\"next\">next: <a href=\"$NEXTFILE\">${NEXTTYPE%%:*}</a></td>"
fi
echo " </tr>"
echo "</table>"
echo ""
# title:
echo "<h2>$PTYPE Plugins</h2>"
echo
echo "<p>$PDESCR</p>"
echo
if test -f ${PLUGINLABEL}plugins.dat; then
echo "<table class=\"plugins\" width=\"100%\">"
PREVSETDESCR="OTHER"
IFS="$SAVEIFS"
for SET in $PLUGINSETS $DEVICEPLUGINSETS; do
SDESCR=${SET##*:}
SDIR=${SET%%:*}
while read DESCR NAME DIR; do
PLUGINSET="${SDIR##*/}"
if test "x$DESCR" != "x$PREVSETDESCR"; then
echo " <tr>"
echo " <th colspan=\"3\"><a href=\"$PLUGINSET\">$DESCR</a> Plugin Set:</th>"
echo " </tr>"
fi
echo " <tr>"
# plugin name:
echo " <td><a href=\"${DIR}\">$NAME</a>:</td>"
# brief description:
echo " <td><span class=\"brief\">$(sed -n '/<td class=\"content\">/,${/<h2>/,/<\/p>/p}' $WEBDEST/plugins/$DIR | sed '1d; 2s/^<div.*">//')</span></td>"
# plugin image:
PLUGINIMAGE="$(echo ${DIR%.html} | tr [:upper:] [:lower:])-small.png"
if test -f "$WEBDEST/plugins/$PLUGINIMAGE"; then
echo " <td><img src=\"$PLUGINIMAGE\" alt=\"${PLUGINIMAGE##*/}\"></td>"
else
echo " <td></td>"
fi
echo " </tr>"
PREVSETDESCR="$DESCR"
done < <(fgrep "$SDESCR " ${PLUGINLABEL}plugins.dat | sort)
done
echo "</table>"
IFS="|"
fi
# navigation
echo "<table class=\"navigationbottom\">"
echo " <tr>"
if test -n "$PREVTYPE"; then
echo " <td class=\"previous\">previous: <a href=\"$PREVFILE\">$PREVTYPE</a></td>"
fi
if test -n "$NEXTTYPE"; then
echo " <td class=\"next\">next: <a href=\"$NEXTFILE\">${NEXTTYPE%%:*}</a></td>"
fi
echo " </tr>"
echo "</table>"
echo ""
} > $WEBBASE/plugins/$PLUGINFILE
sed 's|\.\./||' navigation.tmp > $WEBBASE/plugins/menu.dat
createhtml "plugins/$PLUGINFILE" "RELACS - $PTYPE Plugins" "plugins" "index.html" "$PLUGINFILE"
rm $WEBBASE/plugins/$PLUGINFILE
PREVFILE="$PLUGINFILE"
PREVTYPE="$PTYPE"
done
IFS="$SAVEIFS"
# plugin index:
echo "create plugin set main index ... "
IFS=""
while read INDEXLINE; do
IFS="$SAVEIFS"
if [ $(expr match "$INDEXLINE" ".*PLUGINSETS.*") -gt 0 ]; then
echo "<ul>"
PLUGINSETSLIST="$PLUGINSETS"
if [ $(expr match "$INDEXLINE" "DEVICEPLUGINSETS.*") -gt 0 ]; then
PLUGINSETSLIST="$DEVICEPLUGINSETS"
fi
for SET in $PLUGINSETSLIST; do
DIR=${SET%%:*}
DESCR=${SET##*:}
NUM=$(ls $RELACSBASE/plugins/$DIR/help/*.html | wc -l)
INTRO="$(sed -n '/\\brief/{s/\\brief //; s/%//; p}' $RELACSBASE/plugins/$DIR/doc/${DIR##*/}.doc)"
echo " <li><a href=\"${DIR##*/}\">$DESCR ($NUM):</a> <span class=\"brief\">$INTRO</span></li>"
done
echo "</ul>"
elif [ $(expr match "$INDEXLINE" ".*PLUGINTYPES.*") -gt 0 ]; then
echo "<ul>"
PLUGINTYPESLIST="$PLUGINTYPES"
if [ $(expr match "$INDEXLINE" "DEVICEPLUGINTYPES.*") -gt 0 ]; then
PLUGINTYPESLIST="$DEVICEPLUGINTYPES"
fi
IFS="|"
for PLUGINTYPE in $PLUGINTYPESLIST; do
PTYPE=${PLUGINTYPE%%:*}
PLUGINLABEL=$(echo $PTYPE | tr [:upper:] [:lower:])
DESCR=${PLUGINTYPE##*:}
NUM=0
if test -f ${PLUGINLABEL}plugins.dat; then
NUM=$(cat ${PLUGINLABEL}plugins.dat | wc -l)
fi
echo " <li><a href=\"$(echo $PTYPE | tr [:upper:] [:lower:])s.html\">$PTYPE ($NUM):</a> <span class=\"brief\">$DESCR</span></li>"
done
IFS="$SAVEIFS"
echo "</ul>"
else
echo "$INDEXLINE"
fi
IFS=""
done < $WEBBASE/plugins/index.tmpl > $WEBBASE/plugins/index.html
IFS="$SAVEIFS"
sed 's|\.\./||' navigation.tmp > $WEBBASE/plugins/menu.dat
createhtml plugins/index.html "RELACS - Plugins" "plugins" "no"
rm $WEBBASE/plugins/index.html
rm -f *plugins.dat
rm navigation.tmp
rm $WEBBASE/plugins/menu.dat
fi
echo
echo "Ready! You find the relacs website in $WEBDEST"
echo "Update the public website with"
echo " rsync -rlptvz relacsweb/ janbenda,relacs@web.sourceforge.net:htdocs/"
echo "Update the public API reference with"
echo " rsync -rLptvz ../relacs/trunk/doc/html/ janbenda,relacs@web.sourceforge.net:htdocs/doc/api/"
echo "Update the public user manual with"
echo " rsync -rlptvz ../relacs/trunk/doc/userman/html/ janbenda,relacs@web.sourceforge.net:htdocs/doc/userman/"