/*-*-coding: latin-3;-*-*/
static char* what = "@(#) Programo por HTML-igi la Komputadan Leksikonon.";
#define beto marko("Bio.", "bio.gif","Bio.:", "bottom",32,32)
#define titolo "Komputada Leksikono: "
#define KL

static char *kv1egale = "<b><tt><a name=\"",
            *kv2egale = "</a></tt></b>",
            *kv1evi = "<img src=\"\337/evi.gif\" "
                           "align=\"middle\" alt=\"Evi.\"><b> <a name=\"",
            *kv2evi = "</a></b>",
            *kv1 = "<b><a name=\"",
            *kv2 = "</a></b> ",
            *kv1n = "(%c) <b><a name=\"",
            *kv2n = "</a></b>",
            *kv1sub = "<b><a name=\"",
            *kv2sub = "</a></b>";

#include "hiper.c"

int kapvorta_vosto = 0;

char Menuo[20000],
    *cxapitra_teksto = 0;
int iM = 0;

static void enmenuigu(char *cxen)
{
    int k;
    for(k = 0; cxen[k]; k++,iM++){
        if(iM >= sizeof(Menuo)) eraro("Tro longa menuo");
        Menuo[iM] = cxen[k];
    }
}

static void fermu_kromkopion()
{
    if(kromkopiu < sizeof(krombufro)){     /* t.e. kromkopiu ja */
        while(' ' == krombufro[kromkopiu - 1]) --kromkopiu;
        krombufro[kromkopiu] = 0;
        enmenuigu("\t");
        enmenuigu(krombufro);
        Menuo[iM++] = 0;
        kromkopiu = sizeof(krombufro);
    }
}

static void complete_prev_node()
{
    if(keep_in_buffer && (nodes[node_i][0] || nodes[!node_i][0])){
        fprintf(celo, ", %s, %s, %s\n", nova_cxeno,
                nodes[node_i], nodes[node_up]);
    }
    sbrosBuf(0);
}


static void nodoj()             /* @node NAME, NEXT, PREVIOUS, UP */          
{
    if(tenu_buf_post_cxap){
        cxapitra_teksto = sbrosBuf(tenu_buf_post_cxap);
        tenu_buf_post_cxap = 0;
        keep_in_buffer = 1;
    }    
/*      fPutStr("\n@node %s", nova_cxeno); */
    putStr("\n@node ");
    skribuCxen(nova_cxeno);
    
    complete_prev_node();
    strcpy(nodes[node_i], nova_cxeno);
    node_i = !node_i;
    keep_in_buffer = 1;
}

static void dict_link(int kap, char n, char *S)
{
    static int const nn [] =
    {0xb9, 0xb2, 0xb3,
     0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079
    };
    putch('{');
    if(n > '0'){
/*      if(kap) */
            putUni(nn[n - '1']);
/*      else fPutStr("%c.", n); */
    }
/*  if(!kap) postaskiigu(S, 'x', goodlen); */
    skribuCxen(S); putch('}');
}

static void TR_link(char n, char *a, char *S) /* TomeRaider */
{
    if(a) fPutStr("<a:%s>", a);
    else putStr("<a>");
    skribuCxen(S);
    if(n > '0') fPutStr("(%c)", n);
    putStr("</a>");
}

static void kapvorto(String s1, String s2)
{
    fermu_kromkopion();
    if(finilo) eraro("atendatas kapvortkomenco");
    else{
        char x = ento;
        kviete = 0;
        artikolnombrilo++;
        parNro = '#';
        fermuOL();
        
        if(ll) eraro("nefermita lingvo komence de artikolo");
        
        kapvorta_vosto = (':' != x);
        
        if(!isdigit(x)) x = 0;
        
        if(dict){
            if(x > '1') putStr("<HR>");
        }else if(TomeRaider) putStr(s1);
        else if(!texi){
            if(x) fPutStr(s1, x);
            else putStr(s1);            
        }
        
        filtru('<', !dict && !TomeRaider);
        if(x && !dict){
            int i = strlen(nova_cxeno);
            nova_cxeno[i] = '-';
            nova_cxeno[i + 1] = x;
            nova_cxeno[i + 2] = 0;
        }
        if(texi) nodoj();
        else if(!TeX && !dict && !TomeRaider) ankro();
        
        getch(); elemento();
        if(dict){
            putStr("<h2>");
            dict_link(1, x, cxeno);
            if(!kapvorta_vosto) putch(' ');
        }else{
            if(!latex && !TomeRaider) putStr(TeX ? s1 : "\">");
            skribuCxen(cxeno);
	    if(x && TomeRaider) fPutStr("(%c)", x);
            putStr(s2);
        }
        lingvo = eo;
        
        if(texi){
           char *a, *b;
           if(x) fPutStr("%c}", x);
           for(a = b = cxeno; *a; a++)
               if('*' != *a && '·' != *a) *b++ = *a;
           *b = 0;
           enmenuigu(cxeno);
           Menuo[iM++] = ':';
           if(strcmp(cxeno, nova_cxeno)){
               enmenuigu(nova_cxeno);
               Menuo[iM++] = '.';
           }else Menuo[iM++] = ':';
        }else if(TeX){          /* paĝotitoloj */
            char *xx;
            putch('{');
            for(xx=cxeno; *xx; xx++)
                if(litero(*xx) || ' ' == *xx || '-' == *xx) putch(*xx);
            putch('}');
        }    
        if(!kapvorta_vosto || !TeX) goto elirejo;
        {
            int z;
            if(',' == ch && texi) getch();
            if(z = ' ' == ch) skip();
            if('-' == ch){
                getch();
                if('-' == ch){
                    getch();
                    if('-' == ch){
                        getch();
                        if(latex){
                            skip();
                            putStr(" --- ");
                        }
                        goto elirejo;
                    }
                }
                eraro("minuso en kapvorto");
            }
            fermu_kromkopion();
            if(!texi){
                if(z) putch(' ');
                goto elirejo;
            }
        }
        putStr(right != align ? "\n@flushright\n" : "@*");
        align = right;
    }
 elirejo:;
}

static void Cxapitro(int vica)
{
    fermu_kromkopion();
    if(vica >= 0){
        while('§' == ch) getch();  
        skip();
        if(!litero(ch)) eraro("mankas cxapitra litero");
    }
    if(texi){
        char c;
        int i, j;
        
        if(vica >= 0){
            putStr("\n@chapter = ");
            kopiuGxis(0);
            putStr(" =\n");
        }
        if(vica && cxapitra_teksto){
            nova_cxeno[0] = 0, complete_prev_node();
            sbrosBuf(0);
            putStrq(cxapitra_teksto);
            free(cxapitra_teksto);
            putStr("@menu");
            sojla_linilongo = 79;
            for(i = j = 0; j < iM; j++){
                c = Menuo[j];
                if(0 == i){
                    if('\t' == c){
                        int k, l;
                        l = strlen(Menuo + j - 1);
                        if(l > 79-out_linepos || l > 79 - 30) fPutStr("\n\t");
                        else{
                            k = 30 - out_linepos;
                            do{
                                PUTC(' ');
                                ++out_linepos;
                            }while(--k > 0);
                        }
                        i = 4;
                        jxusa_spaceto = 0;
                        continue;
                    }
                    putStrq("\n* ");
                    i = 1;
                }else if(4 == i){
                    if(0 == c) i = 0;
                }else if(':' == c || '.' == c) i = (i + 1) % 3;
                putq(c);
            }
            iM = 0;
            sojla_linilongo = goodlen;
            putStr("\n@end menu\n");
        }        
        if(vica){
            sbrosBuf(0);
            keep_in_buffer = tenu_buf_post_cxap = 1;
        }
    }else if(vica >= 0){
        putStr(TeX ? "\\section*{" : TomeRaider? "<new>" : "<h1>");
        transskribuGxis(0);
        if(TeX) putch('}');
	else if(TomeRaider) putStr("###");
        else{
            putch(' ');
            putUni(8212);
            putStr("</h1>");
        }
        putch(lf);
    }
}

