% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% vim: filetype=tex tabstop=4 expandtab shiftwidth=4 softtabstop=4
% pnw documentation
%% TOPMATTER ------------------------------------------------%{{{
%@chunk(main,format=latex)
%@path(../..)
%@path(..)
%@import(latex-blocks.tex)
%@import(md-blocks)
%@import(pnw.pnw)
%@include(ltxheader)
\begin{abstract}
%@include(moduledoc)    
\end{abstract}

\maketitle
\tableofcontents
%\listoffigures

\newpage
%}}}

% SECTION 1 
\section{\pnw\ language syntax}
%@include(moduledoc synopsis)

\subsection{options, markup languages}

The syntax for the |block|/|chunk| tag is similar to the syntax for |python|
functions. In detail
\begin{lstlisting}
    chunk(arg1,arg2,...,argn,kwarg1=value1,...,kwargm=valuem)
\end{lstlisting}
So far the following options are available
\begin{description}
    \item[remove] Removes block completely from its parent block.
\end{description}        
Furthermore, the following keyword arguments are observed:
\begin{description}
    \item[format=\{pandoc format\}] Specifies the formatting of the following
        block. Any format which |pandoc| can handle is allowed. E.g. if a
        block is |markdown| formatted and it includes another block using the
        include directive, the program tries to convert that block into
        |markdown| as well.
\end{description}        


\section{Usage}
\subsection{CLI}
Command line usage is as follows
\begin{lstlisting}
pnw <options> <file>
\end{lstlisting}
where |<file>| is the pnw file. The following options are available
\begin{description}
    \item[-R, --chunk |<chname>|] Extracts chunk |chname| and renders it.
    \item[-F] Renders whole file as one chunk.
    \item[-f, --format] Output format, can be any format supported by
        |pandoc|.     
    \item[-t, --tree] Show document tree.
    \item[-d, --depth] Traverses the tree up to depth d. Nodes of depths
        d are indicated as |<<name>>|, as in noweb, and not expanded any further.
\end{description}        

\subsubsection{Example}
The command
\begin{lstlisting}
pnw -Rmoduledoc -flatex pnw.pnw > pnw.tex
\end{lstlisting}
renders the chunk `moduledoc` from the source file `pnw.pnw` in latex
format and writes the result to the file `pnw.tex`.

%@include(pymodule-md)

%}}} 
\bibliography{localbib}
\bibliographystyle{amsalpha-lmp}

% CUT AND PASTE MATERIAL
%\section{Cut- and paste material}
\end{document}

