added option -n NAME and -t TAGS;
authorwenzelm
Tue Aug 16 13:42:15 2005 +0200 (2005-08-16 ago)
changeset 17049ee573216713a
parent 17048 9aa7f0a2bbf5
child 17050 bfb571252817
added option -n NAME and -t TAGS;
lib/Tools/document
     1.1 --- a/lib/Tools/document	Tue Aug 16 13:42:14 2005 +0200
     1.2 +++ b/lib/Tools/document	Tue Aug 16 13:42:15 2005 +0200
     1.3 @@ -15,8 +15,9 @@
     1.4    echo
     1.5    echo "  Options are:"
     1.6    echo "    -c           cleanup -- be aggressive in removing old stuff"
     1.7 -  echo "    -o FORMAT    specify output format: dvi (default), dvi.gz, ps,"
     1.8 -  echo "                 ps.gz, pdf"
     1.9 +  echo "    -n NAME      specify document name (default 'document')"
    1.10 +  echo "    -o FORMAT    specify output format: dvi (default), dvi.gz, ps, ps.gz, pdf"
    1.11 +  echo "    -t TAGS      specify tagged region markup"
    1.12    echo
    1.13    echo "  Prepare the theory session document in DIR (default 'document')"
    1.14    echo "  producing the specified output format."
    1.15 @@ -36,17 +37,25 @@
    1.16  # options
    1.17  
    1.18  CLEAN=""
    1.19 +NAME="document"
    1.20  OUTFORMAT=dvi
    1.21 +TAGS=""
    1.22  
    1.23 -while getopts "co:" OPT
    1.24 +while getopts "cn:o:t:" OPT
    1.25  do
    1.26    case "$OPT" in
    1.27      c)
    1.28        CLEAN=true
    1.29        ;;
    1.30 +    n)
    1.31 +      NAME="$OPTARG"
    1.32 +      ;;
    1.33      o)
    1.34        OUTFORMAT="$OPTARG"
    1.35        ;;
    1.36 +    t)
    1.37 +      TAGS="$OPTARG"
    1.38 +      ;;
    1.39      \?)
    1.40        usage
    1.41        ;;
    1.42 @@ -77,6 +86,33 @@
    1.43  esac
    1.44  
    1.45  
    1.46 +# tagged region markup
    1.47 +
    1.48 +function prep_tags ()
    1.49 +{
    1.50 +  (
    1.51 +    IFS=","
    1.52 +    for TAG in $TAGS
    1.53 +    do
    1.54 +      case "$TAG" in
    1.55 +        /*)
    1.56 +  	  echo "\\isafoldtag{${TAG:1}}"
    1.57 +          ;;
    1.58 +        -*)
    1.59 +  	  echo "\\isadroptag{${TAG:1}}"
    1.60 +          ;;
    1.61 +        +*)
    1.62 +  	  echo "\\isakeeptag{${TAG:1}}"
    1.63 +          ;;
    1.64 +        *)
    1.65 +  	  echo "\\isakeeptag{${TAG}}"
    1.66 +          ;;
    1.67 +      esac
    1.68 +    done
    1.69 +  ) > isabelletags.sty
    1.70 +}
    1.71 +
    1.72 +
    1.73  # prepare document
    1.74  
    1.75  function pre_latex ()
    1.76 @@ -93,7 +129,9 @@
    1.77  (
    1.78    cd "$DIR" || fail "Bad directory '$DIR'"
    1.79  
    1.80 -  [ -n "$CLEAN" ] && rm -f "../document.$OUTFORMAT"
    1.81 +  [ -n "$CLEAN" ] && rm -f "../$NAME.$OUTFORMAT"
    1.82 +
    1.83 +  prep_tags
    1.84  
    1.85    if [ -f IsaMakefile ]; then
    1.86      "$ISATOOL" make "$OUTFORMAT"
    1.87 @@ -113,7 +151,7 @@
    1.88    fi
    1.89  
    1.90    if [ "$RC" -eq 0 -a -f "root.$OUTFORMAT" ]; then
    1.91 -    cp -f "root.$OUTFORMAT" "../document.$OUTFORMAT"
    1.92 +    cp -f "root.$OUTFORMAT" "../$NAME.$OUTFORMAT"
    1.93    fi
    1.94  
    1.95    exit "$RC"
    1.96 @@ -123,7 +161,7 @@
    1.97  
    1.98  # install
    1.99  
   1.100 -[ "$RC" -ne 0 ] && fail "Failed to prepare document in directory '$DIR'"
   1.101 +[ "$RC" -ne 0 ] && fail "Document preparation failure in directory '$DIR'"
   1.102  
   1.103  #beware!
   1.104  [ -n "$CLEAN" ] && rm -rf "$DIR"