#!/bin/bash # # Take the output files from the "beatconvert" script and make them # palatable for updating CVS. # print_usage() { echo "Usage: $0 [] []" echo " : folder containing conversions of Beats (default $PWD)" echo " : location of docs-common module" } case $1 in -h|--help ) print_usage && exit 0 ;; * ) ;; esac BEATDIR="$1" [ $# -lt 2 ] && COMMON="../../../docs-common" || COMMON="$2" if [ ! -d "$COMMON" ]; then echo "$COMMON is not the docs-common you're looking for." exit 1 fi XMLFORMAT="${COMMON}/bin/xmlformat" XMLFORMATCONF="${COMMON}/bin/xmlformat-fdp.conf" [ -f "$XMLFORMAT" ] || ( echo "No xmlformat found" && exit 1 ) [ -f "$XMLFORMATCONF" ] || (echo "No xmlformat-fdp.conf found" && exit 1 ) mkdir -p Fixed/ || ( echo "Couldn't make a directory here" && exit 1 ) for i in $BEATDIR/*; do OUTXML="Fixed/$(basename "$i").xml" eval "$XMLFORMAT -f $XMLFORMATCONF ${i} > $OUTXML" if [ -z "$(grep DOCTYPE ${i})" ]; then sed -i 's@\(<\?xml .\+\?>\)@\1\n@' $OUTXML fi sed -i 's@<\(/\)\?article>@<\1section>@' $OUTXML sed -i 's@' $OUTXML | sed 's@.\+

\([^<]\+\).\+@\1@') sed -i "s@^ .\+@ <title>${NEWTITLE}@" $OUTXML sed -i "s@<\(/\)\?h2>@<\1title>@g" $OUTXML done