diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty index 4712481c85d..18345ebd5cd 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.11 (2014/07/08) +%% The LaTeX package csvsimple - version 1.12 (2014/07/14) %% 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/08 version 1.11 LaTeX CSV file processing] +\ProvidesPackage{csvsimple}[2014/07/14 version 1.12 LaTeX CSV file processing] \RequirePackage{pgfkeys,ifthen} @@ -85,11 +85,16 @@ \def\csv@trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} \catcode`\Q=11 +\def\csv@TrimBraces#1{\expandafter\csv@TrimBraces@#1\@nil{#1}} +\def\csv@TrimBraces@#1\@nil#2{\def#2{#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}\csv@TrimSpaces\csv@col@body% + \def\csv@col@body{#1}% + \csv@TrimSpaces\csv@col@body% + \csv@TrimBraces\csv@col@body% \toks@\expandafter{\csv@col@body}% \expandafter\xdef\csname csvcol\roman{csvcol}\endcsname{\the\toks@}% \fi% @@ -137,13 +142,30 @@ \@csv@scanline% } -\def\csv@preprocessor@csvsorter#1#2#3#4{% +{ + \catcode`\"=12% + \gdef\csv@passivquotes{"} +} + +\newwrite\csv@out + +\def\csv@preprocessor@csvsorter#1#2#3{% \begingroup% - \catcode`\"=13% - \immediate\write18{\csv@csvsorter@command\space -c "#1" -l "#2" -i "#3" -o "#4"}% + \typeout{<sort \csv@passivquotes#2\csv@passivquotes\space by \csv@passivquotes#1\csv@passivquotes>} + \immediate\openout\csv@out=\csv@csvsorter@token% + \immediate\write\csv@out{\string\makeatletter\string\csv@error{Call of CSV-Sorter failed! Use '-shell-escape' option or check log file '\csv@csvsorter@log'.}{}}% + \immediate\closeout\csv@out% + \immediate\write18{\csv@csvsorter@command\space + -c \csv@passivquotes#1\csv@passivquotes\space + -l \csv@passivquotes\csv@csvsorter@log\csv@passivquotes\space + -t \csv@passivquotes\csv@csvsorter@token\csv@passivquotes\space + -i \csv@passivquotes#2\csv@passivquotes\space + -o \csv@passivquotes#3\csv@passivquotes\space -q 1}% + \input{\csv@csvsorter@token}% \endgroup% } + \def\csv@preprocss@none{% \let\csv@input@filename=\csv@filename% } @@ -163,7 +185,7 @@ % auto head names \def\set@csv@autohead{% - \toks0=\expandafter{\csname\csv@current@col@clean\endcsname}% + \toks0=\expandafter{\csname\csv@current@col\endcsname}% \toks1=\expandafter{\csname csvcol\roman{csvcol}\endcsname}% \edef\csv@temp{\noexpand\gdef\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\noexpand\gdef\the\toks0{}}}% \csv@temp% @@ -174,17 +196,12 @@ \def\set@csv@head{% \toks0={\gdef##1}% \toks1=\expandafter{\csname csvcol\roman{csvcol}\endcsname}% - \edef\csv@temp{\noexpand\pgfkeysdef{/csv head/\csv@current@col@clean}{\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\the\toks0{}}}}% + \edef\csv@temp{\noexpand\pgfkeysdef{/csv head/\csv@current@col}{\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\the\toks0{}}}}% \csv@temp% \edef\csv@temp{\noexpand\pgfkeysdef{/csv head/\thecsvcol}{\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\the\toks0{}}}}% \csv@temp% } -\catcode`\Q=3 -\def\csv@@clean@@head@@nameQ#1Q{\edef\csv@current@col@clean{#1}} -\def\csv@clean@head@name{\edef\csv@temp{\noexpand\csv@@clean@@head@@nameQ\csv@current@colQ}\csv@temp} -\catcode`\Q=11 - % head line \def\csv@processheadline{% \csvreadnext% @@ -196,7 +213,6 @@ \setcounter{csvcol}{0}% \loop% \stepcounter{csvcol}% - \csv@clean@head@name% \csv@opt@headtocolumnames% \set@csv@head% \ifnum\thecsvcol<\csv@columncount\repeat% @@ -260,7 +276,7 @@ \def\csv@do@linecommand{% \csv@do@latepostline% \csv@do@preline% - \csv@body% + \csv@body\relax% \csv@do@postline% } @@ -424,13 +440,15 @@ % csvsorter command/.store in=\csv@csvsorter@command, csvsorter configpath/.store in=\csv@csvsorter@configpath, - sort by/.style={preprocessor={\csv@preprocessor@csvsorter{\csv@csvsorter@configpath/#1}{\csv@csvsorter@log}}}, + sort by/.style={preprocessor={\csv@preprocessor@csvsorter{\csv@csvsorter@configpath/#1}}}, new sorting rule/.style 2 args={sort by #1/.style={sort by={#2}}}, csvsorter log/.store in=\csv@csvsorter@log, + csvsorter token/.store in=\csv@csvsorter@token, csvsorter command=csvsorter, csvsorter configpath=., preprocessed file={\jobname_sorted._csv}, csvsorter log={csvsorter.log}, + csvsorter token={\jobname.csvtoken}, % % default for reset default/.style={ |