diff -Nru csv2latex-0.16/CHANGES csv2latex-0.18/CHANGES --- csv2latex-0.16/CHANGES 2009-09-18 12:39:27.000000000 +0100 +++ csv2latex-0.18/CHANGES 2010-04-27 06:31:01.000000000 +0100 @@ -1,3 +1,12 @@ +2010-04-17 (0.18) + * workaround when double-quotes are only on some cells (Google Docs) + thanks to Florian Heinze + +2010-02-06 (0.17) + * added --repeatheder, --nohlines, --novlines + thanks to Mathew Polzin + * updated manpage + 2009-09-18 (0.16) * generated manpage added into source (docbook-to-man not needed) diff -Nru csv2latex-0.16/csv2latex.1 csv2latex-0.18/csv2latex.1 --- csv2latex-0.16/csv2latex.1 2009-09-18 12:39:27.000000000 +0100 +++ csv2latex-0.18/csv2latex.1 2010-02-06 19:20:36.000000000 +0000 @@ -3,7 +3,7 @@ csv2latex \(em convert a csv file into a LaTeX document .SH "SYNOPSIS" .PP -\fBcsv2latex\fR [\fB\-\-nohead\fP] [\fB\-\-longtable\fP] [\fB\-\-noescape\fP] [\fB\-\-guess\fP] [\fB\-\-separator \fIc\fR|\fIs\fR|\fIt\fR|\fIp\fR|\fIl\fR\fP] [\fB\-\-block \fIq\fR|\fId\fR|\fIn\fR\fP] [\fB\-\-lines \fI#\fR\fP] [\fB\-\-position \fIl\fR|\fIc\fR|\fIr\fR\fP] [\fB\-\-colorrows \fI0-1\fR\fP] [\fB\-\-reduce \fI1\fR|\fI2\fR|\fI3\fR|\fI4\fR\fP] [file] +\fBcsv2latex\fR [\fB\-\-nohead\fP] [\fB\-\-longtable\fP] [\fB\-\-noescape\fP] [\fB\-\-guess\fP] [\fB\-\-separator \fIc\fR|\fIs\fR|\fIt\fR|\fIp\fR|\fIl\fR\fP] [\fB\-\-block \fIq\fR|\fId\fR|\fIn\fR\fP] [\fB\-\-lines \fI#\fR\fP] [\fB\-\-position \fIl\fR|\fIc\fR|\fIr\fR\fP] [\fB\-\-colorrows \fI0-1\fR\fP] [\fB\-\-reduce \fI1\fR|\fI2\fR|\fI3\fR|\fI4\fR\fP] [\fB\-\-repeatheader\fP] [\fB\-\-nohlines\fP] [\fB\-\-novlines\fP] [file] .SH "DESCRIPTION" .PP This manual page documents the \fBcsv2latex\fR program. @@ -106,6 +106,17 @@ If you also use \fB\-\-nohead\fP option, do not forget to add the following line into the header of your master document: "\\usepackage{relsize}". +.IP "\fB-z\fP \fB\-\-nohlines\fP " 10 +Do not output horizontal lines in the table(s). + +.IP "\fB-y\fP \fB\-\-novlines\fP " 10 +Do not output vertical lines in the table(s). + +.IP "\fB-e\fP \fB\-\-repeatheader\fP " 10 +Repeat the first row of the first table in every table. +This is useful when the output is very long and separated in +multiple tables. + .SH "EXAMPLES" .PP Create a PDF document with small text, alternate gray rows, 80 lines per table, @@ -122,3 +133,4 @@ .SH "SEE ALSO" .PP tex (1), latex (1). +.\" created by instant / docbook-to-man, Sat 06 Feb 2010, 20:20 diff -Nru csv2latex-0.16/csv2latex.c csv2latex-0.18/csv2latex.c --- csv2latex-0.16/csv2latex.c 2009-09-18 12:39:27.000000000 +0100 +++ csv2latex-0.18/csv2latex.c 2010-04-27 06:30:41.000000000 +0100 @@ -52,6 +52,9 @@ unsigned int red; /* table reduction level (from 1 to 4)*/ unsigned int longtable; /* use package longtable */ unsigned int escape; /* escape TeX control chars or not */ + unsigned int repeat; /* repeat table headers for each LaTeX table section or not */ + unsigned int vlines; /* insert vertical lines between columns or not */ + unsigned int hlines; /* insert horizontal lines between rows or not */ char* clrrow; /* row graylevel (from 0 to 1) */ texcape* tex; /* TeX escapes */ } config; @@ -71,6 +74,9 @@ printf(" [--position ] (LaTeX) text align in cells\n"); printf(" [--colorrows graylevel] (LaTeX) alternate gray rows (e.g: 0.75)\n"); printf(" [--reduce level] (LaTeX) reduce table size (e.g: 1)\n"); + printf(" [--repeatheader] (LaTeX) repeat table header (for long tables)\n"); + printf(" [--nohlines] (LaTeX) don't put hline between table rows\n"); + printf(" [--novlines] (LaTeX) don't put vline between columns\n"); printf(" csv_file.csv\n"); printf("The \"longtable\" option needs the {longtable} LaTeX package\n"); printf("The \"colorrows\" option needs the {colortbl} LaTeX package\n"); @@ -87,25 +93,28 @@ #else int longopt_index = 0; static struct option long_options[] = { - {"help", 0, NULL, 'h'}, - {"guess", 0, NULL, 'g'}, - {"block", 1, NULL, 'b'}, - {"lines", 1, NULL, 'l'}, - {"noescape", 0, NULL, 'x'}, - {"nohead", 0, NULL, 'n'}, - {"version", 0, NULL, 'v'}, - {"position", 1, NULL, 'p'}, - {"separator", 1, NULL, 's'}, - {"colorrows", 1, NULL, 'c'}, - {"reduce", 1, NULL, 'r'}, - {"longtable", 0, NULL, 't'}, + {"help", 0, NULL, 'h'}, + {"guess", 0, NULL, 'g'}, + {"block", 1, NULL, 'b'}, + {"lines", 1, NULL, 'l'}, + {"noescape", 0, NULL, 'x'}, + {"nohead", 0, NULL, 'n'}, + {"version", 0, NULL, 'v'}, + {"position", 1, NULL, 'p'}, + {"separator", 1, NULL, 's'}, + {"colorrows", 1, NULL, 'c'}, + {"reduce", 1, NULL, 'r'}, + {"longtable", 0, NULL, 't'}, + {"repeatheader",0, NULL, 'e'}, + {"novlines", 0, NULL, 'y'}, + {"nohlines", 0, NULL, 'z'}, {NULL, 0, NULL, 0} /* marks end-of-list */ }; #endif #if defined USE_GETOPT - while ((opt = getopt (argc, argv, "hvgnxt?b:l:p:s:c:r:")) != EOF) { + while ((opt = getopt (argc, argv, "hvgnxteyz?b:l:p:s:c:r:")) != EOF) { #else - while ((opt = getopt_long (argc, argv, "hvgnxt?b:l:p:s:c:r:", long_options, &longopt_index)) > 0) { + while ((opt = getopt_long (argc, argv, "hvgnxteyz?b:l:p:s:c:r:", long_options, &longopt_index)) > 0) { #endif switch (opt) { case '?': @@ -116,7 +125,7 @@ case 'g': /* guess the CSV */ conf->guess=1; break; - case 't': /* use package longtable */ /* thanks to */ + case 't': /* use package longtable */ /* thx to */ conf->longtable=1; break; case 'b': /* csv block delimiter */ @@ -183,6 +192,15 @@ exit(EXIT_FAILURE); } break; + case 'e': /*repeat table header for each table section*/ + conf->repeat=1; + break; + case 'y': /*don't draw vlines between columns*/ + conf->vlines=0; + break; + case 'z': /*don't draw hlines between rows*/ + conf->hlines=0; + break; } } return conf; @@ -292,9 +310,15 @@ int token=0; int max; int numcols; - int lines; + unsigned int lines; int inblock=0; int csvrows; + int firstrow=1; + int nosep=0; + int token1=0; + int token2=0; + char headerrow[1000]; + headerrow[0]='\0'; max=numcols=conf->cols; csvrows=conf->rows; @@ -302,6 +326,8 @@ lines=(conf->lines)?conf->lines:MAXUINT; while (token!=EOF) { + token2=token1; /* second last character, used for detection of quotation marks */ + token1=token; /* last character, used for detection of quotation marks */ token=getc(in); /* EOF ? */ @@ -317,39 +343,80 @@ putc(newsep,out); numcols--; } - fprintf(out,"\\\\\n"); /* TeX new line */ - fprintf(out,"\\hline\n"); /* TeX draw hline */ + if (!(firstrow && (conf->longtable && conf->repeat))) { + fprintf(out,"\\\\\n"); /* TeX new line */ + } else { /* first row and repeat and longtable */ + fprintf(out, "%s\\\\\n", headerrow); + } + if(conf->hlines) { + fprintf(out,"\\hline\n"); /* TeX draw hline */ + } + if (firstrow && (conf->longtable && conf->repeat)) { + fprintf(out, "%s", "\\endhead\n"); + } + if(firstrow && conf->repeat) { + char tmp[12]; + sprintf(tmp,(conf->hlines?"\\\\\n\\hline":"\\\\\n")); + strcat(headerrow,tmp); + } + firstrow=0; numcols=max; /* reset numcols */ lines--; csvrows--; /* put a colored row or not (alternate) */ - if (conf->clrrow && (lines % 2)){ + if (conf->clrrow && (lines % 2)) { fprintf(out,"\\colorrow "); } - /* if the LaTeX tabular is full create a new one, except if no more row */ - if (!lines && csvrows){ - if (conf->longtable) { - fprintf(out,"\\end{longtable}\n"); - fprintf(out, "\\newline\n"); - fprintf(out,"\\begin{longtable}{|\n"); } - else { - fprintf(out,"\\end{tabular}\n"); - fprintf(out, "\\newline\n"); - fprintf(out,"\\begin{tabular}{|"); } - while(numcols--) - fprintf(out, "%c|", conf->pos); + /* if the LaTeX tabular is full create a new one, except if no more row or this is a long table */ + if (!lines && csvrows && !conf->longtable) { + fprintf(out,"\\end{tabular}\n"); + fprintf(out, "\\newline\n"); + fprintf(out,"\\begin{tabular}{"); + if(conf->vlines) { + putc('|',out); + } + while(numcols--) { + putc(conf->pos, out); + if(conf->vlines) { + putc('|',out); + } + } fprintf(out, "}\n"); - fprintf(out, "\\hline\n"); + if(conf->hlines) { + fprintf(out, "\\hline\n"); + } + if(conf->repeat && !conf->longtable) { + fprintf(out,"%s",headerrow); + putc('\n',out); + } numcols=max; lines=(conf->lines)?conf->lines:MAXUINT; - } /* else end of CSV data */ + } + /* else end of CSV data */ continue; } + /* if commas in cells */ + /* thx to */ + if (token == '\"'){ + if (nosep==0) + nosep=1; + else + nosep=0; + } + /* new column ? */ - if (token == conf->sep && ((conf->block && !inblock) || !conf->block)) { - putc(newsep,out); + if ((token == conf->sep && ((conf->block && !inblock) || !conf->block)) && nosep == 0) { + if (!(firstrow && (conf->longtable && conf->repeat))) + putc(newsep,out); numcols--; + if(firstrow && conf->repeat) + { + char tmp[2]; + tmp[0]=newsep; + tmp[1]='\0'; + strcat(headerrow,tmp); + } continue; } @@ -360,7 +427,7 @@ } /* data ? */ - if (token != conf->block && ((conf->block && inblock) || !conf->block)) { + if ((token != conf->block && ((conf->block && inblock) || !conf->block)) && ((token=='\"' && token1=='\"' && token2=='\"') || token!='\"')) { /* look for special TeX char to escape */ /* FIXME: put all that into a subroutine */ int i=0; @@ -370,9 +437,23 @@ switch (token) { case '\\': fprintf(out, "\\textbackslash{}"); + if(firstrow && conf->repeat) + { + char tmp[17]; + sprintf(tmp,"\\textbackslash{}"); + strcat(headerrow,tmp); + } break; default: fprintf(out, "\\%c", token); + if(firstrow && conf->repeat) + { + char tmp[3]; + tmp[0]='\\'; + tmp[1]=token; + tmp[2]='\0'; + strcat(headerrow,tmp); + } break; } break; /* there was some escaping */ @@ -380,7 +461,15 @@ } /* or print raw char */ if ( (i >= conf->tex->size) || (!conf->escape) ) { - putc(token, out); + if (!(firstrow && (conf->longtable && conf->repeat))) + putc(token, out); /* do not print the header twice */ + if(firstrow && conf->repeat) + { + char tmp[2]; + tmp[0]=token; + tmp[1]='\0'; + strcat(headerrow,tmp); + } } continue; } @@ -421,13 +510,26 @@ fprintf(out,"\\addtolength\\tabcolsep{-%sem}\n", tabcolsep[conf->red]); } if (conf->longtable) - fprintf(out, "\\begin{longtable}{|"); + { + fprintf(out, "\\begin{longtable}{"); + if(conf->vlines) + putc('|',out); + } else - fprintf(out, "\\begin{tabular}{|"); + { + fprintf(out, "\\begin{tabular}{"); + if(conf->vlines) + putc('|',out); + } while(numcols--) - fprintf(out, "%c|",conf->pos); /* position in cell */ + { + fprintf(out, "%c",conf->pos); /* position in cell */ + if(conf->vlines) + putc('|',out); + } fprintf(out, "}\n"); - fprintf(out, "\\hline\n"); + if(conf->hlines) + fprintf(out, "\\hline\n"); doTeXsub(conf, '&', in, out); /* & is LaTeX separator */ if (conf->longtable) { fprintf(out, "\\end{longtable}\n"); @@ -469,6 +571,9 @@ conf->clrrow=NULL; /* default; LaTeX */ conf->red=0; /* default; LaTeX */ conf->longtable=0; /* default; without package longtable */ + conf->repeat=0; /* default; do not repeat the header row */ + conf->vlines=1; /* default; draw lines between columns */ + conf->hlines=1; /* default; draw lines between rows */ /* TeX charaters to escape */ conf->tex=(texcape*)malloc(sizeof(texcape)); diff -Nru csv2latex-0.16/csv2latex.ebuild csv2latex-0.18/csv2latex.ebuild --- csv2latex-0.16/csv2latex.ebuild 2009-08-28 22:57:40.000000000 +0100 +++ csv2latex-0.18/csv2latex.ebuild 2010-02-06 20:01:33.000000000 +0000 @@ -3,8 +3,8 @@ # $Header: $ DESCRIPTION="A csv to LaTeX file converter" -HOMEPAGE="http://brouits.free.fr/csv2latex/" -SRC_URI="${HOMEPAGE}/${P}-0.15.tar.gz" +HOMEPAGE="http://herewe.servebeer.com/csv2latex/" +SRC_URI="${HOMEPAGE}/releases/${P}-0.17.tar.gz" LICENSE="GPL" SLOT="0" diff -Nru csv2latex-0.16/csv2latex.sgml csv2latex-0.18/csv2latex.sgml --- csv2latex-0.16/csv2latex.sgml 2009-07-16 23:26:34.000000000 +0100 +++ csv2latex-0.18/csv2latex.sgml 2010-02-06 19:18:36.000000000 +0000 @@ -95,6 +95,9 @@ + + + file @@ -275,6 +278,35 @@ + + + + + + Do not output horizontal lines in the table(s). + + + + + + + + + Do not output vertical lines in the table(s). + + + + + + + + + Repeat the first row of the first table in every table. + This is useful when the output is very long and separated in + multiple tables. + + + diff -Nru csv2latex-0.16/debian/changelog csv2latex-0.18/debian/changelog --- csv2latex-0.16/debian/changelog 2010-05-09 15:38:38.000000000 +0100 +++ csv2latex-0.18/debian/changelog 2010-04-27 15:32:10.000000000 +0100 @@ -1,3 +1,22 @@ +csv2latex (0.18-2) unstable; urgency=low + + * Switch to dpkg-source 3.0 (quilt) format + * Fixed date warning in previous changelog entry + + -- Benoît Rouits Tue, 27 Apr 2010 16:28:33 +0200 + +csv2latex (0.18-1) unstable; urgency=low + + * new upstream version + + -- Benoît Rouits <> Tue, 27 Apr 2010 16:22:55 +0200 + +csv2latex (0.17-1) unstable; urgency=low + + * new upstream version + + -- Benoît Rouits Sat, 06 Feb 2010 20:57:36 +0100 + csv2latex (0.16-2) unstable; urgency=low * fixed maintainer lines in copyright/contol diff -Nru csv2latex-0.16/debian/control csv2latex-0.18/debian/control --- csv2latex-0.16/debian/control 2010-05-09 15:38:38.000000000 +0100 +++ csv2latex-0.18/debian/control 2010-04-07 03:55:18.000000000 +0100 @@ -1,12 +1,12 @@ Source: csv2latex Section: tex Priority: optional -Maintainer: Benoît Rouits (package signature) -Build-Depends: debhelper (>= 7), docbook-to-man, cdbs -Standards-Version: 3.8.2 +Maintainer: Benoît Rouits +Build-Depends: debhelper (>= 7), cdbs +Standards-Version: 3.8.3 Homepage: http://herewe.servebeer.com/csv2latex/ -Vcs-Git: git://git.tuxfamily.org/gitroot/csv2latex/csv2latex -Vcs-Browser: http://git.tuxfamily.org/csv2latex/csv2latex.git +Vcs-Svn: http://herewe.servebeer.com/svn/csv2latex +Vcs-Browser: http://herewe.servebeer.com/svn/csv2latex Package: csv2latex Architecture: any diff -Nru csv2latex-0.16/debian/copyright csv2latex-0.18/debian/copyright --- csv2latex-0.16/debian/copyright 2010-05-09 15:38:38.000000000 +0100 +++ csv2latex-0.18/debian/copyright 2010-04-07 03:40:58.000000000 +0100 @@ -1,15 +1,15 @@ Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=48 Name: csv2latex -Maintainer: Benoît Rouits (package signature) +Maintainer: Benoît Rouits Source: http://herewe.servebeer.com/csv2latex/ -Copyright: 2003-2009, Benoît Rouits +Copyright: 2003-2010, Benoît Rouits License: GPL-2 On Debian systems the full text of the GNU General Public License can be found in the `/usr/share/common-licenses/GPL-2' file. Files: debian/* -Copyright: 2003-2009, Benoît Rouits +Copyright: 2003-2010, Benoît Rouits 2009, Rafael Laboissière License: GPL-2+ On Debian systems the full text of the GNU General Public License can diff -Nru csv2latex-0.16/debian/source/format csv2latex-0.18/debian/source/format --- csv2latex-0.16/debian/source/format 1970-01-01 01:00:00.000000000 +0100 +++ csv2latex-0.18/debian/source/format 2010-05-09 15:38:38.000000000 +0100 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru csv2latex-0.16/README csv2latex-0.18/README --- csv2latex-0.16/README 2009-09-18 12:39:27.000000000 +0100 +++ csv2latex-0.18/README 2010-04-27 06:30:41.000000000 +0100 @@ -6,11 +6,13 @@ Boaz Gezer Rafael Laboissiere Cristof Bodner + Mathew Polzin + Florian Heinze -homepage: http://brouits.free.fr/csv2latex/ -download: http://brouits.free.fr/csv2latex/csv2latex-0.14.tar.gz -checkout: git://git.tuxfamily.org/gitroot/csv2latex/csv2latex.git -browse: http://git.tuxfamily.org/csv2latex/csv2latex +homepage: http://herewe.servebeer.com/csv2latex/ +download: http://herewe.servebeer.com/csv2latex/releases/ +checkout: http://herewe.servebeer.com/svn//csv2latex +browse: http://herewe.servebeer.com/svn/csv2latex copyright: © 2003- Benoît Rouits published under license: GNU GPL version 2 (see COPYING file) diff -Nru csv2latex-0.16/version.h csv2latex-0.18/version.h --- csv2latex-0.16/version.h 2009-09-18 12:39:27.000000000 +0100 +++ csv2latex-0.18/version.h 2010-04-27 06:35:15.000000000 +0100 @@ -1,4 +1,4 @@ #define PACKAGE "csv2latex" -#define RELEASE_DATE "2009-09-18" -#define VERSION "0.16" +#define RELEASE_DATE "2010-04-27" +#define VERSION "0.18"