diff options
author | Karl Berry <karl@freefriends.org> | 2013-09-26 22:25:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-09-26 22:25:30 +0000 |
commit | 1297f178ba3a3f477c3af759f9a281c91e4e79de (patch) | |
tree | d30d6e4a95b6e6c8ee1144b58a4ed0b2b0778c3e /Master/texmf-dist/tex/latex/csvsimple | |
parent | fbcbe9b36240e101914f4b687e609ef5e03b3747 (diff) |
csvsimple (26sep13)
git-svn-id: svn://tug.org/texlive/trunk@31777 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/csvsimple')
-rw-r--r-- | Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty index 54a54d36c3a..51e622ee8ed 100644 --- a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty +++ b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty @@ -1,8 +1,8 @@ -%% The LaTeX package csvsimple - version 1.06 (2012/11/08) +%% The LaTeX package csvsimple - version 1.07 (2013/09/25) %% csvsimple.sty: Simple LaTeX CSV file processing %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2008-2012 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> +%% Copyright (c) 2008-2013 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -18,7 +18,7 @@ %% This work consists of all files listed in README %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{csvsimple}[2012/11/08 version 1.06 LaTeX CSV file processing] +\ProvidesPackage{csvsimple}[2013/09/25 version 1.07 LaTeX CSV file processing] \RequirePackage{pgfkeys,ifthen} @@ -74,34 +74,51 @@ % the original code on the web. The original author was Michael Downes, who % provided the code as an answer to 'around the bend' question #15. \catcode`\Q=3 -\def\TrimSpaces#1{% +\def\csv@TrimSpaces#1{% \begingroup% \aftergroup\toks\aftergroup0\aftergroup{% - \expandafter\trimb\expandafter\noexpand#1Q Q}% + \expandafter\csv@trimb\expandafter\noexpand#1Q Q}% \global\edef#1{\the\toks0}% } -\def\trimb#1 Q{\trimc#1Q} -\def\trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} +\def\csv@trimb#1 Q{\csv@trimc#1Q} +\def\csv@trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} \catcode`\Q=11 -% needs \csv@termination -\def\csv@breakline#1,{% +\def\csv@breakline@kernel#1{% \ifx\csv@termination#1\let\nextcol=\relax\else% \let\nextcol=\csv@breakline% \stepcounter{csvcol}% - \def\csv@col@body{#1}\TrimSpaces\csv@col@body% + \def\csv@col@body{#1}\csv@TrimSpaces\csv@col@body% \toks@\expandafter{\csv@col@body}% \expandafter\xdef\csname csvcol\roman{csvcol}\endcsname{\the\toks@}% \fi% \nextcol% } -% adds \csv@termination -\def\csv@scanline#1{% +% comma +\def\csv@breakline@A#1,{\csv@breakline@kernel{#1}} + +\def\csv@scanline@A#1{% \setcounter{csvcol}{0}% \csv@breakline#1,\csv@termination,% } +% semi colon +\def\csv@breakline@B#1;{\csv@breakline@kernel{#1}} + +\def\csv@scanline@B#1{% + \setcounter{csvcol}{0}% + \csv@breakline#1;\csv@termination;% + } + +% pipe +\def\csv@breakline@C#1|{\csv@breakline@kernel{#1}} + +\def\csv@scanline@C#1{% + \setcounter{csvcol}{0}% + \csv@breakline#1|\csv@termination|% + } + % expands a CSV line and scans content \def\csv@escanline#1{% \toks@\expandafter{#1}% @@ -360,6 +377,13 @@ table foot/.gstore in=\csv@tablefoot, @table/.code 2 args={\gdef\csv@table@begin{#1}\gdef\csv@table@end{#2}}, no table/.style={@table={}{}}, + separator/.is choice, + separator/comma/.code={\global\let\csv@scanline=\csv@scanline@A% + \global\let\csv@breakline\csv@breakline@A}, + separator/semicolon/.code={\global\let\csv@scanline=\csv@scanline@B% + \global\let\csv@breakline\csv@breakline@B}, + separator/pipe/.code={\global\let\csv@scanline=\csv@scanline@C% + \global\let\csv@breakline\csv@breakline@C}, % % default for reset default/.style={ @@ -384,7 +408,8 @@ after table=, table head=, table foot=, - no table + no table, + separator=comma, }, default, % |