#  $Id: 2um-info.awk 0.04 1996/06/26 00:00:04 tom Exp $
#
#  2um-info.awk:  Very simple and silly `AWK' script for converting
#                   "a "o "u "s "A "O "U  character sequences found
#                   in the German `gcal.texi' file to ISO-8859-1
#                   "Umlaute" characters.
#
#
#  Public domain.
#
/@node|@chapter|@section|@subsection|@subsubsection/ {
  len = length($0)
  tmptxt = ""
  if ($0 ~ /"/)
   {
     found = 0
     for (i=1; i <= len; i++)
      {
        tmpchr = substr($0, i, 1)
        if (tmpchr == "\"")
         {
           if (found == 1)
            {
              found = 0
              tmptxt = tmptxt tmpchr tmpchr
            }
           else
             found = 1
         }
        else
         {
           if (found == 1)
            {
              found = 0
              if (tmpchr == "a")
                tmptxt = tmptxt "ae"
              else
               {
                 if (tmpchr == "o")
                   tmptxt = tmptxt "oe"
                 else
                  {
                    if (tmpchr == "u")
                      tmptxt = tmptxt "ue"
                    else
                     {
                       if (tmpchr == "s")
                         tmptxt = tmptxt "ss"
                       else
                        {
                          if (tmpchr == "A")
                            tmptxt = tmptxt "Ae"
                          else
                           {
                             if (tmpchr == "O")
                               tmptxt = tmptxt "Oe"
                             else
                              {
                                if (tmpchr == "U")
                                  tmptxt = tmptxt "Ue"
                                else
                                  tmptxt = tmptxt "\"" tmpchr
                              }
                           }
                        }
                     }
                  }
               }
            }
           else
             tmptxt = tmptxt tmpchr
         }
      }
     if (found == 1)
       print tmptxt tmpchr
     else
       print tmptxt
   }
  else
    print $0
  next
}
#
# Main block.
#
{
  len = length($0)
  tmptxt = ""
  if ($0 ~ /"/)
   {
     found = 0
     for (i=1; i <= len; i++)
      {
        tmpchr = substr($0, i, 1)
        if (tmpchr == "\"")
         {
           if (found == 1)
            {
              found = 0
              tmptxt = tmptxt tmpchr tmpchr
            }
           else
             found = 1
         }
        else
         {
           if (found == 1)
            {
              found = 0
              if (tmpchr == "a")
                tmptxt = tmptxt "ä"
              else
               {
                 if (tmpchr == "o")
                   tmptxt = tmptxt "ö"
                 else
                  {
                    if (tmpchr == "u")
                      tmptxt = tmptxt "ü"
                    else
                     {
                       if (tmpchr == "s")
                         tmptxt = tmptxt "ß"
                       else
                        {
                          if (tmpchr == "A")
                            tmptxt = tmptxt "Ä"
                          else
                           {
                             if (tmpchr == "O")
                               tmptxt = tmptxt "Ö"
                             else
                              {
                                if (tmpchr == "U")
                                  tmptxt = tmptxt "Ü"
                                else
                                  tmptxt = tmptxt "\"" tmpchr
                              }
                           }
                        }
                     }
                  }
               }
            }
           else
             tmptxt = tmptxt tmpchr
         }
      }
     if (found == 1)
       print tmptxt tmpchr
     else
       print tmptxt
   }
  else
    print $0
}
