Add scripts/auxiliar/cg-section.sh plus documentation
[lilypond/mpolesky.git] / scripts / auxiliar / doc-section.sh
blob2957db5b380c96340f58fc7e8721e78f295e904b
1 #!/bin/sh
3 # Build html versions of sections of lilypond documentation
5 # Usage: doc-section.sh MANUAL SECTION
7 # where MANUAL is the manual and SECTION is the section to be built.
9 # For example, NR 1.2 would be built by
10 # doc-section.sh notation rhythms
12 # and LM 1 would be built by
13 # doc-section.sh learning tutorial
15 # At the end of the run, the user is prompted whether or not to remove files
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
23 # Known limitations:
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
31 # Customize the file here
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"
40 DIRECTORY=$1
41 NAME=$2
43 if test ! -d $TODIR; then
44 mkdir $TODIR
46 if test ! -d $TODIR/out; then
47 mkdir $TODIR/out
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
54 if test -e $TODIR/$NAME.html; then
55 rm $TODIR/$NAME.html
58 if test -e $TODIR/out/$NAME.texi; then
59 rm $TODIR/out/$NAME.texi
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
78 echo Running RefCheck
79 python $REFCHECK
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
92 read -p "delete files? (y/n): "
93 if [ "$REPLY" = "y" ]; then
94 echo "deleting files"
95 rm -rf $TODIR