Mercurial > hg > octave-nkf
comparison scripts/plot/private/__gnuplot_print__.m @ 14174:447b57ebc27b stable
Validate suffix when printing to {eps,ps,pdf}latex devices.
* __fltk_print__.m: gl2ps is not agnostic to file suffix.
* __gnuplot_print__.m: gnuplot is not agnostic to file suffix.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 08 Jan 2012 19:23:55 -0500 |
parents | 2ff75e38c299 |
children | 5d3a684236b0 d174210ce1ec |
comparison
equal
deleted
inserted
replaced
14173:47a5e29ecc0b | 14174:447b57ebc27b |
---|---|
67 else | 67 else |
68 eps_drawnow (opts, opts.name, gp_opts); | 68 eps_drawnow (opts, opts.name, gp_opts); |
69 endif | 69 endif |
70 case {"epslatex", "pslatex", "pstex", "epslatexstandalone"} | 70 case {"epslatex", "pslatex", "pstex", "epslatexstandalone"} |
71 dot = find (opts.name == ".", 1, "last"); | 71 dot = find (opts.name == ".", 1, "last"); |
72 n = find (opts.devopt == "l", 1); | |
73 suffix = opts.devopt(1:n-1); | |
72 if (! isempty (dot)) | 74 if (! isempty (dot)) |
73 if (any (strcmpi (opts.name(dot:end), {".eps", ".ps", ".pdf", ".tex", "."}))) | 75 if (any (strcmpi (opts.name(dot:end), {strcat(".", suffix), ".tex", "."}))) |
74 name = opts.name(1:dot-1); | 76 name = opts.name(1:dot-1); |
75 else | 77 else |
76 error ("print:invalid-suffix", "unrecognized file name suffix `%s' for %s output type", | 78 error ("print:invalid-suffix", |
79 "invalid suffix `%s' for device `%s'.", | |
77 opts.name(dot:end), lower (opts.devopt)); | 80 opts.name(dot:end), lower (opts.devopt)); |
78 endif | 81 endif |
79 endif | 82 endif |
80 if (strfind (opts.devopt, "standalone")) | 83 if (strfind (opts.devopt, "standalone")) |
81 term = sprintf ("%s ", | 84 term = sprintf ("%s ", |