aboutsummaryrefslogtreecommitdiff
blob: 7ca323220ad0c334c16cfc8f288ba5cd6eaef2a5 (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
#!/bin/sh

if [ $# -ne 0 ];
then
  echo "Usage: $0";
  echo "";
  echo "This script will generate and fix the HTML files inside this directory.";
  echo "For this having gorg installed is necessary.";
  exit 1;
fi

if [ -z "$(whereis -b gorg | cut -d: -f2)" ];
 then
  echo "gorg not found, can't continue without it :(";
  exit 1;
fi

for FILE in `find xml/ -iname '*.xml'`;
do
  output=${FILE%.xml}.html
  output=html/${output#xml/}
  mkdir -p `dirname $output`
  gorg < $FILE | \
       sed -e 's|"/css/main.css"|"http://www.gentoo.org/css/main.css"|g' \
           -e 's|"../../../|"http://www.gentoo.org/|g' \
           -e 's|"/images/|"http://www.gentoo.org/images/|g' \
           -e 's|"/|"http://www.gentoo.org/|g' | \
       tr -d "\302" | tr -d "\240" > $output;
done