static void hyperlink(char n)
{
  char l1, l2;
  int sen_nro = '0' == n;
  if(sen_nro) filtru(ankrofermilo, !dict && !TomeRaider);
  else{
      getch();
      filtru(0, !dict && !TomeRaider);
  }
  if(texi || dict || TomeRaider){
      int dif = strcmp(cxeno, nova_cxeno);
      if(dict||TomeRaider){
          if(0 == dif){
	      if(dict) dict_link(0, n, cxeno);
	      else TR_link(n, 0, nova_cxeno);
          }else{
              int nl = strlen(nova_cxeno);
              if(0 == strncmp(cxeno, nova_cxeno, nl)){
                  if(dict) dict_link(0, n, nova_cxeno);
		  else TR_link(n, 0, nova_cxeno);
                  skribuCxen(cxeno + nl);
                  return;
              }
	      if(dict){
		  skribuCxen(cxeno);
		  putStr(" [vd "); dict_link(0, n, nova_cxeno); putch(']');
	      }else TR_link(n, nova_cxeno, cxeno);
          }
          return;
      }
      if(A_E){                  /* en la angla ŝlosilvorto */
          skribuCxen(nova_cxeno);
          putch(':');
          if(dif || !sen_nro){
              putch(' ');
              skribuCxen(nova_cxeno);
              if(!sen_nro) fPutStr("-%c", n);
              putch('.');
          }else putch(':');
      }else{
          fPutStr("@%cf%s{", dif ? 'R' : 'r', sen_nro ? "" : "n");
          skribuCxen(cxeno);
          if(dif) fPutStr("%s,%s", makrooingado ? "\\" : "", nova_cxeno);
          if(!sen_nro) fPutStr("%s,%c", makrooingado ? "\\" : "", n);
          putch('}');
      }
      return;
  }
  if(TeX){
      if(A_E) skribuCxen(cxeno);
      else{
          if(sen_nro){
              putStr("\\rf{");
              skribuCxen(cxeno);
              putch('}');
          }else{
              fPutStr("\\rn%c", n);
              skribuCxen(cxeno);
          }
      }
      return;
  }
  putStr("<a href=\"");

  l1 = toupper(nova_cxeno[0]);
  l2 = toupper(nova_cxeno[1]);

  if(strchr("BEFINOTUV", l1)) l2 = '.';
  else switch(l1){
      case 'A':
          if(l2 < 'L') l2 = '.';
          else if(l2 < 'P') l2 = 'L';
          else l2 = 'P';
          break;
      case 'D':
          if(l2 < 'I') l2 = '.';
          else if(l2 < 'O') l2 = 'I';
          else l2 = 'O';
          break;
      case 'K':
          if(l2 < 'O') l2 = '.';
          else if(l2 < 'R') l2 = 'O';
          else l2 = 'R';
          break;
      case 'L':
          if(l2 < 'I') l2 = '.';
          else if(l2 != 'I') l2 = 'O';
          break;
      case 'M':
          if(l2 < 'E') l2 = '.';
          else l2 = 'E';
          break;
      case 'P':
          l2 = (l2 < 'N' ? '.' : (l2 < 'R' ? 'N' : 'R'));
          break;
      case 'R':
          l2 = (l2 <= 'E' ? '.' : 'I');
          break;
      case 'S':
          if(l2 >= 'X') l2 = 'X';
          else if(l2 < 'I') l2 = '.';
          else if(l2 < 'O') l2 = 'I';
          else l2 = 'O';
          break;
      default:      
          if(l2 != 'X') l2 = '.';
          break;
  }
  if(mem1 != l1 || mem2 != l2){
     putch(l1);
     if(l2 != '.') putch(l2);
     fPutStr(".%s", Html);
  }
  putch('#');
  ankro();
  if(n > '0'){
      putch('-');
      putch(n);
  }
  if(NAME_buf[0]){
      fPutStr("\" name=\"%s", NAME_buf);
      NAME_buf[0] = 0;
  }
  putStr("\">");
  skribuCxen(cxeno);
  putStr("</a>");
} /* hyperlink */

static void pad()
{
    int j  = 24 - out_linepos;
    do PUTC(' '); while(--j > 0);
    skribuCxen(cxeno);
}

static int index_link()
{
    char n = 0;    
ek: skip();
    if('`' == ch){
        getch();
        filtru(ankrofermilo, 1);
    }else if('&' == ch){
            getch();
            if('1' <= ch && ch <= '9'){
                n = ch;
                getch();
                filtru(0, 1);
            }else{              /* marko leksikografia */
                getch();
                goto ek;
            }
    }else{
        eraro("Misa traduko");
        return -1;
    }
    if(n){
        fPutStr("%s-%c.", nova_cxeno, n);
        pad();
    }else if(strcmp(cxeno, nova_cxeno)){
        fPutStr("%s.", nova_cxeno);
        pad();
    }else{
        pad();
        putch('.');
    }
    return 0;
}
    
static void TeX_English_index_entry()
{
    ++angla_nombrilo;
    sojla_linilongo = goodlen;
    sbrosBuf(0);
    keep_in_buffer = 1;
    cxefciklo('*');
    preterkontrolu('*');
    if('§' == ch){
        getch();
        preterkontrolu('|');
    }
    if(0 == ch) sbrosBuf(-1);
    else{
        fputs("\n\\enArt{", celo);
        sbrosBuf(0);
        putch('}');
    }
    getch();
}


