%%
%% This is file `texments.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% texments.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright 2008 Marek Kubica, <marek@xiviliation.net>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Marek Kubica.
%% 
%% This work consists of the files textments.dtx and texments.ins
%% and the derived file texments.sty.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{texments}
    [2008/12/27 0.2.0 The Pygments source code highligher integrated into LaTeX documents]
\RequirePackage{fancyvrb}
\RequirePackage{color}
\RequirePackage{ifthen}
\newcommand{\usestyle}[1]{
  \immediate\write18{pygmentize -S #1 -f latex > \jobname.pyg}
  \input{\jobname.pyg}
}

\newwrite\code
\newcommand{\pygment}[2]{
  \immediate\openout\code\jobname.pyg
  \immediate\write\code{#2}
  \immediate\closeout\code

  \immediate\write18{pygmentize -l #1 -f latex -o \jobname.out.pyg \jobname.pyg}
  \input{\jobname.out.pyg}
}

\newcommand{\lexercommand}[1]{}

\newcommand{\includecode}[2][auto]{
  \ifthenelse{\equal{#1}{auto}}
    {\renewcommand{\lexercommand}[1]{}}
    {\renewcommand{\lexercommand}[1]{-l #1}}
  \immediate\write18{pygmentize \lexercommand{} -f latex -o #2.out.pyg #2}
  \input{#2.out.pyg}
}


\newcommand{\proglang}[1]{}

\newenvironment{pygmented}[1]%
  {\VerbatimEnvironment
   \renewcommand{\proglang}[1]{#1}
   \begin{VerbatimOut}{\jobname.pyg}}%
  {\end{VerbatimOut}
   \immediate\write18{pygmentize -l \proglang{} -f latex -o \jobname.out.pyg \jobname.pyg}
   \input{\jobname.out.pyg}}

\endinput
%%
%% End of file `texments.sty'.
