% This is the master file producing gates-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 - May 2012

\input pitex
\input interpreter

\overfullrule=0pt

\setfont\mainfont:
  name = "Chaparral Pro"
  size = 18pt
  bold = Semi
  big  = 144pt

\setfont\codefont:
  name        = "Lucida Console"
  slant       = 15
  bold italic = none
  size        = 14pt
  features    = "-tlig, -trep, space = mono"

\setparameter section subsection :
  color  = ".8 0 0"
  inline = true
  toc    = true

\setparameter section :
  font   = "\mainfont\normalsize\sc"
  number = none
  clear  = false

\setparameter sectionbookmark :
  open   = true
  italic = true

\setparameter subsection :
  font = ""

\setparameter paragraph :
  number     = none
  beforeskip = 1
  color      = ".8 0 0"
  font       = ""
  aftertitle = "\hskip.6em"

\setparameter navigator :
  pre  = {\linkcolor"}
  post = {"}
  mode = bookmarks

\def\linkcolor"#1"{%
  \color{.4 .3 .3}{\ital{#1}}%
  }

\setparameter page :
  width        = 80pc
  left right   = 20pc
  lines        = 24
  baselineskip = 24pt

\Section def {section_do}[2]{%
  \noindent
  \ifstring{#1}{section}
    {\marginnote[font = \rm,
                 hpos  = rf,
                 side  = left,
                 hsize = 5cm]{\quitvmode#2}}
    {\ifstring{#1}{subsection}
       {\marginnote[hsize = 4cm]{\quitvmode#2}}
       {#2}}%
  }

\OutputRoutine close {headers}{shipout}

%%% Redefining \TeX to look better with Chaparral.
\def\TeX{%
  T\kern-.13em
  \lower.5ex \hbox {E}%
  \kern-.03em X%
  }
% \TeX in bookmarks. Takes an argument because Interpreter changes all "TeX"
% to "\TeX{}".
\pdfdef\TeX#1{TeX}

\def\gatecolor{\color{.8 0 0}}
\def\gateaction#1{%
  \directlua{pitex.callback.skip("french_punctuation")}%
  \hbox{\gatecolor{{\codefont#1}}}%
  }

\def\describe#1#2{%
  \needspace{2\baselineskip}%
  \bgroup\codefont
  \hsize=\maxdimen
  \noindent
  \gatecolor{\llap{\gateaction{\string#1}\kern.3em}%
    #2\par\egroup}\removenextindent
    \ignorespaces}

\def\comarg{\arg{command}\antigobblespace}
\def\textarg{\arg{text}}

\setbox0=\hbox to \hsize{%
  {\big \color{.8 0 0}{Gates}}%
  \hfil
  \vbox{%
    \hbox{Paul Isambert}
    \hbox{\codefont zappathustra@free.fr}
    \hbox{Version 0.2}
    \hbox{May 2012}}%
  }
\ht0=6\baselineskip \dp0=0pt
\box0
\vskip2\baselineskip

\Section skip {section_break}{section}

\input gates

\hyphenation{my-other-list}

\interpretfile{pitex}{gates-doc.txt}

\bye