static void English_index_entry() /* for Texinfo only */
{
    static int enkrampe = 0, mangle;
    sojla_linilongo = 240;
    putch(lf);
    if(menuo != align){
        putStr("@menu\n");
        align = menuo;
        mangle = 0;
    }
    putStr("* ");
    cxeno[0] = 0;
    cxefciklo('*');
    preterkontrolu('*');
    if(cxeno[0]){
        if(':' == ch) fPutStr("\n* - \" - (%d):", ++mangle);
    }else{
        if('§' != ch) cxefciklo(':');
        putch(':');
    }
    if(':' == ch){
        int evi = 0, fin;
        getch();
        for(;;){
            char penda_disigilo = 0;
            if(index_link()) return;
            if(!ch || '§' == ch) break;
            if(',' == ch || ';' == ch){
                penda_disigilo = ch;
                getch();
                skip();
            }
            while(enkrampe || !strchr8("`&§", ch)){
                if('<' == ch){  /* eventualaj HTML-elementoj <s>, <â>, <>: */
                    getch();
                    if(fin = '/' == ch) getch();
                    if('s' == ch) evi++;
                    else if('â' == ch)
                        if(fin) putch('}');
                        else putStr("@kbd{");
                    else if('>' == ch){
                        putStr("!=");
                        getch();
                        continue;
                    }else eraro("nekonata elemento en traduko");
                    getch();
                    preterkontrolu('>');
                }else{
                    if(penda_disigilo){
                        putch(penda_disigilo);
                        putch(' ');
                        penda_disigilo = 0;
                    }
                    if('(' == ch) ++enkrampe;
                    else if(')' == ch) --enkrampe;
                    else if(enkrampe && strchr8("`&´", ch)){
                        if('&' == ch) getch();
                        getch();
                        continue;
                    }
                    putch(ch);
                    getch();
                }
            }
            if(2 == evi){
                putStr(" @{evi.@}");
                evi = 0;
            }
            if(!ch || '§' == ch) break;
            fPutStr("\n* - \" - (%d):", ++mangle);
        }
    }
    if(ch){
        preterkontrolu('§');
        preterkontrolu('|');
    }
}

static void preformat()
{
    if(!pre == finilo) eraro("finilo!=pre");
    if(finilo){
        if(verbatim && mmode && latex){
            mmode = 0;
            putStr("\\)");
        }    
        putStr(TomeRaider ? "<p>" : texi ? "\n@end example\n" :
               TeX ? (sintakse ? "\\end{sint}" :
                      verbatim ? "\\end{alg}\n" : "\\end{alltt}\n") :
               "</pre>");
        verbatim = pre = 0;
        if(!latex) freshPar = 1;
    }else{
        if(!kromelemento) fermuOL();
        putch(lf);
        putStr(TomeRaider ? "<p>" : texi ? "@example\n" :
               TeX ? sintakse ? "\\begin{sint}\\reg " :
               verbatim ? "\\begin{alg}\n" : "\\begin{alltt}" :
               "<pre>");
        if(verbatim && latex){
            if(atributoj_de_elemento[0]) putStr(atributoj_de_elemento +1);
            if('§' != ch){
                putStr("\\(");
                mmode = 1;
            }
        }
        pre = 1;
        if(ch){
            if(TeX) pre = -3;
            else putStr(TomeRaider ? "\xa0\xa0\xa0" : "   ");
        }else getch();
    }
}

static void MATEMATIKO(int allowSpecChar, Bulea fino)
{
   /*allowSpecChar==0: <$>...</$>; 't': §%; ceteraj: §{ */
    static int procento = 0;
    mmode = !fino;
    if(mmode){
        Bulea ps = penda_spaceto;
/*         if(procento) eraro("MATEMATIKO: procento!=0"); */
        if(allowSpecChar && pre || procento){
            putStr(texi ? "@var{" : "<var>");
            ++procento;
            return;
        }
        if('t' == allowSpecChar){
            procento = 1;
            mmode = falso;
        }
        if(!uni && !TeX) penda_spaceto = falso;
        if(latex || uni || 0 == tt_ingado++)
            putStr(mmode ? open_math_font :
                   TeX ? skip(), texi ? "@t{" : "{\\tt " :
                   "<tt>");
        if(!uni && !TeX) penda_spaceto = ps;
        if(allowSpecChar) verbatim = vero;
/*          lStako[ll++] = lingvo; */
/*          lingvo = eo; */
    }else{
        int p1 = procento;
        if(allowSpecChar && pre || procento > 1){
            if(texi) putch('}');
            else putStr("</var>");
            --procento;
            return;
        }            
        procento = 0;
        verbatim = falso;
/*          lingvo = lStako[--ll]; */
        if(!uni && !latex && --tt_ingado) return;
        if('t' == open_math_font[1]){
            if(ch && strchr(".,;", ch)){
                putch(ch);
                getch();
            }
            if(' ' == ch){
                putch(' ');
                skip();
            }else if(0 == ch && !en_tabelo){
                getch();
                if(ch) putch(' ');
                putStr(p1 ? TeX ? "}" :"</tt>" : close_math_font);
                if(!ch){
                    skip();
                    freshPar = 1;
                    putch(' ');
                    return;
                }
                while(' ' == ch && !dosierfino) getch();
                return;
            }
        }
        putStr(p1 ? TeX ? penda_spaceto=0,"}" : "</tt>" : close_math_font);
    }
}

static void lingvocxapo(char *longa, char *mll, lingva loka)
{
    if(TomeRaider){
	for(;;){
	    getch();
	    if(0 == ch){
		getch();
		if(0 == ch) return;
	    }
	}
    }
    if(latex) fPutStr("\\%s", mll);
    else putStrL(longa, eo);
    lingvo = loka;
}

