]> git.donarmstrong.com Git - lilypond.git/blob - scripts/auxiliar/doc-section.sh
Remove unused lines from scripts/auxiliar/doc-section.sh
[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
28 #
29
30 #
31 #  Customize the file here
32 #
33 FROMDIR="$HOME/lilypond"
34 DOCDIR="$HOME/lilypond/tempdocs"
35 TODIR=$DOCDIR/$NAME
36 LILYPONDBOOK="lilypond-book"
37 TEXI2HTML="texi2html"
38 REFCHECK="$FROMDIR/scripts/auxiliar/ref_check.py"
39
40 DIRECTORY=$1
41 NAME=$2
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         -o $TODIR/out \
71         $FROMDIR/Documentation/$DIRECTORY/$NAME.itely
72 BOOKRC=$?
73 if [ $BOOKRC != 0 ]; then
74   echo "Lilypond-book returned code $BOOKRC"
75   exit $BOOKRC
76 fi
77
78 echo Running RefCheck
79 python $REFCHECK
80
81 cd $DOCDIR
82 if test -f $TODIR/out/$NAME.texi; then
83   echo Running texi2html
84   cat $DOCDIR/macros.itexi $TODIR/out/$NAME.texi > $TODIR/$NAME.texi
85   $TEXI2HTML \
86     --no-validate \
87     --output=$TODIR/out/$NAME.html \
88     --I=$TODIR/out \
89     $TODIR/$NAME.texi
90 fi
91
92 read -p "delete files? (y/n): "
93 if [ "$REPLY" = "y" ]; then
94   echo "deleting files"
95   rm -rf $TODIR
96 fi