3 # Build html versions of sections of lilypond Contributors' Guide
5 # Usage: ./cg-section.sh SECTION
7 # where SECTION is the section to be built.
9 # For example, CG 4 would be built by
10 # ./cg-section.sh doc-work
12 # At the end of the run, the user is prompted whether or not to
13 # remove the generated files.
15 # Paths are calculated from environment variables in exactly the
16 # same way as they are for doc-section.sh - see the documentation
21 # * Doesn't use website css files
22 # * Bitmap images aren't loaded properly
34 if [ "$1" == '-h' ] || [ "$1" == '--help' ]; then
40 if [ -n "$LILYPOND_GIT" ]; then
41 echo "Using source tree from value of \$LILYPOND_GIT: $LILYPOND_GIT"
46 echo "\$LILYPOND_GIT was not set; auto-detected source tree at $LILYPOND_GIT"
49 if test ! -e "$LILYPOND_GIT/DEDICATION"; then
50 echo "Error: $LILYPOND_GIT did not look like a LilyPond source tree; aborting." >&2
54 : "${LILYPOND_BUILD_DIR:=$LILYPOND_GIT/build}"
55 DOC_DIR="${LILYPOND_TEMPDOCS:-$LILYPOND_BUILD_DIR/tempdocs}"
56 LILYPOND_BOOK="$LILYPOND_BUILD_DIR/out/bin/lilypond-book"
58 REFCHECK="$LILYPOND_GIT/scripts/auxiliar/ref_check.py"
61 DOCDIR="$HOME/lilypond/tempdocs"
62 OUTPUT_DIR="$DOC_DIR/contributor"
63 SECTION_PATH="$LILYPOND_GIT/Documentation/contributor/$SECTION.itexi"
65 if test ! -e "$SECTION_PATH"; then
66 echo "$SECTION_PATH did not exist; is $SECTION a valid section in the Contributor's Guide?" >&2
70 if test ! -d "$OUTPUT_DIR"; then
73 if test ! -d "$OUTPUT_DIR/out"; then
74 mkdir "$OUTPUT_DIR/out"
77 cp "$LILYPOND_GIT/Documentation/common-macros.itexi" "$OUTPUT_DIR/common-macros.itexi"
78 cp "$LILYPOND_GIT/Documentation/macros.itexi" "$DOC_DIR/macros.itexi"
79 cp "$LILYPOND_BUILD_DIR/Documentation/out/version.itexi" "$OUTPUT_DIR"
81 if test -e "$OUTPUT_DIR/$SECTION.html"; then
82 rm "$OUTPUT_DIR/$SECTION.html"
85 if test -e "$OUTPUT_DIR/out/$SECTION.texi"; then
86 rm "$OUTPUT_DIR/out/$SECTION.texi"
89 echo "Running RefCheck"
93 echo "Running $TEXI2HTML"
94 cat "$DOC_DIR/macros.itexi" "$SECTION_PATH" > "$OUTPUT_DIR/$SECTION.texi"
98 --output="$OUTPUT_DIR/out/$SECTION.html" \
99 --I="$LILYPOND_GIT/Documentation" \
100 --I="$OUTPUT_DIR/out" \
101 "$OUTPUT_DIR/$SECTION.texi"
105 The $SECTION section of the Contributor's Guide should now be viewable at
107 $OUTPUT_DIR/out/$SECTION.html
109 If you want to keep the generated docs around for a while, answer
110 'n' to the next question. If you only needed them to quickly check
111 something, view them now and then answer 'y' when you're done.
115 read -p "rm -rf $OUTPUT_DIR ? (y/n): "
116 if [ "$REPLY" = "y" ]; then
117 echo "deleting files"