static void paragrafo()
{
    fermu_kromkopion();
    getch();
    if('0' == ch && '#' != parNro && !mmode){
        fermuOL();
        goto eliro;
    }
    if('0' <= ch && ch <= '9'){
        if(pre && verbatim){
            if(latex){
                while(ch-- > '0') putStr("\\>");
                putStr("\\(");
                mmode = 1;
                goto eliro;
            }
            getch();
            return;
        } 
        if(mmode){
            if(texi) putch(ch);
            else fPutStr(TeX ? "\\mathbb{%c}" : "<b>%c</b>", ch);
            goto eliro;
        }
        if(align != defavxlto){
            if(texi){
                if(right == align) putStrq("@end flushright\n");
            }else putStr("</p><p>");
            align = defavxlto;
        }else if(freshPar > 1)
            if(TeX){
                if(texi) putch(0);
            }else putStr("<p>");
        freshPar = 0;
        putch(lf);
        if('#' == parNro){
            if(!latex){
                if(texi) putch(0);
                if('1' == ch) putStrq(texi ? "@enumerate\n" : "<ol>");
                else fPutStr(texi ? "@enumerate %c\n" : "<ol start=\"%c\">",
                             ch);
            }
            parNro = ch;
        }else ++parNro;
        if(kursivo || parNro != ch) eraro("fusxa <OL>");
        putch(lf);
        if(latex){
            if('1' != parNro || linipoz < 3) putch(0);
            fPutStr("%c) ", parNro);
        }else putStr(texi ? "@item\n" : "<li>");
    }else if('|' == ch){
	penda_spaceto = 0;
        if(TomeRaider) putStr(A_E ? "\n<new>" : "\n<br>");
        else if(TeX){
            if(!A_E) putStr(texi ? center == align ? "\n@center " : "\n@*" :
                            mmode ? (left == align ? "\\hfil\\cr " :
                                     eqn == align ? "\\\\" : "\\cr ") :
                            center == align ? "\\break\n" : "\\hfil\\break\n");
        }else putStr("\n<br>");
	get_skip();
	return;
    }else if('*' == ch || '·' == ch){
        putch(lf);
        putStr(texi ? "@item\n" :
	       TomeRaider && '#' != parNro? "<br>\x95 " :
               TeX ? '*' == ch ? "\\item[$\\star$] " : "\\item " :
               "<li>");
    }else if('-' == ch){
        putch(lf);        
        if(texi){
            putch(0);
            putStr("---");
        }else if(TeX) putStr("\\par^--*");
        else{
            putStr("<p>");
            putUni(8212);
        }    
    }else if('[' == ch){
        ++tt_ingado;
        if(TeX){
            if(texi) putStr("@t{");
            else putStr("{\\tt ");
            get_skip();
            return;            
        }else if(penda_spaceto){
            penda_spaceto = 0;
            putStr("<tt> ");
        }else{
            putStr("<tt>");
            getch();
            return;
        }
    }else if(']' == ch){
        getch();
        --tt_ingado;
        if(TeX){
            penda_spaceto = 0;
            putch('}');
            return;
        }
        if(0 == ch){
            if(en_tabelo){
               putStr("</tt>");
               return;
            }
            ch = ' ';
        }
        if(isspace(ch)) putStr(" </tt>");
        else{
            putStr("</tt>");
            return;
        }
/*      }else if('{' == ch){ */
/*          getch(); */
/*          skip(); */
/*          MATEMATIKO(1, falso); */
/*          return; */
    }else if('%' == ch){
        getch();
        skip();
        MATEMATIKO('t', falso);
        mmode = 0;
        return;
    }else if('}' == ch){
        getch();
        MATEMATIKO(0, vero);
        return;
    }else if(',' == ch){
        getch();
        if(latex) putStr("\\,");
        else putch(' ');
        return;
    }else if('§' == ch) Cxapitro(0);
    else if('£' == ch){
        freshPar = 1;
        fermuOL();
        putStr(latex ? "\\Lit " : texi ? "Lit. " : "<b><i>Lit.</i></b> ");
    }else if('\\' == ch){       /* \log, \sin ktp */
        if(TeX){
            if(texi) goto eliro;
            putStr(mmode ? "\\mathop{\\rm " : "{\\");
        }else if(mmode)
	    fPutStr("%s<%s>", close_math_font, TomeRaider?"b":"strong");
        for(;;){
            getch();
            if(!litero(ch)) break;
            skribu(ch);
        }if(TeX) putch('}');
        else{
            if(open_math_font[1] == 't' && ns == ch){
                skribu(ns);
                getch();
            }
            if(mmode)
		fPutStr("</%s>%s", TomeRaider?"b":"strong", open_math_font);
        }
        return;
    }else if('>' == ch){
        if(verbatim && pre){
            getch();
            if(latex){
                if(mmode){    
                    putStr("\\)");
                    mmode = 0;
                }
                putStr("\\`");
            }
            return;
        }
        freshPar = 0;
        if(TeX || TomeRaider)
            if(texi){
                if(align != right){
                    putStrq("\n@flushright\n");
                    align = right;
                }
            }else{
                getch();
                if('1' == ch || '2' == ch){
                    int i;
                    freshPar = 0;
		    if(TomeRaider){
			do getch(); while(ch);
			getch();
			return;
		    }
                    putStr(right == align ? "\\dato{" : "\\Dato{");
                    for(i = 0; 4 != i; i++){
                        putch(ch);
                        getch();
                    }
                    preterkontrolu('-');
                    while(ch) getch();
                    putch('}');
                    return;
                }else{
		    if(TomeRaider){
			putStr("<p>");
			return;
		    }
                    putStr("\\deks{");
                    align = right;
                    cxefciklo(0);
                }
                putch('}');
            }
        else putStr("<p>");
    }else if(' ' == ch && (mmode || sintakse)){
        if(latex){
            getch();
            if(' ' == ch){
                putStr("\\quad ");
                goto eliro;
            }
            putStr("\\ ");
            return;
        }else putch(' ');
    }else{
        if(litero(ch)){
            if(mmode){
                if('D' == ch){
                    putUniTexSym('4' == signaro ? 0x2206 : 0x394, "\\Delta ",
                                 "DELTO ");
                    goto eliro;
                }
                if('d' == ch){
                    putUniSym(0x2202, "[parta-derivo]\240");
                    goto eliro;
                }
            }
            if('R' == ch){
                fermuOL();
                putStr(texi ? "@subheading Rim.\n": TeX ? "\n\\Rim " :
                       "\n<p><b><I>Rim.</I></b> ");
                goto eliro;
            }
            if('Q' == ch){
                kviete = !kviete;
                goto eliro;
            }if(mmode && ch && strchr("NP", ch)){
                if(latex) fPutStr("\\cal %c", ch);
                else putch(ch);
                goto eliro; /* P=NP problemo*/
            }
            putch(lf);            
            if(!latex && !TomeRaider) putStr(texi ? "@*" : "<br><i>");
            switch(ch){
                case 'B': lingvocxapo("Bulgare", "Bg", eo); break;
                case Cx : lingvocxapo("Ĉeĥe", "Cs", lat2); break;
                case 'F': lingvocxapo("France", "Fr", lat1); break;
                case 'G': lingvocxapo("Germane", "De", lat1); break;
                case 'H': lingvocxapo("Hispane", "Es", lat1); break;
                case 'I': lingvocxapo("Itale", "It", eo); break;
                case 'L': lingvocxapo("Latine", "La", lat1); break;
                case 'P': lingvocxapo("Pole", "Pl", lat2); kviete = 1; break;
                case 'S': lingvocxapo("Slovake","Sk",lat2); kviete = 1; break;
                case 's': lingvocxapo("Slovene","Sl",lat2); kviete = 1; break;
                case 'T': lingvocxapo("Turke", "Tr", eo); kviete = 1; break;
                case 'V': lingvocxapo("Hungare", "Hu", lat2); break;
                case 'X': lingvocxapo("Serba-Kroate", "SH", lat2); break;
                default : eraro("misa paragraf-litero");
            }
	    if(TomeRaider) return;
            if(texi){
                int i = 10 - out_linepos;
                putch(' ');
                while(0 < i--) putStr("@ ");
            }else putStr(TeX ? " " : ":</i> ");
        } else {
            putHTMLsym('§');
            putHTMLsym(ch);
            return;}
    }
  eliro:
    getch();
    if(latex) skip();   
}  /* paragrafo  */

char check_superscript_char(){
    if(del == ch){
        if(0x2070 <= uch && uch <= 0x207f){
            if(0x2071 <= uch && uch <= 0x2073) eraro("undefined superscript");
            return uch <= 0x2079 ? '0' + uch - 0x2070 : "+-=()n"[uch - 0x207a];
        }else return 0xb9 == uch ? '1' : 0;
    }
    return '²' == ch ? '2' : '³' == ch ? '3' : 0;
}

int supra_indico() {
    char c0, kur, ant;
    if('8' == signaro) return 0;
    if(ant = check_superscript_char()){
        c0 = ch;
        getch();
        if(kur = check_superscript_char()){
            fPutStr(latex ? "^{%c" : texi ? "^@{%c": "<sup>%c", ant);
            do{
                putch(kur);
                getch();
            }while(kur = check_superscript_char());
            putStr(texi ? "@}" : TeX ? "}" : "</sup>");
        }else{
            if(!latex &&
               (strchr("23", ant) || '1' == ant && strchr("124", signaro))){
                skribu(c0);
            }else fPutStr(TeX ? "^%c" : "<sup>%c</sup>", ant);
        }
        return 1;
    }
    return 0;
}

