~ubuntu-branches/debian/squeeze/nas/squeeze

« back to all changes in this revision

Viewing changes to doc/html/man2html.ksh

  • Committer: Bazaar Package Importer
  • Author(s): Steve McIntyre
  • Date: 2008-10-08 01:18:19 UTC
  • mfrom: (4.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081008011819-wmr4h2w0298k8t7z
Tags: 1.9.1-5
* Fix pending l10n issues. Debconf translations:
* Swedish. Closes: #491766 (thanks to brother@bsnet.se)
* Arabic. Closes: #500437 (thanks to Ossama Khayat)
* Basque. Closes: #500533 (thanks to Piarres Beobide)
* Brazilian Portuguese. Closes: #500973 (thanks to Felipe
  Augusto van de Wiel)
* Many thanks again to Christian Perrier for his i18n efforts,
  co-ordinating the above.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/ksh
2
 
 
3
 
# Take a man tree and make an html tree out of it
4
 
 
5
 
DOMAIN=$(domainname)
6
 
ARCH=$(arch)
7
 
 
8
 
case ${DOMAIN} in
9
 
   acf)     localeo=reo1 ;;
10
 
   bwfid)   localeo=reo1 ;;
11
 
   chfid)   localeo=neo1 ;;
12
 
   hkfid)   localeo=teo1 ;;
13
 
   lnfid)   localeo=leo1 ;;
14
 
   nyfid)   localeo=neo1 ;;
15
 
   psfid)   localeo=leo1 ;;
16
 
   sffid)   localeo=neo1 ;;
17
 
   tkfid)   localeo=teo1 ;;
18
 
   esac
19
 
 
20
 
sections="{1,2,3,4,5,6,7,8}"
21
 
#from=/usr/man
22
 
#to=/u/eo/repository/system/unix/man
23
 
from=`pwd`
24
 
to=/tmp/man
25
 
 
26
 
function disambiguate
27
 
{
28
 
newbase=${1}
29
 
newname="${newbase}.1"
30
 
dis=2
31
 
while [ -a "${newname}" ]
32
 
   do
33
 
      newname=$newbase"."$dis
34
 
      dis=$(expr $dis + 1)
35
 
      done
36
 
}
37
 
 
38
 
while getopts f:t:l:is:v c
39
 
   do
40
 
      case $c in
41
 
         f) from=$OPTARG ;;
42
 
         t) to=$OPTARG ;;
43
 
         l) localeo=$OPTARG ;;
44
 
         i) indexonly=1 ;;
45
 
         s) sections=$OPTARG ;;
46
 
         v) verbose=1 ;;
47
 
         esac
48
 
      done
49
 
shift OPTIND-1
50
 
 
51
 
if [ "${verbose}" ]
52
 
   then
53
 
      print "from: $from"
54
 
      print "to: $to"
55
 
      print "localeo: $localeo"
56
 
      print "sections: $sections"
57
 
      if [ "${indexonly}" ]
58
 
         then
59
 
            print "indexonly: 1"
60
 
         fi
61
 
   fi
62
 
 
63
 
cd $from
64
 
 
65
 
if [ ! "${indexonly}" ]
66
 
   then
67
 
      print "Processing the man pages ..."
68
 
      for i in man${sections}/*.man
69
 
         do
70
 
            if [ "$verbose" ]
71
 
               then
72
 
                  print $i
73
 
               fi
74
 
            # n=${i%.*}
75
 
            bn="$(basename $i .man)"
76
 
 
77
 
            name=${to}/${bn}.html
78
 
            if [ -a "${name}" ]
79
 
               then
80
 
                  oldname=$name
81
 
                  disambiguate $name
82
 
                  name=$newname
83
 
                  print "Collision - ${oldname} will be stored as ${name}"
84
 
               fi
85
 
            eqn $i | tbl | nroff -man | rman -f HTML | sed -e "s/MS_LOCAL_HOST/${localeo}/g" > ${name}
86
 
            done
87
 
   fi
88
 
 
89
 
print "Building the index.html files ..."
90
 
cd $to
91
 
for i in man${sections}
92
 
  do
93
 
  if [ "$verbose" ]
94
 
      then
95
 
      print $i
96
 
  fi
97
 
  if [ ! -d $i ]
98
 
  then
99
 
      continue
100
 
  fi
101
 
  cd $i
102
 
  pwd
103
 
  rm -f index.html
104
 
  echo '<ul>' > ../new.html
105
 
  for j in *.html
106
 
    do
107
 
    bn="$(basename $j .html)"
108
 
    if [ "$verbose" ]
109
 
        then
110
 
        print -n "$j "
111
 
    fi
112
 
 
113
 
    # get more interesting name for the link labels
114
 
    synl="$(egrep -A 1 '<B>.*</B> - .*' $j |sed -e 's/<B>//g' -e 's/<\/B>//g')"
115
 
#    echo "### synl = $synl"
116
 
    synname="$(echo $synl |cut -d' ' -f1)"
117
 
    synopse="$(echo $synl |cut -d' ' -f3-100)"
118
 
    print
119
 
    print "<li> <a href=$j>$synname</a> - $synopse" >> ../new.html
120
 
  done
121
 
  echo '</ul>' >> ../new.html
122
 
  mv ../new.html index.html
123
 
  cd ..
124
 
done