# Description
#   This file contains a script which transforms a plain text document which is
#   is a 'glossary' type of format, into a type of XML. The XML may not be completely
#   'well-formed' but should be able to be made so with a small amount of hand-editing
#
#   The XML should be DocBook but it isn't at the moment
#
# Notes:
#   This script uses some reasonably advanced features of sed, such as 'hold spaces'
#
# See Also:
#   There are a set of scripts which transform to HTML:
#   diary2html.sh, linkdoc2html.sh, plaintext2pdf.sh, plaintext2html-simple.sh
#   plaintext2html.sh
#   
#   http://www.ella-associates.org/utils/
#     This URL contains a list of all 'filter' or 'transformation' scripts which are
#     available. Each script contains significant documentation located within the
#     script file
#
# Author:
#   m.j.bishop


 
 if [ "$1" = "" ]
 then
   echo "usage: $0  textFileName "
   cat $0 | sed -n "/^[ ]*#/p" 
   exit 1;
 fi

 sFile="$1"
 cat $sFile |
  sed "/^[ ]*\*/{ \
    s/^[ ]*\*\(.*\)/<glossary-item value = \"\1\">/g;x;G; \
    s/^<glossary-item value = \"[^\n]*/<\/glossary-item>/;}"