% This is the master file producing interpreter-doc.pdf. The version of the
% documentation readable in a text editor is interpreter-doc.txt (input below).
% 
% Paul Isambert - zappathustra AT free DOT fr - July 2011
\input pitex

% Output stuff.
\gates remove {output_headers}{output_shipout}
\gates remove {output_postship}{output_shipout}
\gates remove {output_precheck}{output}
\gates close  {output_shipout}{output}

\newif\ifright
\newbox\leftbox
\gates def {twocol}{%
  \ifright
    \global\rightfalse
    \setbox\outputbox=\hbox{\box\leftbox\kern24pt\box\outputbox}%
    \gates ajar {output_shipout}{output}%
  \else
    \global\righttrue
    \global\setbox\leftbox=\box\outputbox
  \fi
  }
\gates add {twocol}[before output_shipout]{output}


\setparameter page :
  hsize  = 20pc
  left   = 60pt
  width  = "\dimexpr 144pt + 40pc\relax"
  lines  = 45
  height = 24cm

\setparameter section :
  font = \bf
  link = true
  number = none
  numbercommand = \llap
  beforeskip = 1

\setparameter navigator :
  open   = true
  title  = "Interpreter documentation"
  author = "Paul Isambert"
  mode   = outlines

\setparameter font :
  command = \mainfont
  name    = "Chaparral Pro"
  bold    = Semibold
  big     = 18pt

\setparameter font :
  command  = \codefont
  name     = "Lucida Console"
  bold     = none
  size     = 8pt
  features = "space = .6, -tlig, -trep, -liga"


\parfillskip=0pt plus 1fill
\def\describe#1#2#3{%
  \iflines3{\vskip\baselineskip}{\breakpage}%
  \noindent\color{.8 0 0}{%
    {\outline{#3}{\directlua{%
      local t = string.gsub("\luaescapestring{#1}", "[ (].*", "")
      tex.print(t)}}%
     \codefont#1}%
    \reverse\iffemptystring{#2}
      {\kern1em \hfil\penalty0\hbox{\ital{(#2)}}}}%
  \par\removenextindent}

\newverbatim\source{}
                   {\vskip\baselineskip
                    \hfuzz=1em
                    \codefont\parindent=0pt
                    \pdfcolorstack0 push {.8 0 0 rg}
                    \printverbatim
                    \pdfcolorstack0 pop
                    \vskip\baselineskip}

\def\arg#1{{\codefont\char"2039 #1\char"203A}}

\input interpreter

% Title
\vbox to 3\baselineskip{
\hbox to \hsize{\big Interpreter\hfil\normalsize Paul Isambert}
\hbox to \hsize{v.1.0, July 2011 \hfil \tcode{zappathustra AT free DOT fr}}
\vfil
}
% Bulk of the doc.
\interpretfile{doc}{interpreter-doc.txt}
\vskip0pt plus 1filll
\noindent\ital{Typeset with Lua\TeX\ 0.71 in Chaparral Pro and Lucida Console}

\bye
