From 2947021b917eb9d6d2add9a432017a6569a80dd8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 9 Jul 2014 21:22:00 +0000 Subject: csvsimple (8jul14) git-svn-id: svn://tug.org/texlive/trunk@34559 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/csvsimple/csvsimple.sty | 34 +++++++++++++--------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'Master/texmf-dist/tex/latex/csvsimple') diff --git a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty index dae90fe51cd..4712481c85d 100644 --- a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty +++ b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty @@ -1,4 +1,4 @@ -%% The LaTeX package csvsimple - version 1.10 (2014/07/07) +%% The LaTeX package csvsimple - version 1.11 (2014/07/08) %% csvsimple.sty: Simple LaTeX CSV file processing %% %% ------------------------------------------------------------------------------------------- @@ -18,7 +18,7 @@ %% This work consists of all files listed in README %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{csvsimple}[2014/07/07 version 1.10 LaTeX CSV file processing] +\ProvidesPackage{csvsimple}[2014/07/08 version 1.11 LaTeX CSV file processing] \RequirePackage{pgfkeys,ifthen} @@ -137,11 +137,6 @@ \@csv@scanline% } - -% default preprocessor (no preprocessing) -\def\csv@no@preprocessor#1#2{\let#2=#1\relax} - - \def\csv@preprocessor@csvsorter#1#2#3#4{% \begingroup% \catcode`\"=13% @@ -149,6 +144,16 @@ \endgroup% } +\def\csv@preprocss@none{% + \let\csv@input@filename=\csv@filename% +} + +\def\csv@preprocss@procedure{% + \csv@preprocessor{\csv@filename}{\csv@ppfilename}% + \let\csv@input@filename=\csv@ppfilename% +} + + %---- the loop \def\csv@AtEndLoop{\csv@addto@macro\@endloophook} @@ -183,7 +188,10 @@ % head line \def\csv@processheadline{% \csvreadnext% - \csv@escanline{\csvline}% + \if\csv@par\csvline\relax% + \csv@error{File '\csv@input@filename' starts with an empty line!}{}% + \else\csv@escanline{\csvline}% + \fi% \xdef\csv@columncount{\thecsvcol}% \setcounter{csvcol}{0}% \loop% @@ -269,15 +277,15 @@ \global\let\@endloophook\csv@empty% % options \csvset{default,every csv,#1}% - \csv@preprocessor\csv@filename\csv@ppfilename% + \csv@preprocss% \csv@set@catcodes% \csv@prereading% \csv@table@begin% \setcounter{csvinputline}{0}% % start reading - \openin\csv@file=\csv@ppfilename\relax% + \openin\csv@file=\csv@input@filename\relax% \ifeof\csv@file% - \csv@error{File '\csv@ppfilename' not existent, not readable, or empty!}{}% + \csv@error{File '\csv@input@filename' not existent, not readable, or empty!}{}% \else% % the head line \csv@opt@processheadline% @@ -354,8 +362,8 @@ \csvset{% file/.gstore in=\csv@filename,% preprocessed file/.gstore in=\csv@ppfilename,% - preprocessor/.gstore in=\csv@preprocessor,% - no preprocessing/.style={preprocessor=\csv@no@preprocessor}, + preprocessor/.code={\gdef\csv@preprocessor{#1}\let\csv@preprocss=\csv@preprocss@procedure},% + no preprocessing/.code={\let\csv@preprocss=\csv@preprocss@none}, column names reset/.code={\gdef\csv@columnnames{}},% column names/.code={% \toks0=\expandafter{\csv@columnnames}% -- cgit v1.2.3