File size: 1,814 Bytes
f65fe85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

DEST="$1"
shift
LANGS="$1"
shift
LYBOOK_DB="$1"
shift
DOCS="$1"

set -eu

rm -rf ${DEST}
mkdir -p ${DEST}

if [[ -n "${LYBOOK_DB}" ]] ; then
    # This command is complicated, but it's very fast.
    rsync -r \
          --exclude='*.count' \
          --exclude='*.doctitle*' \
          --exclude='*.eps' \
          --exclude='*.log' \
          --exclude='*.pdf' \
          --exclude='*.signature' \
          --exclude='*.tex' \
          --exclude='*.texi' \
          --exclude='*.texidoc*' \
          --link-dest=${LYBOOK_DB}/  \
          ${LYBOOK_DB}/ ${DEST}/
fi

for DOC in ${DOCS}
do
        mkdir -p ${DEST}/${DOC}
done

for LANG in ${LANGS}
do
    html_suffix="${LANG}.html"
    pdf_suffix="${LANG}.pdf"
    if [[ "${LANG}" = "en" ]] ; then
        html_suffix="html"
        pdf_suffix="pdf"
    fi
    for DOC in ${DOCS}
    do
        if [[ ! -f "${LANG}/${DOC}-big-page.html" ]]
        then
            continue
        fi
        cp ${LANG}/${DOC}-big-page.html ${DEST}/${DOC}-big-page.${html_suffix}
        if [[ -f ${LANG}/${DOC}.pdf ]]
        then
            cp ${LANG}/${DOC}.pdf ${DEST}/${DOC}.${pdf_suffix}
        fi
        find ${LANG}/${DOC}/ -type f -name '*.html'  | while read fn
        do
            if grep --quiet "^<p>UNTRANSLATED NODE: IGNORE ME" $fn ; then
                continue
            fi
            dst="${DEST}/${DOC}/$(basename $fn .html).${html_suffix}"

            sed -e 's#\(href\|src\)="\([a-f0-9]*/lily-[a-f0-9]*\)\.\(ly\|png\)"#\1="../\2.\3"#g' \
		-e 's#\(href\|src\)="\(pictures\|ly-examples\|css\)/#\1="../\2/#g' \
		-e 's#<!-- Created on .*by texi2html#<!-- Created by texi2html#g' \
		< $fn \
		> $dst
        done
    done &
done
wait

cp -a misc/ ${DEST}
cp -a pictures/ ${DEST}
cp -a ly-examples/ ${DEST}/
cp -a css/ ${DEST}/