static void cxefciklo(const char limo)
{
  for(; !dosierfino && (limo != ch); ){
    if(mmode > 0){
        char c0;
        if(verbatim && latex && litero(ch)){
            c0 = ch;
            getch();
            if(litero(ch) || '0' <= ch && '9' >= ch){
                fPutStr("\\mbox{\\it %c", c0);
                do{
                    skribu(ch);
                    getch();
                }while(litero(ch) || '0' <= ch && '9' >= ch);
                putch('}');
            }else skribu(c0);
        }else if(supra_indico()) continue;
    }
    switch(ch){
      case' ':
          if(pre){
	      if(TomeRaider) ch = ns;
	      break;
	  }
          do getch(); while(' ' == ch && !dosierfino);
          if(mmode && !TeX) putHTMLsym(ns);
          else putch(' ');
          continue;
      case 0:
          if(pre){
              int algoritmo = verbatim && latex;
              if(algoritmo){
                  if(mmode) putStr("\\)");
                  putStr("\\\\");
                  mmode = 0;
              }else if(TomeRaider) putStr("<br>");
              putch(0);
              getch();
              if(-3 == pre){    /* texi only */
                  int i = -3;
                  while(' ' == ch && i++) getch();
              }
              if(algoritmo && '§' != ch){
                  putStr("\\(");
                  mmode = 1;
              }    
              continue;
          }
          if(en_tabelo){
              if(TeX){
                  if(en_tabelo < 0) en_tabelo = 1;
                  else fPutStr(texi ? "\n@item " : "\\\\");
              }else putStr(TomeRaider ? "<br>" : "<tr><t");
              getch();
              /* Ĉi tio estas ŝtopteksto por pasigi ff;
                 mi ne plu memoras kial ili aperas en tabeloj: */
              if(ff == ch) skip_beyond(0);
              if(hstroke == ch){
                  getch();
                  if(!texi && !TomeRaider){
                      if(TeX) putStr("\\slshape ");
                      else putch('h');
                  }
              }else if(!TeX && !TomeRaider) putch('d');
              if(TeX || TomeRaider){
                  while(!mmode && strchr8("½+", ch)) getch();
                  continue;
              }
              if(!mmode){
                  if(duono == ch){
                      putStr(" align=\"center\"");
                      getch();
                  }else if('+' == ch){
                      putStr(" align=\"right\"");
                      getch();
                  }
              }
              putch('>');
              continue;
          }
          putch(' ');
          do getch(); while(' ' == ch && !dosierfino);
          if(0 == ch){
              skip();
              if(menuo == align) fermuOL();
              else freshPar = 1;
          }
          continue;
      case'>':
          getch();
          if('>' == ch){
              if(mmode || tt_ingado || !uni && !latex ) break;
              if(uni) putUni(0x203a);
              else putStr("\\textrangle ");
              goto G;
          }
          if(mmode || verbatim || pre) putHTMLsym('>');
          else  eraro("libera >");
          continue;
      case'<':
          getch();
          if(strchr("<>=", ch)){
              if('<' == ch){
                  if(mmode || pre || verbatim || !uni && !latex ) break;
                  if(uni) putUni(0x2039);
                  else putStr("\\textlangle ");
                  goto G;
              } else putHTMLsym('<');
              continue;
          }else if(verbatim){
              if(!strchr("$/{", ch)){
                  if('<' == ch) getch();
		  if(TomeRaider && !isascii(ch)) putch('<');
                  else putHTMLsym('<');
                  continue;
              }
          }
          {switch(elemento()){
              case anglete:
                  etna_lingvo(lat1, "en");
                  break;
              case bibref:
                  bibliografio();
                  break;
              case ccode:
                  if(finilo){
                      align = defavxlto;
                      putStr( TeX ? "}\n" :
			      TomeRaider ? "</center>" :
			      "</tt></div>");
                      --tt_ingado;
                      sojla_linilongo = goodlen;
                  }else{
                      putStr(texi ? "\n@center @t{" :
                             TeX ? "\n\\mad{\\tt " :
			     TomeRaider ? "<center>" :
                              "<div align=\"center\"><tt>");
                      ++tt_ingado;
                      align = center;
                      if(texi) sojla_linilongo = 120;
                  }
                  freshPar = 0;
                  skip();
                  break;
              case centra:
                  if(finilo){
                      align = defavxlto;
                      verbatim = penda_spaceto = 0;
                      if(!TeX && mmode) putStr(close_math_font);
                      putStr(texi ? "}\n" :
                             TeX ? mmode ? '×' == kromelemento ?
                             "\\end{multline*}" :
                             '=' == kromelemento ? "\n\\end{eqnarray*}" :
                             "}$$}\n" : "\\end{center}\n" :
			     TomeRaider ? "<br>" :
                             "</p><p>");
                      mmode = 0;
                      sojla_linilongo = goodlen;
                  }else{
                      if('.' != kromelemento){    
                          mmode = 1;
                          verbatim = (';' == kromelemento);
                      }
                      putStr(texi ? sojla_linilongo=120,"\n@center @t{" :
                             TeX ? mmode? ('×' == kromelemento ?
                             "\\begin{multline*}" :
                             '=' == kromelemento ? "\n\\begin{eqnarray*}" :
                             "\n\\mad{$$\\displaylines{") :
                             "\n\\begin{center}" :
			     TomeRaider ? "<br>" :
                             "\n<p align=\"center\">");
                      if(TeX) align = ('-' == kromelemento ? left :
                                       '=' == kromelemento ? eqn :
                                       center);
                      else if(mmode) putStr(open_math_font);
                  }
                  freshPar = 0;
                  skip();
                  continue;
              case Cirile:
                  if(kviete = !finilo){
                      fermu_kromkopion();
		      if(TomeRaider){
			  sbrosBuf(0);
			  keep_in_buffer = 1;
		      }else{  
			  if(latex) putStr("\n\\Ru{");
			  else putStr(texi ? "@R " : "<br><i>Ruse:</i> ");
			  lingvo = rusa;
		      }
                  }else{
                      lingvo = eo;
		      if(TomeRaider) sbrosBuf(-1);
                      else if(latex) putch('}');
                  }
                  break;
              case cirilete:
                  etna_lingvo(rusa, "ru");
                  break;
              case alg:
                  verbatim = 1; /* NO BREAK!!  */
              case code:
                  preformat();
                  continue;
              case fon:
                  kviete = !finilo;
                  if(kviete){
                      if(latex) putStr("\\textipa{[");
                      else if(TomeRaider || texi) putch('[');
                      else putStr('8' == signaro ? "<em>[" : "<tt>[");
                      lStako[ll++] = lingvo;
                      lingvo = IPA;
                  }else{
                      lingvo = lStako[--ll];
                      if(TeX || TomeRaider){
                          putch(']');
                          if(latex) putch('}');
                      }else putStr('8' == signaro ? "]</em>" : "]</tt>");
                  }
                  continue;
              case germane:
                  etna_lingvo(lat1, "de");
                  break;
              case greke:
		  uniGreka(); continue;
              case hname: NAME(); continue;
              case Detaloj: DETALOJ(); continue;
              case egale:
                  lingvo = lat1;
                  kapvorto(kv1egale, kv2egale);
                  lingvo = eo;
                  break;
              case evi:
                  lingvo = eo;
                  kapvorto(kv1evi, kv2evi);
                  break;
              case grafiko:
                  if(texi){
                      if(finilo) putStr(".gif@}");
                      else fPutStr("@{Bildo: %s/", bildvojo);
                  }else{
                      if(finilo){
                          en_html_komando = 0;
                          putStr(".gif\">");
                          bildo("fig.gif","FIG.","bottom",20,20);
                          putStr("></a>");
                      }else{
                          en_html_komando = 1;
                          fPutStr("<a href=\"%s/", bildvojo);
                      }
                  }
                  continue;
              case html: continue;
              case bildego:
                  if(finilo){
                      if(texi) eraro("Texinfo Image");
                  }else{
		      if(TomeRaider){
			  skip_beyond('<');
			  if(bildego != elemento()) eraro("TR-bildego");
			  goto G;
		      }
                      if(TeX){
                          if('@' == ch){
                              freshPar = 1;
                              getch();
                              putStr("@image{");
                              kopiuGxis('.');
                              putStr("}\n");
                          }
                          while('>' != ch) getch();
                          getch();
                          continue;
                      }else freshPar = 1;
                      if('@' == ch) getch();
                  }
                  clearall = vero; /*no break*/
              case inlineimg:
                  if(!finilo){
                      en_html_komando = 1;
                      if(!TeX && !TomeRaider) img_src("/");
                      while('<' != ch){
                          if('|' == ch){
                              getch();
                              if(!TeX && !TomeRaider) putStr(" alt=\"");
                              break;
                          }else if(!TeX && !TomeRaider) skribu(ch);
                          getch();
                      }
                  }else{
                      if(!TeX && !TomeRaider) putStr("\">");
                      en_html_komando = 0;
                  }
                  continue;
              case kapvorta:
                  lingvo = eo;
                  kapvorto(kv1, kv2);
                  if(dict) putStr("</h2>");
                  else{
                      if(!TeX && !TomeRaider) putUni(8212);
                      freshPar = !latex;
                  }
                  fermuOL();
                  skip();
                  continue;
              case l1:
                  if(finilo){
                      lingvo = lStako[--ll];
                  }else{
                      lStako[ll++] = lingvo;
                      lingvo = lat1;
                  }
                  if(latex) putStr(finilo ? "}" : "{\\TI ");
                  continue;
              case l3:  if(finilo) lingvo = lStako[--ll];
                        else{
                            lStako[ll++] = lingvo;
                            lingvo = eo;
                        }
                        continue;
              case lang: etna_lingvo(lat1, atributoj_de_elemento+1); continue;
              case mat: MATEMATIKO(0, finilo); continue;
              case name:
                   if(finilo) eraro("atendatas kapvortkomenco");
                   else{
                       filtru('<', 0);
                       getch();
                       elemento();
                       if(texi) putStr(cxeno);
                       else fPutStr(TeX ? "\\label{%s}%s" :
                                    "<a name=\"%s\">%s</a>",
                                    nova_cxeno,cxeno);
                       NAME_buf[0] = 0;
                   }
                   continue;
              case nego:
              {                 /* vd "ardiferenco" */
                  static int pako;
                  static const char open[] = "([{", close[] = ")]}";
                  if(!mmode) eraro("nematematika nego");
                  if(finilo){
                      if(9 == pako)
                          putUni(strchr("8T", signaro) ? 0x2209 : 0x2208);
                      else if(latex) putch('}');
                      else{
                          if(pako >= 0) putch(close[pako]);
                          if(kromelemento) putch(kromelemento);
                      }
                  }else{
                      pako = ('é' == kromelemento ? 9 : -1);
                      if(latex){
                          if('é' != kromelemento) putStr("\\overline{");
                      }else{
                          if(atributoj_de_elemento[0])
                              putStr(atributoj_de_elemento + 1);
                          else{
                              char *cc = 0;
                              if(kromelemento) cc = strchr(close,kromelemento);
                              if(cc) putch(open[pako = cc - close]);
                              if('8' != signaro || 'é' != kromelemento){
                                  putUni(0xac);
                                  if(!cc && pako < 0 && kromelemento){
                                      cc = strchr(open, kromelemento);
                                      pako = cc - open; /*negativa se cc== 0*/
                                      putch(kromelemento);
                                  }
                              }
                          }
                      }
                  }
                  continue;
              }
              case numero:
                   lingvo = eo;
                   kapvorto(kv1n, kv2n);
                   break;
              case quote:
                   putch(lf);
                   if(finilo){
                       if(!kromelemento) fermuOL();
                       freshPar = 0;
                       if(texi){
                           fPutStr("@end quotation\n");
                           putch(0);
                       }else if(TeX){
                           putStr("\\end{bquote}");
                           if(ch) putStr("\\noindent ");
                       }else putStr("</blockquote>");
                   }else{
                       if(texi){
                          putch(0);
                          fPutStr("@quotation");
                       }else if(TeX){
                           putStr("\\begin{bquote}");
                           if(ch) putStr("\\noindent ");
                       }else putStr("<blockquote>");
                   }
                   putch(lf);
                   skip();
                   continue;
               case scope:
                   if(pre || mmode){
                       if(latex){
                           if(finilo) putch('}');
                           else putStr("\\mbox{\\catcode32=10\\rm ");
                       }
                       if(mmode) mmode = -mmode;
                       continue;
                   }
                   if(TeX){
                       if(texi) putStr(finilo ? ">" : "<");
                       else{
                           static int krampoj;
                           if(finilo) putStr(krampoj ? "\\/}\\}" : "}");
                           else{
                               krampoj = ('~' != kromelemento);
                               putStr(krampoj ? "\\{{\\it " : "{\\it ");
                           }
                       }
                   }else if(!en_html_komando)
                       putStr(finilo ? ":)</i>" : "<i>(");
                   continue;
               case sintakso:
                   sintakse = 1;
                   preformat();
                   sintakse = !finilo;
                   continue;
               case subkapa:
                   lingvo = eo;
                   kapvorto(kv1sub, kv2sub);
                   break;
               case tabelo:
                   putch(lf);
		   if(TomeRaider) putStr("<hr>");
                   if(en_tabelo = !finilo){
                       if(texi) putch(0);
                       tabelelemento(1, "@multitable ", "<table%s",
                                     atributoj_de_elemento);
                   }else if(!TomeRaider){
                       fPutStr(texi? "@end multitable\n" :
                               TeX ? "\\end{tabular}" : "</table>");
                       putch(0);
                       if(latex && center == align){
                           putStr("\\end{center}\n");
                           align = defavxlto;
                       }
                   }
                   continue;
              case subunit: SUBSECTION(); continue;
              case url: URL(0); continue;
              case Url: URL(1); continue;
              case xref: XREF(); continue;
          }
          continue;
          }
      case del:               /* NON-LATIN-3 UNICODE: */
          if(0x2080 <= uch && uch <= 0x2089){
              if('8' == signaro) putUni(uch);
              else fPutStr(TeX? "_%d" : "<sub>%d</sub>", uch - 0x2080);
              goto G;
          }
          switch(uch){
          case 0x2191:
              putUniTexSym(uch, ensureMathTex("\\uparrow"),
                           pre || verbatim ? "@" : "^" );
              goto G;
          case 0x201e:{        /* dimensions */
              static int dimensio = 0;
              if(dimensio = !dimensio){
                  if(TeX) escTexStr("dmn{");
                  else if(!TomeRaider) skribu(ns);
              }else if(TeX) putch('}');
              goto G;
          }         
          case 0x2018:
              get_skip();
              MATEMATIKO(1, falso);
              continue;
          case 0x2019:
              getch();
              MATEMATIKO(0, vero);
              continue;
          default: putUni(uch);
      }
      goto G;        
      case'@':
          if(mmode){
              if(latex) putStr("\\vec ");
              else if(!texi){
                 get_skip();
                 fPutStr("<b>%c</b>", ch);
              }
              goto G;
          }
      break;           
      case'*': if(mmode){
                  if(signaro != '8') break;
                  putUni(0x2217); getch(); continue;
               }
               if(pre || sintakse || verbatim) break;
               getch();
               if(A_E && TeX){
                   if(texi) English_index_entry();
                   else TeX_English_index_entry();
               }else{
                   putStr(graseto ? close_bold : open_bold);
                   graseto = !graseto;
               }
               continue;
      case'-': if(pre){
	        if(TomeRaider){ putq('\226'); goto G; }
		break;
               }
               getch();
               if(mmode){
		   if(win) putq('\226');
		   else putUniSym(8722, "-");
		   continue;
	       }
               if(verbatim){
		   if(TomeRaider) putq('\226');
		   else putch('-');
		   continue;
	       }
               if(ch != '-'){
                   if(latex && eo != lingvo) putStr("\\Hyp{}");
                   else putch('-');
                   continue;
               }
               getch();
               if('-' == ch){
                   getch();
                   if(kapvorta_vosto && 0 == ch && (dict||TeX||TomeRaider)){
                       kapvorta_vosto = 0;
                       if(dict) putStr("</h2>");
                       else if(latex){
                           skip();
                           putStr(" --- ");
                           continue;
                       }
                       fermuOL();
                       putch(0);
                   }else if(win) putq('\227');
                   else putUniTexSym(8212,
				     eo == lingvo ? "^---" : "\\cdash--~",
				     "---");
	       }else if(win) putq('\226');
	       else putUniSym(8211, "--");
               continue;
      case'.': if(!uni && !win && !TeX) break;
               getch();
               if(latex){
                   if(sintakse){
                       if(0 == ch){
                           putStr(".\n\\reg ");
                           goto G;
                       }
                   }else if(!pre && ' ' == ch){
                       putch('.');
                       getch();
                       if(' ' != ch) putStr("\\ ");
                       continue;
                   }
               }
               if(pre || ch != '.'){
                   putch('.');
                   if((pre || texi) && ' ' == ch){
                       getch();
                       if(' ' == ch) PUTC(' ');
                       else putch(' ');
                   }                           
                   continue;
               }
               getch();
               if(ch != '.') putStr(mmode && latex ? "\\dDot " : "..");
               else{ 
                   getch();
                   if(win) putq('\205');
                   else if(TeX){
                       if(texi) putStr("@dots{}");
                       else if(mmode) putStr("\\dots ");
                       else{
                           penda_spaceto = 0;
                           putStr("$\\,\\ldots$");
                           if(' ' == ch) getch();
                       }
                   }else putUni(0x2026);
               }
               continue;
      case';':
          if(!mmode || !latex || !verbatim) break;
          putch(';');
          getch();
          if(' ' == ch){
              putStr("\\ ");
              goto G;
          }
          continue;
      case'\\':
          if(mmode){
              putUni4TexSym("8T", 0x2216, "\\setminus ", "\\");
              getch();
              continue;
          }else if(IPA == lingvo){
              getch();
              if(signaro != '8') break;
              if('r' == ch) putUni(0x0279);
              else if('R' == ch) putUni(0x0281);
              else eraro("nekonata renversajxo");
              getch();
              continue;
          }else break;
      case'`':
          getch();
          if('`' == ch){
              putUni4TexSym("248r", 0x201c, "``", "`");
              goto G;
          }
          hyperlink('0');
      continue;
      case'\'':
          getch();
          if(uni && mmode){    
              if('\'' == ch){
                  getch();
                  putUni(0x2033);
              }else putUni(0x2032);
              continue;
          }
          if('\'' == ch){
              if(mmode && !latex && !uni){
                  skribu('\"');
                  goto G;
              }
              if(!pre){
                  putUni4TexSym("248r", 0x201d, "''",
                               fermaCitilo||strchr("3t",signaro) ? "'" : "''");
                  goto G;
              }
          }
          putch('\'');
          continue;
      case'^':
          getch();
          if(ch && strchr("~-|", ch)){
              if(latex){
                  putch('^');
                  if('-' == ch) continue;
                  putch(ch);
                  goto G;
              }
              if(!mmode){
                  ch = '-';
                  continue;
              }
          }
          if(!mmode || TeX) skribu('^');
          else{
              fPutStr("<sup>%c</sup>", ch);
              goto G;
          }
          continue;
      case'_': if(mmode){
                  if(TeX) putch('_');
                  else{
                      getch();
                      fPutStr("<sub>%c</sub>", ch);
                  }
               }else{
                   if(sintakse || pre  || verbatim) break;
                   if(TeX){
                       if(kursivo) putch('}');
                       else putStr(texi ? "@emph{" : "\\emf{");
                   }else putStr(kursivo ? "</i>" : "<i>");
                   kursivo = !kursivo;
               }
               goto G;
      case'|':
          if(mmode){
              getch();
              if(latex){
                  if(' ' != ch && strchr("$(  {,", prev_putch)){
                      putStr("\\lvert ");
                      lvert++;
                  }else if(lvert){
                      putStr("\\rvert ");
                      lvert--;
                  }else putStr("\\mid ");
              }else putch('|');
          }else if(!en_tabelo || verbatim) break;
          else{
              getch();
              tabelelemento(0, "\n@tab ", "\n<td", "");
	      if(TomeRaider) putStr(" | ");
          }
          continue;
      case'~':
          if(!mmode) break;
          getch();
          putUni4TexSym("148", Jx, "\\lnot ", "~"); /* fajrohoko */
          continue;
        case hstroke:
            if(en_tabelo) putStr(texi ? "\n@tab " :
				 TomeRaider ? " | " :
                                 TeX ? "&\\slshape " : "<th>");
            else if(kviete) break;
            else putStr(Html);
            goto G;
        case acute:
            if(latex && mmode){
                verbatim = !verbatim;
                putStr(tt_ingado ? "\\char13}" : "\\hbox{\\tt\\char13 ");
                tt_ingado = !tt_ingado;
                goto G;
            }else if(IPA == lingvo){
                if(texi) break;
                putUni4TexSym("8",0x2b2,"\\textsuperscript{j}","<sup>j</sup>");
                goto G;
            }else if(lat2 != lingvo){
                ch = '\'';
                break;
            }
            getch();
            if('c' == ch) putUniTexSym(0x107, "\\'c", "c'");
            else if('C' == ch) putUniTexSym(0x106, "\\'C", "C'");
            else if('n' == ch) putUniTexSym(0x144, "\\'n", "n'");
            else if('ö' == ch) putUniTexSym(0x151,"\\H o", "o\"");
            else if('s' == ch) putUniTexSym(0x15b, "\\'s", "s'");
            else if('t' == ch) putUniSym(0x165, "t'");
            else if('ü' == ch) putUniTexSym(0x171,"\\H u", "u\"");
            else if('y' == ch) putUniTexSym(0x0fd, "\\'y", "y'");
            else{
                eraro("dekstra korno??");
                break;
            }
            goto G;
       case tremao:
           getch();
           if(lingvo != lat1 && lingvo != IPA){
               if(TeX)
                   if(difino) putch('}');
                   else escTexStr("dfn{");
               else if(TomeRaider) putStr(difino ? "</i>" : "<i>");
	       else putStr(difino ? "</dfn>" : "<dfn>");
               difino = !difino;
               continue;
           }
	   eraro("Tremao: Ligaturo??");
           if('A' == ch){
               if(latex){
                   putStr("{\\AE}");
                   goto G;
               }
               if(uni || ('1' == signaro)) ch = (char)0xc6;
               else {putch('A'); ch = 'E';}
               break;
           }else if('o' == ch) putUniSym(0x153,"oe");
           else if('n' == ch) putUniSym(0x14b,"ng");
           else {eraro("Ligaturo??"); break;}
           goto G;
        case zoeto:
            if(lingvo != lat2){
                if(latex){
                    fPutStr("\\SC%c{", mmode ? 'M' : 'S');
                    getch();
                    while(zoeto != ch){
                        skribu(ch);
                        getch();
                    }
                    putch('}');
                }
                goto G;
            }
	    eraro("Ogonek????");
            getch();
            if('a' == ch) putUniSym(0x105, "a,");
            else if('e' == ch) putUniSym(0x119,"e,");
            else eraro("Ogonek??");
            goto G;
        case'Â':
            if(lingvo != eo) break;
            fermuOL();
            if(TeX){
                putStr(texi ? "@A" : "\n\\A");
                if(texi&&(nodes[node_i][0]||nodes[!node_i][0])) kromkopiu = 0;
            }else if(TomeRaider){
		penda_spaceto = 0;
		putStr("<p><b>A:</b>");
	    }else putStr("<p><i>Angle:</i>");
            lingvo = lat1;
            goto G;
        case'£':
            fermuOL();
            putStrq(texi ? "@subheading Noto.\n" :
		    TomeRaider ? "<p><a:#mll><b>Noto.</b></a>" :
                    TeX ? "\n\\Fil" : "<p><b><I>Noto.</I></b>");
            goto G;
      case Mo:
          if(latex && mmode){
              putStr("\\foobin ");
              goto G;
          }
          break;
      case ff:
          fermuOL();
          if(TeX || TomeRaider) putch(lf);
          else{
              if(clearall){
                  putStr("<br clear=all>");
                  clearall = falso;
              }
              putStr("<hr>");
          }
          do{ getch(); }while(ch);
          lingvo = eo;
          goto G;
      case'&':
          if(verbatim && !pre) putHTMLsym('&');
          else if(kajo()) continue;
          goto G;
      case'ñ':
          if(!mmode || !latex) break;
          putStr("\\bar n");
          goto G;
/*        case'f': */
/*            if(!uni || mmode || pre) break; */
/*            if(eo != lingvo && lat1 != lingvo && lat2 != lingvo) break; */
/*            getch(); */
/*            if('i' == ch) putUni(0xfb01); */
/*            else if('l' == ch) putUni(0xfb02); */
/*            else{ */
/*                putch('f'); */
/*                continue; */
/*            } */
/*            goto G; */
      case'§':
          paragrafo();
          continue;
      case'·':
          if(!mmode) break;
          getch();
          if('·' == ch){
              do getch(); while('·' == ch);
              preterkontrolu('>');
              putUni4TexSym("8", 0x21dd, "\\leadsto ", "···>");
          }else putUni('·');
          continue;
      case'˘':
          if(!mmode && (!pre || !verbatim)) break;
          if(latex) putStr(eqn == align ? "&" : "\\)\\=\\(");
          goto G;
    }
    skribu(ch);
G:  getch();
  }
}

