aboutsummaryrefslogtreecommitdiffstats
path: root/w3m-doc/mkdocs
blob: 560c2dcd58584ea2f3bd9e90351f3e69dd6fa5bb (plain) (blame)
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
#!/bin/sh

convert()
{
    SRC=$1
    HTML=`echo ${SRC} | ${SED} 's/\.in$//p'`
    DOC=`echo ${HTML} | ${SED} 's/\.html$//p' | ${TR} '[a-z]' '[A-Z]'`
    echo "converting ${SRC} to ${HTML_TOP_DIR}/${_JA_DIR}/${HTML} ... \c"
    ${NKF} -e ${SRC} | ${SED} -e 's/��/��/gp' -e 's/��/��/gp' | ${NKF} -j | ${W3MDOC} > ${HTML_TOP_DIR}/${_JA_DIR}/${HTML}
    echo "done.\nconverting ${HTML} to ${DOC_TOP_DIR}/${_JA_DIR}/${DOC} ... \c"
    ${W3M} -dump -e ${HTML_TOP_DIR}/${_JA_DIR}/${HTML} > ${DOC_TOP_DIR}/${_JA_DIR}/${DOC}
    echo "done."
}

W3MDOC="./w3mdoc.pl"
W3M="w3m"
if [ -x ${HOME}/bin/pre_w3m ]; then
    W3M=${HOME}/bin/pre_w3m
fi

NKF="/usr/local/bin/nkf"
SED="/usr/bin/sed"
TR="/usr/bin/tr"

HTML_TOP_DIR="html"
DOC_TOP_DIR="doc"
_JA_DIR="ja"
#HTML_DIR="html"
#DOC_DIR="doc"

if [ ! -d ${HTML_TOP_DIR} ]; then
    mkdir ${HTML_TOP_DIR}
    if [ ! -d ${HTML_TOP_DIR}/${_JA_DIR} ]; then
        mkdir ${HTML_TOP_DIR}/${_JA_DIR}
    fi
fi
if [ ! -d ${DOC_TOP_DIR} ]; then
    mkdir ${DOC_TOP_DIR}
    if [ ! -d ${DOC_TOP_DIR}/${_JA_DIR} ]; then
        mkdir ${DOC_TOP_DIR}/${_JA_DIR}
    fi
fi

if [ $# -eq 0 ]; then
    for _IN in *.in
    do
        convert ${_IN}
    done
else
    for _IN in $*
    do
        case ${_IN} in
        *.in)   convert ${_IN};;
        *)  ;;
        esac
    done
fi