summaryrefslogtreecommitdiffstats
path: root/opensuse/tdelibs/create-kdeapi
blob: 720922e8ac4457e3c76204993a1b8e209257796b (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
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
#! /bin/sh
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany.  All rights reserved.
#
# Author: Adrian Schroeter <adrian@suse.de>
#
# This module generates a index.html page for all KDE main api index.html pages
# SuSEhelp will use this index.html page as start point

r=`pwd`
while test ! -x usr/share/doc/KDE3-API/ && test "$r" != "/"; do
   r=`dirname $root`
   cd ..
done

kdeapi=/usr/share/doc/KDE3-API/

if test ! -w $r/${kdeapi} ; then
   echo "The KDE API directory $kdeapi is not writeable. Exit..."
   exit 1
fi

#
# write html header
#
cat > $r/${kdeapi}/index.html <<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="kde-maintainers@suse.de">
   <meta name="GENERATOR" content="create-kdeapi">
   <title>KDE API Reference</title>
</head>

<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
       <CENTER><H1>KDE 3.x API Reference</H1></CENTER>

EOF

#
# list all the api start pages
#

cat >> $r/${kdeapi}/index.html <<EOF
<TABLE WIDTH="100%" BORDER="0">
<TR bgcolor="b0b0b0">
<TH>&nbsp;</TH><TH>Description</TH><TH>from package</TH></TR>
<TR bgcolor="ffffff"><TD><A HREF="/usr/share/doc/packages/qt3/html/classes.html">
Qt </A></TD> <TD>all Qt classes</TD> <TD>qt</TD></TR>
EOF

dark=1
mods=
list=`ls -1 $r/${kdeapi}/*/index.html 2> /dev/null`
for page in $list; do 
    mainapi=`echo $page | sed -n -e "s@$r/$kdeapi/\([^/]*\)/index.html@\1@p"`
    mods="$mods $mainapi"
    eval "page_$mainapi=$page"
    eval "path_$mainapi=/$kdeapi/$mainapi"
done

list=`ls -1 $r/opt/kde3/share/doc/HTML/en/*-apidocs/*/html/index.html 2> /dev/null`
for page in $list; do 
    mainapi=`echo $page | sed -n -e "s@$r/opt/kde3/share/doc/HTML/en/.*-apidocs/\([^/]*\)/html/index.html@\1@p"`
    mods="$mods $mainapi"
    path=`echo $page | sed -e "s,$r/opt,/opt,"`
    eval "page_$mainapi=$path"
    path=`echo $page | sed -n -e "s@$r\(/opt/kde3/share/doc/HTML/en/.*-apidocs/[^/]*\)/html/index.html@\1@p"`
    eval "path_$mainapi=$path"
done

mods=`(for i in $mods; do echo $i; done ) | sort`

for mod in $mods; do
  eval "apipath=$""page_$mod"
  eval "basepath=$""path_$mod"
  description="`cat $r/$basepath/description.SuSE`"
  package="`cat $r/$basepath/package.SuSE`"

  if [ "$dark" == "1" ]; then
    dark=0
    echo "<TR bgcolor=\"eeeeee\">"                                                >>  $r/${kdeapi}/index.html
  else
    dark=1
    echo "<TR bgcolor=\"ffffff\">"                                                >>  $r/${kdeapi}/index.html
  fi

  echo "<TD><A HREF=\"${apipath}\"> ${mod} </A></TD>"                         >>  $r/${kdeapi}/index.html
  echo "<TD>${description}</TD>"                                                  >>  $r/${kdeapi}/index.html
  echo "<TD>${package}</TD>"                                                      >>  $r/${kdeapi}/index.html
  echo "</TR>"                                                                    >>  $r/${kdeapi}/index.html

done

#
# finish it ...
#
cat >> $r/${kdeapi}/index.html <<EOF
</TABLE>
<hr>
<table>
<tr><td><small> generated by create-kdeapi on `date` </td></tr>
</table>

</body>
</html>
EOF