]> git.donarmstrong.com Git - lilypond.git/blob - scripts/auxiliar/doc-section.sh
Build -- Add 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 #
28
29 #
30 #  Customize the file here
31 #
32 FROMDIR="$HOME/lilypond"
33 DOCDIR="$HOME/lilypond/tempdocs"
34 TODIR=$DOCDIR/$NAME
35 LILYPONDBOOK="lilypond-book"
36 TEXI2HTML="texi2html"
37 REFCHECK="$FROMDIR/scripts/auxiliar/ref_check.py"
38
39 DIRECTORY=$1
40 NAME=$2
41
42 if test ! -d $TODIR; then
43   mkdir $TODIR
44 fi
45 if test ! -d $TODIR/out; then
46   mkdir $TODIR/out
47 fi
48
49 cp $FROMDIR/Documentation/common-macros.itexi $TODIR/common-macros.itexi
50 cp $FROMDIR/Documentation/macros.itexi $DOCDIR/macros.itexi
51 cp $DOCDIR/version.itexi $TODIR/version.itexi
52
53 if test -e cp_$NAME.sh; then
54   cp_$NAME.sh $FROMDIR $TODIR
55 fi
56
57 if test -e $TODIR/$NAME.html; then
58   rm $TODIR/$NAME.html
59 fi
60
61 if test -e $TODIR/out/$NAME.texi; then
62   rm $TODIR/out/$NAME.texi
63 fi
64
65 echo "Running lilypond-book"
66 $LILYPONDBOOK \
67         -f texi-html \
68         -I $FROMDIR/Documentation/snippets \
69         -I $FROMDIR/Documentation/snippets/new \
70         -I $FROMDIR/input/manual \
71         -I $FROMDIR/Documentation \
72         -I $FROMDIR/Documentation/included  \
73         -o $TODIR/out \
74         $FROMDIR/Documentation/$DIRECTORY/$NAME.itely
75 BOOKRC=$?
76 if [ $BOOKRC != 0 ]; then
77   echo "Lilypond-book returned code $BOOKRC"
78   exit $BOOKRC
79 fi
80
81 echo Running RefCheck
82 python $REFCHECK
83
84 cd $DOCDIR
85 if test -f $TODIR/out/$NAME.texi; then
86   echo Running texi2html
87   cat $DOCDIR/macros.itexi $TODIR/out/$NAME.texi > $TODIR/$NAME.texi
88   $TEXI2HTML \
89     --no-validate \
90     --output=$TODIR/out/$NAME.html \
91     --I=$TODIR/out \
92     $TODIR/$NAME.texi
93 fi
94
95 read -p "delete files? (y/n): "
96 if [ "$REPLY" = "y" ]; then
97   echo "deleting files"
98   rm -rf $TODIR
99 fi