summaryrefslogtreecommitdiffstats
path: root/tools/pnght
blob: 96f790f637fb6fb94031e6397fc898a305b3377e (plain)
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
#!/bin/sh

#  * Copyright © 2002 Nicolas Kaiser <nikai@nikai.net>
#  *
#  * This file is free software; you can redistribute it and/or modify it
#  * under the terms of the GNU General Public License as published by
#  * the Free Software Foundation; either version 2 of the License, or
#  * (at your option) any later version.
#  *
#  * This program is distributed in the hope that it will be useful, but
#  * WITHOUT ANY WARRANTY; without even the implied warranty of
#  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  * General Public License for more details.
#  *
#  * You should have received a copy of the GNU General Public License
#  * along with this program; if not, write to the Free Software
#  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#  *

# What it does: some HTML postprocessing
#
#   (1) it will extract height information from png images
#       in $doc/manual/$lang/snapshots/
#   (2) it will paste this information into the htmls
#       in $doc/manual/HTML/$lang/
#   (3) it will strip <FIGURE>, <PH> and </FIGURE> tags
#       which aren't legal in HTML 3.2
#   (4) and will strip empty lines

doc=~/sites/sylpheed/doc
lang=de

# modify to your needs. enjoy. nikai.

rm $doc/manual/HTML/par*.tmp
cd $doc/manual/$lang/snapshots/
for x in *.png
do
 echo $x $(($(hexdump -o -s 22 -n 1 $x | sed -e 's/[0-9]\{7\}//g') * 256 + $(hexdump -o -s 23 -n 1 $x | sed -e 's/[0-9]\{7\}//g'))) >> $doc/manual/HTML/par1.tmp
done
sed -e 's/[.]png//g' $doc/manual/HTML/par1.tmp >> $doc/manual/HTML/par.tmp
cd $doc/manual/HTML/$lang/
pen=$(awk '{print $1}' $doc/manual/HTML/par.tmp)
for y in $pen
do
 peh=$(awk '($1==y) {print $2}' y=$y $doc/manual/HTML/par.tmp)
 for x in *.html
 do
  z="s/\/$y.png\">/\/$y.png\"height=\"$peh\">/g"
  sed -e $z -e 's/\"height/\" height/g' -e 's/<PH[^>]*>//g' -e 's/<[/]*FIG[^>]*>//g' -e '/^$/d' $x > $x.tmp
  mv $x.tmp $x
 done
done
rm $doc/manual/HTML/par*.tmp