Andre Poenitz wrote:

> On Fri, Sep 19, 2003 at 11:23:22AM +0000, Angus Leeming wrote:
>> InsetInclude should no longer creak at the joints and is now buffer
>> agnostic, as it should be. However, it strikes me that it performs two
>> separate tasks:
>> 
>> 1. Include a LyX file. Lots of code to extract info from this LyX file.
>> 
>> 2. Include a LaTeX file. Output 4 different 'flavours' of latex, \include,
>> \input, \verbatimitem, \verbatimitem*.
>> 
>> It could be simplified enormously if we moved this latter functionality
>> over to the External inset. Shall I do this?
> 
> I have no clue what exactly you are proposing, but if it simplifies
> things I surely won't try to stop you...
> 
> [Don't waste time to try to explain it to me...]

Don't be daft. Of course I explain:

* InsetInclude should include LyX files only. 
Stored data: the name of the LyX file. Nothing else.

* InsetExternal can handle external files. For example, it can tell us when 
the file has changed and that we must re-run latex again. It uses a template 
to tell us how to handle export of Xfig files to latex. We could have Input, 
Include, Verbatiminput and Verbatiminput_star templates telling us how to 
present the file to latex in these ways.

For example, the XFig template (see lib/external_templates) has this
        Format LaTeX
                Product "\\xfiginput{$$Basename.pstex_t}"
                UpdateFormat pstex
                UpdateResult "$$Basename.pstex_t"
                Requirement "graphicx"
                Preamble XFigInput
        FormatEnd

which outputs two snippets of latex, the definition of the 'xfiginput' macro, 
and '\xfiginput{your_file.pstex_t}'. Conversion of the Xfig file to pstex_t 
is handled by the conversion machinery.

The Include template could be trivial:
        Format LaTeX
                Product "\\include{$$FName}"
        FormatEnd

Ditto for the other flavours, \input, \verbatiminput etc.

-- 
Angus

Reply via email to