[Templates] Plans for Template-Latex
Andrew Ford
A.Ford@ford-mason.co.uk
Thu, 01 Jun 2006 12:42:37 +0100
Hi Simon
Thanks for your input. As you say most of your points are not directly
relevant to the TT plugin, although I will have a look at performance
and error handling. I think that your points are relevant to other
Template-Latex users and am posting back to the list.
The plugin should be able to distinguish between different types of
errors and warnings (by examining the latex program output) and maybe
raise one of a predefined set of exceptions, with filter options to
specify whether it should abort or continue on errors. This would help
in cases where it is imperative that documents are complete (i.e. abort
on any error or missing image) or where you want the system to deliver
whatever it can (i.e. keep on going whatever the LaTeX error). I think
this is preferable to trying to determine whether you have got valid
LaTeX input (just as "only perl can parse Perl", "only latex can parse
LaTeX").
With regards layers on top of the LaTeX plugin, I think that might be
something to think of later. There might be some mileage in a library,
something akin to "Splash", to address certain well defined tasks.
Regards
Andrew
Simon Moore wrote:
> Hi Andrew,
>
> Glad you have taken up the Latex side of things. A few suggestions.
>
> We tend to use TT to produce on the fly PDF reports on our website.
> I appreciate some people will be using Latex for things other than
> PDF. The things we have noticed as being issues and I have no idea
> whether it would actually be something that could be fixed in TT,
> hence mailing offlist:
> 1) It is very slow at producing PDFs from TT (Perhaps this is
> just Latex, but is there anything that can be done to speed it up -
> perhaps there is a better engine for PDFs than latex and we should
> build a plugin for that?)
> 2) Latex while in theory you can do anything with it, is
> actually very difficult to do some simple things that look good and
> can cope with varying input data. e.g. we produce reports with graphs
> in, tables and text. The text can be very variable in length. We
> have a number of tables of data etc etc all this input is created by
> TT. Perhaps there is scope to provide an abstraction layer for, for
> instance standard report type layouts where everything is optimised
> and all the headache of writing good latex to cope with all the
> variable sizes and length is done for you. For example PDF report
> writer http://entropy.homelinux.org/axis_not_evil/ which is far from
> mature but has a nice idea: throw XML data at it and see it formatted
> nicely approach - which seems to fit the TT philosophy of data
> abstraction.
> 3) Might be nice to have some predefined Text filters that
> ensure everything is legal that you input to Latex
> 4) Better graphics support - very annoying when it crashes
> with an error because some image is missing (also hard to tell this is
> the error without running pdflatex at the command line) - we have to
> write loads of code to check things like this to ensure robustness.
> As we run the same TT code on windows and Linux we also have to detect
> the OS of the server and write in the graphics search Paths.
>
> Anyway I appreciate these are not necessarily issues with TT's latex
> plugin but I think they are things that might be solved / worked
> around at the plugin level. Perhaps have a low level plugin and
> higher level plugins for those of us who want to be abstracted from
> the gory details of Latex (or other PDF engines).
>
> Kind Regards
> Simon
>
> At 09:34 01/06/2006, you wrote:
>
>> Having had more of a look through the Template-Latex code I plan to
>> make (at least) two releases in the next couple of weeks.
>>
>> The first release will remove the 'latex', 'pdflatex' and 'dvips'
>> parameters from the filter interface. These parameters allow
>> absolute program pathnames to be specified in template code and to my
>> mind represent a security risk. Currently the code builds command
>> lines that are executed with system(), using either the paths
>> configured when the module was installed (defaulting to
>> "/usr/bin/latex", etc) or paths specified as arguments to the FILTER
>> directive. The current code does no sanity checking of the paths, so
>> there is nothing to stop a malicious template specifying something
>> like "FILTER latex(latex => 'rm -rf /home')". It should still be
>> possible though to set up these paths from perl code as configuration
>> items when TT2 is invoked. I hope to make this first release
>> sometime next week.
>>
>> Please let me know if you have any issues with this change.
>>
>> The second release will follow a week or two later and will add
>> functionality to run "bibtex" and "makeindex" on the latex code if
>> the plugin detects that that is necessary, plus the plugin will
>> re-run "latex" (or "pdflatex") if it detects that there are
>> unresolved labels.
>> I will provide an option to turn off this behaviour, so that the
>> plugin just runs "latex" a specified number of times: e.g. once,
>> twice (needed if there are forward references or a table of contents)
>> or three times (e.g. if there are forward references and a table of
>> contents) irrespective of whether that leaves unresolved labels. I
>> will refine this proposal and post it when I make the first release.
>> If you have any comments on this let me know.
>>
>> I also have in mind to add options to explicitly specify the
>> temporary directory in which the latex commands are run and to
>> suppress the subsequent removal of this directory. This would
>> primarily be for testing and debugging and the options would not be
>> exposed as FILTER parameters at the template level.
>>
>> Regards
>> Andrew
>>
>> --
>> Andrew Ford, Director Pauntley Prints / Ford & Mason Ltd
>> A.Ford@ford-mason.co.uk South Wing Compton House
>> pauntley-prints.co.uk Compton Green, Redmarley Tel: +44 1531 829900
>> ford-mason.co.uk Gloucester GL19 3JB Fax: +44 1531 829901
>> refcards.com cronolog.org Great Britain Mobile: +44 7785 258278
>>
>>
>>
>> _______________________________________________
>> templates mailing list
>> templates@template-toolkit.org
>> http://lists.template-toolkit.org/mailman/listinfo/templates
>>
>>
>>
>> --
>> No virus found in this incoming message.
>> Checked by AVG Anti-Virus.
>> Version: 7.1.394 / Virus Database: 268.8.0/353 - Release Date:
>> 31/05/2006
>
>
--
Andrew Ford, Director Pauntley Prints / Ford & Mason Ltd
A.Ford@ford-mason.co.uk South Wing Compton House
pauntley-prints.co.uk Compton Green, Redmarley Tel: +44 1531 829900
ford-mason.co.uk Gloucester GL19 3JB Fax: +44 1531 829901
refcards.com cronolog.org Great Britain Mobile: +44 7785 258278