GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 53ef3c90 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Rename from latex_fprintf. Don't escape quotes. Do escape braces. Properly

2000-07-25  Morten Welinder <terra@diku.dk>

	* latex.c (latex_fprintf_cell): Rename from latex_fprintf.  Don't
 	escape quotes.  Do escape braces.  Properly handle '^', '~', and
 	'\\'.  Don't return anything.
	(latex_fputs): New function extracted from latex_fprintf_cell.
	(html_write_wb_latex): Write sheet name in LaTeX style.
	(html_write_wb_latex2e): Ditto.

	[Sure looks like the following!]
parent f019b8e6
2000-07-25 Morten Welinder <terra@diku.dk>
* latex.c (latex_fprintf_cell): Rename from latex_fprintf. Don't
escape quotes. Do escape braces. Properly handle '^', '~', and
'\\'. Don't return anything.
(latex_fputs): New function extracted from latex_fprintf_cell.
(html_write_wb_latex): Write sheet name in LaTeX style.
(html_write_wb_latex2e): Ditto.
[Sure looks like the following!]
2000-07-25 Jody Goldberg <jgoldberg@home.com>
* latex.c (latex_fprint_string) : New function split from
......
......@@ -33,29 +33,31 @@
* escape special characters
*/
static void
latex_fprint_string (FILE *fp, char const *str)
latex_fputs (const char *p, FILE *fp)
{
for (; *str ; str++) {
switch (*str) {
case '>':
case '<':
fprintf (fp, "$%c$", *str);
continue;
case '&':
case '_':
case '%':
case '"':
case '$':
case '#':
fputc ('\\', fp);
default :
for (; *p; p++) {
switch (*p) {
case '>': case '<':
fprintf (fp, "$%c$", *p);
break;
case '^': case '~':
fprintf (fp, "\\%c{ }", *p);
break;
case '\\':
fputs ("$\\backslash$", fp);
break;
case '&': case '_': case '%': case '#':
case '{': case '}': case '$':
fprintf (fp, "\\%c", *p);
break;
default:
fputc (*p, fp);
break;
}
fputc ((unsigned char)*str, fp);
}
}
static void
latex_fprintf_cell (FILE *fp, const Cell *cell)
{
......@@ -64,8 +66,12 @@ latex_fprintf_cell (FILE *fp, const Cell *cell)
if (cell_is_blank (cell))
return;
/*
* FIXME: this is wrong for formulae. We should do the full math
* thing.
*/
s = cell_get_rendered_text (cell);
latex_fprint_string (fp, s);
latex_fputs (s, fp);
g_free (s);
}
......@@ -98,7 +104,7 @@ html_write_wb_latex (CommandContext *context, Workbook *wb,
sheet_list = workbook_sheets (wb);
while (sheet_list) {
sheet = sheet_list->data;
latex_fprint_string (fp, sheet->name_unquoted);
latex_fputs (sheet->name_unquoted, fp);
fprintf (fp, "\n\n");
fprintf (fp, "\\begin{tabular}{|");
for (col = 0; col <= sheet->cols.max_used; col++) {
......@@ -167,8 +173,6 @@ html_write_wb_latex (CommandContext *context, Workbook *wb,
/*
* write every sheet of the workbook to a latex2e table
*
* FIXME: Should latex quote sheet name (and everything else)
*/
int
html_write_wb_latex2e (CommandContext *context, Workbook *wb,
......@@ -199,7 +203,7 @@ html_write_wb_latex2e (CommandContext *context, Workbook *wb,
sheet_list = workbook_sheets (wb);
while (sheet_list) {
sheet = sheet_list->data;
latex_fprint_string (fp, sheet->name_unquoted);
latex_fputs (sheet->name_unquoted, fp);
fprintf (fp, "\n\n");
fprintf (fp, "\\begin{tabular}{|");
for (col = 0; col <= sheet->cols.max_used; col++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment