STARTDEF()

TYPEOUT(Zsh Yodl-to-TeXinfo converter)
DEFINESYMBOL(ztexi)

INCLUDEFILE(zmacros)
redef(ifztexi)(1)(ARG1)
redef(ifnztexi)(1)()

def(CMT)(0)(NOTRANS(@c))

ATEXIT(\
  NL()\
  NOTRANS(@contents)NL()\
  NOTRANS(@bye)NL()\
)

COMMENT(--- character translation ---)

DEFINECHARTABLE(standard)(
  '' = "@c (avoiding a yodl bug)"
  '@' = "@@"
  '{' = "@{"
  '}' = "@}"
)
USECHARTABLE(standard)
SUBST('')(NOTRANS(@value{dsq}))

def(STDPAR)(0)(redef(PARAGRAPH)(0)(NL()NL()NOTRANS(@noindent)NL()))

COMMENT(--- emphasised text ---)

def(em)(1)(NOTRANS(@emph{)ARG1NOTRANS(}))
def(bf)(1)(NOTRANS(@cite{)ARG1NOTRANS(}))
def(tt)(1)(NOTRANS(@t{)ARG1NOTRANS(}))
def(var)(1)(NOTRANS(@var{)ARG1NOTRANS(}))

COMMENT(--- man page headers ---)

def(manpage)(4)(STDPAR())
def(manpagename)(2)()

COMMENT(--- TeXinfo headers and conditionals ---)

def(texinfo)(2)(\
  STDPAR()\
  NOTRANS(\input texinfo.tex)NL()\
  NOTRANS(@c %**start of header)NL()\
  NOTRANS(@iftex)NL()\
  NOTRANS(@afourpaper)NL()\
  NOTRANS(@setchapternewpage off)NL()\
  NOTRANS(@end iftex)NL()\
  NOTRANS(@setfilename )ARG1NL()\
  NOTRANS(@settitle )ARG2NL()\
  NOTRANS(@c %**end of header)NL()\
  NL()\
  NOTRANS(@ifinfo)NL()\
  NOTRANS(@set dsq '@:')NL()\
  NOTRANS(@end ifinfo)NL()\
  NOTRANS(@iftex)NL()\
  NOTRANS(@set dsq '{}')NL()\
  NOTRANS(@end iftex)NL()\
  NOTRANS(@ifinfo)NL()\
  NOTRANS(@dircategory Utilities)NL()\
  NOTRANS(@direntry)NL()\
  NOTRANS(     * ZSH: (zsh).                     The Z Shell Manual.)NL()\
  NOTRANS(@end direntry)NL()\
  NOTRANS(@end ifinfo)NL()\
)

def(texiifinfo)(1)(\
  NOTRANS(@ifinfo)NL()\
  ARG1\
  NOTRANS(@end ifinfo)NL()\
)
def(texiiftex)(1)(\
  NOTRANS(@iftex)NL()\
  ARG1\
  NOTRANS(@end iftex)NL()\
)

def(texipage)(0)(\
  NOTRANS(@page)\
)
def(texititlepage)(0)(\
  NOTRANS(@titlepage)\
)
def(texiendtitlepage)(0)(\
  NOTRANS(@end titlepage)\
)
def(texititle)(1)(\
  NOTRANS(@title )ARG1\
)
def(texisubtitle)(1)(\
  NOTRANS(@subtitle )ARG1\
)
def(texiauthor)(1)(\
  NOTRANS(@author )ARG1\
)

def(texinode)(4)(\
  NOTRANS(@node )ARG1, ARG2, ARG3, ARG4\
)
def(texitop)(1)(\
  NOTRANS(@top )ARG1\
)

COMMENT(--- section divisions ---)

def(chapter)(1)(\
  NL()\
  NOTRANS(@chapter )ARG1NL()\
  NOTRANS(@noindent)\
)

def(sect)(1)(\
  NL()\
  NOTRANS(@section )ARG1NL()\
  NOTRANS(@noindent)\
)

def(subsect)(1)(\
  NL()\
  NOTRANS(@subsection )ARG1NL()\
  NOTRANS(@noindent)\
)

COMMENT(--- comment output ---)

DEFINECHARTABLE(texicomment)(
  '\n' = "\n@c "
)
def(comment)(1)(\
  USECHARTABLE(texicomment)\
  NOTRANS(@c )ARG1\
  USECHARTABLE(standard)\
)

COMMENT(--- cross-references ---)

def(manref)(2)(man page ARG1LPAR()ARG2RPAR())
def(zmanref)(1)(manref(ARG1)(1))
def(noderef)(1)(\
  NOTRANS(@ref{)ARG1NOTRANS(})\
)

COMMENT(--- lists ---)

def(startitem)(0)(\
  NOTRANS(@table @asis)\
  redef(ITEMX)(0)()\
)
def(enditem)(0)(\
  NOTRANS(@end table)\
)
def(item)(2)(\
  NOTRANS(@item)ITEMX() ARG1\
  ARG2\
  redef(ITEMX)(0)()\
)
def(xitem)(1)(\
  NOTRANS(@item)ITEMX() ARG1\
  redef(ITEMX)(0)(x)\
)

def(startsitem)(0)(\
  startitem()\
)
def(endsitem)(0)(\
  enditem()\
)
def(sitem)(2)(\
  item(ARG1)(NL()ARG2)\
)
def(sxitem)(1)(\
  xitem(ARG1)\
)

def(startlist)(0)(\
  startitem()\
)
def(endlist)(0)(\
  enditem()\
)
def(list)(1)(\
  item(ARG1)()\
)

def(startitemize)(0)(\
  NOTRANS(@itemize @bullet)NL()\
)
def(enditemize)(0)(\
  NOTRANS(@end itemize)\
)
def(itemiz)(1)(\
  sitem()(ARG1)\
)
  
COMMENT(--- special effects ---)

DEFINECHARTABLE(nofillchars)(
  '@' = "@@"
  '{' = "@{"
  '}' = "@}"
  '\n' = "@*\n"
)
def(nofill)(1)(\
  USECHARTABLE(nofillchars)\
  ARG1\
  USECHARTABLE(standard)\
)

def(example)(1)(\
  NOTRANS(@example)NL()\
  ARG1\
  NL()NOTRANS(@end example)\
)

def(indent)(1)(\
  NOTRANS(@quotation)NL()\
  ARG1\
  NL()NOTRANS(@end quotation)\
)

COMMENT(--- hyperlink menus ---)

def(startmenu)(0)(\
  NOTRANS(@menu)\
)
def(endmenu)(0)(\
  NOTRANS(@end menu)\
)
def(menu)(1)(\
  * ARG1NOTRANS(::)\
)

COMMENT(--- indices ---)

def(cindex)(1)(\
  NOTRANS(@cindex )ARG1\
)

def(findex)(1)(\
  NOTRANS(@findex )ARG1\
)

def(kindex)(1)(\
  NOTRANS(@kindex )ARG1\
)

def(pindex)(1)(\
  NOTRANS(@pindex )ARG1\
)

def(tindex)(1)(\
  NOTRANS(@tindex )ARG1\
)

def(vindex)(1)(\
  NOTRANS(@vindex )ARG1\
)

ENDDEF()\
