]> git.donarmstrong.com Git - lilypond.git/blob - scripts/auxiliar/doc-section.sh
Merge branch 'master' into lilypond/translation
[lilypond.git] / scripts / auxiliar / doc-section.sh
1 #!/bin/sh
2
3 #  Build html versions of sections of lilypond documentation
4 #
5 #  Usage:  doc-section.sh MANUAL SECTION
6 #
7 #   where MANUAL is the manual and SECTION is the section to be built.
8 #
9 #   For example, NR 1.2 would be built by
10 #       doc-section.sh notation rhythms
11 #
12 #     and LM 1 would be built by
13 #       doc-section.sh learning tutorial
14 #
15 #   At the end of the run, the user is prompted whether or not to remove files
16 #
17 #  Before first use, the following must be done:
18 #     * Set FROMDIR, DOCDIR, TODIR, LILYPONDBOOK, and TEXI2HTML for your system
19 #     * Create $DOCDIR
20 #     * Copy version.itexi from somewhere in your Documentation tree
21 #         (probably Documentation/out) to $DOCDIR
22 #
23 #  Known limitations:
24 #
25 #     * Doesn't use website css files
26 #     * Bitmap images aren't loaded properly
27 #     * Won't build Contributors' Guide; see scripts/auxiliar/cg-section.sh
28 #
29
30 #
31 #  Customize the file here
32 #
33 FROMDIR="$HOME/lilypond-git"
34 DOCDIR="$HOME/lilypond-git/tempdocs"
35 LILYPONDBOOK="lilypond-book"
36 TEXI2HTML="texi2html"
37 REFCHECK="$FROMDIR/scripts/auxiliar/ref_check.py"
38
39 DIRECTORY=$1
40 NAME=$2
41 TODIR=$DOCDIR/$NAME
42
43 if test ! -d $TODIR; then
44   mkdir $TODIR
45 fi
46 if test ! -d $TODIR/out; then
47   mkdir $TODIR/out
48 fi
49
50 cp $FROMDIR/Documentation/common-macros.itexi $TODIR/common-macros.itexi
51 cp $FROMDIR/Documentation/macros.itexi $DOCDIR/macros.itexi
52 cp $DOCDIR/version.itexi $TODIR/version.itexi
53
54 if test -e $TODIR/$NAME.html; then
55   rm $TODIR/$NAME.html
56 fi
57
58 if test -e $TODIR/out/$NAME.texi; then
59   rm $TODIR/out/$NAME.texi
60 fi
61
62 echo "Running lilypond-book"
63 $LILYPONDBOOK \
64         -f texi-html \
65         -I $FROMDIR/Documentation/snippets \
66         -I $FROMDIR/Documentation/snippets/new \
67         -I $FROMDIR/input/manual \
68         -I $FROMDIR/Documentation \
69         -I $FROMDIR/Documentation/included  \
70         -I $FROMDIR/Documentation/pictures \
71         -o $TODIR/out \
72         $FROMDIR/Documentation/$DIRECTORY/$NAME.itely
73 BOOKRC=$?
74 if [ $BOOKRC != 0 ]; then
75   echo "Lilypond-book returned code $BOOKRC"
76   exit $BOOKRC
77 fi
78
79 echo Running RefCheck
80 python $REFCHECK
81
82 cd $DOCDIR
83 if test -f $TODIR/out/$NAME.texi; then
84   echo Running texi2html
85   cat $DOCDIR/macros.itexi $TODIR/out/$NAME.texi > $TODIR/$NAME.texi
86   $TEXI2HTML \
87     --no-validate \
88     --output=$TODIR/out/$NAME.html \
89     --I=$TODIR/out \
90     $TODIR/$NAME.texi
91 fi
92
93 read -p "delete files? (y/n): "
94 if [ "$REPLY" = "y" ]; then
95   echo "deleting files"
96   rm -rf $TODIR
97 fi