static void subbanner()
{
    int dis = 0;  /* disiga rubando inter partoj de unu cxapitro */
    char buf[goodlen];
    if(!texi){
        if(',' == ch){
            getch();
            skip();
            if(ch && ',' != ch){
                putStr("<a href=\"");
                redakteKopiuGxis(',', 'X');
                fPutStr(".%s\"><img src=\"%s/suben.gif\" ", Html, bildvojo);
                presCxen("alt=\"Sekvan paĝon! \"\nalign=\"bottom\"></a>");
            }
            preterkontrolu(',');
            skip();
            if(ch && ',' != ch){
                putStr("<a href=\"");
                redakteKopiuGxis(',', 'X');
                fPutStr(".%s\">"
                        "<img src=\"%s/supren.gif\" ", Html, bildvojo);
                presCxen("alt=\"Antaŭan paĝon! \"\nalign=\"bottom\"></a>");
            }
            preterkontrolu(',');
            fPutStr("<a href=\"HEJMO.%s\">"
                    "<img src=\"%s/indekso.gif\" alt=\"Indekson! \"\n"
                    "align=\"bottom\"></a>", Html, bildvojo);
            fPutStr("<a href=\"KOVRILO.%s\">"
                    "<img src=\"%s/kovrilo.gif\" alt=\"Instrukcion! \"\n"
                    "align=\"bottom\"></a>\n<hr>\n", Html, bildvojo);
            while(ch) getch();
        }else{    
            int rule = 0 == ch || ch != '0' && ch != '-';
            if(rule){
                if('/' == ch){
                    dis = 1;
                    getch();
                }
                if(ch){
                    enbufrigu(buf, 0, 0);
                    fPutStr("<a href=\"%s.%s\">", buf, Html);
                    img_src(bannerNumber ?
                            "/suben.gif\" alt=\"Sekvan paĝon \"" :
                            "/supren.gif\" alt=\"Antaŭan paĝon \"");
                    nivelado("14","33");
                    putch(' ');
                }
            }
            if('0' == ch || '-' == ch) getch();
            else{
                if(strncmp(Name, "HEJMO", 5)){
                    fPutStr("<a href=\"HEJMO.%s\">", Html);
                    img_src("/indekso.gif\" alt=\"Indekson \"");
                    nivelado("32","32");
                    putch(lf);
                }
                fPutStr("<a href=\"KOVRILO.%s\">", Html);
                img_src("/kovrilo.gif\" alt=\"Instrukcion\"");
                nivelado("32","32");
                putch(lf);
            }
            if(bannerNumber) putStr("</body></html>");
            else if(rule) putStr("<hr>");
        }
    }
    ++bannerNumber;
    if(2 == bannerNumber && !texi){
        bannerNumber = 0;
        sbrosBuf(0);
        fclose(celo);
        if(dis) malfermu_celon(buf);
    }    
    if(bannerNumber > 2 && !texi) eraro("Too many banners");
}
