summaryrefslogtreecommitdiff
path: root/man/lib/tohtml.sh
blob: b3081a58a86718714b81bd1a129bbdd69f3f671e (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
#!/bin/bash
if [ -e output ]; then
	  rm output -rf
fi

cwd=$(pwd)
echo "CWD: ${cwd}"
mkdir output
for d in $(ls); do
	  if [ -d $d ]; then
        if [ x"$d" = x"output" ]; then
            continue
        fi
        if [ x"$d" = x"lib" ]; then
            continue
        fi
        echo "mkdir output/${d}"
		    mkdir output/${d}
		    pushd $d
		    for f in $(ls); do
			      name=$(basename -- "$f")
			      ext="${name##*.}"
			      if [ x"${ext}" = x"html" ]; then
				        echo "Remove ${f}"
				        rm $f
            else
			          cat ${f} | mandoc -Thtml | python3 ${cwd}/mklinks.py -p /man/ -o ${cwd}/output/$d/$f.html
                #cat ${f} | mandoc -Thtml > ${cwd}/output/$d/$f.html
			          echo "Processed ${d}/${f}"
            fi
		    done
		    popd
	  fi
done