Angus Leeming wrote:

> So, can I summarise the requirement?
> 
>     // If this is a child document and the parent is
>     // already loaded, then define 'base' as parent.base().
>     // If the parent is also a child, then it would return
>     // its own 'base'.
>     string base;
>     if (!bufferparams.parentname.empty() &&
>         bufferlist.exists(bufferparams.parentname)) {
>             Buffer const * parent =
>                 bufferlist.getBuffer(params().parentname);
>             base = parent->base();
>     }
> 
> Leading to the output of:
>     os << "\\includegraphics{"
>        << base
>        << relative_file_name
>        << '}';
> 
> Some thought would have to go into the definition of Buffer::base(),
> but wouldn't this (or something like it) work automagically for
> InsetExternal also?

I think so.
I am not sure wether I understood you correctly, but I believe this is
exactly what

-       string from_file = params.filename.outputFilename(buffer.filePath());
+       // a relative filename should be relative to the master buffer
+       string from_file = params.filename.outputFilename(
+                               buffer.getMasterBuffer()->filePath());

with Jean-Marcs new method Buffer::getMasterBuffer() does. What are the
benefits of your approach? Or do you mean that this is the wrong place to
change the filename?


Georg

Reply via email to