On 17/08/2017 21:49, Pavel Sanda wrote:
To recap the current problems from my POV:
1. en/ should have it's own directory as a normal language
    because xhtml output target produces lot of images which clutter
    root dir (please use xhtml, not html).

sure, easy.

2. exported icons still contain original path in the filename.
    ideally we want fixed filenames for images so when you regenerate
    documentation only real changes need to be committed.

tracked down somewhat, 2 problems:
1) conversion cache: if the image (footnote.png) is found in the cache, then 
its associated absolute path is pulled in;
   workaround: wipe out ~/.lyx-trunk/cache, or equivalently run with a custom 
temporary userdir when converting manuals

still, the image is converted with the full pathname of the temporary folder where 
the conversion is being done (no conversion in this case, as it's a .png -> 
.png, but still a lot of code is executed, the file is copied, etc.), being smth. 
like /tmp/tmp.XXXXX/orig_filename.png, resulting in an exported image filename 
like: 0_tmp_tmp_XXXXX_orig_filename.png which seems still sub-optimal; this comes 
from:

2) when loading a graphics inset, LyX stores into the inset params().filename 
the absolute file path of the references image file, not the relative path; 
this can be avoided with [1], but it's not sufficient, because still LyX 
references the 0_tmp_tmp_* filename instead.

no more time for today... but perhaps the cache wipe-out work-around is already 
good enough.

        T.

[1]

diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
index 3cc550b5..2aa1b8ff 100644
--- a/src/insets/InsetGraphics.cpp
+++ b/src/insets/InsetGraphics.cpp
@@ -299,7 +299,7 @@ void InsetGraphics::read(Lexer & lex)
 {
        lex.setContext("InsetGraphics::read");
        //lex >> "Graphics";
-       readInsetGraphics(lex, buffer(), true, params_);
+       readInsetGraphics(lex, buffer(), false, params_);
        graphic_->update(params().as_grfxParams());
 }
@@ -568,7 +568,7 @@ string InsetGraphics::prepareFile(OutputParams const & runparams) const
        if (params().filename.empty())
                return string();
- string const orig_file = params().filename.absFileName();
+       string const orig_file = 
params().filename.relFileName(buffer().filePath());
        // this is for dryrun and display purposes, do not use latexFilename
        string const rel_file = 
params().filename.relFileName(buffer().filePath());
@@ -902,7 +902,7 @@ string InsetGraphics::prepareHTMLFile(OutputParams const & runparams) const string const to = findTargetFormat(from, runparams);
        string const ext  = theFormats().extension(to);
-       string const orig_file = params().filename.absFileName();
+       string const orig_file = 
params().filename.relFileName(buffer().filePath());
        string output_file = onlyFileName(temp_file.absFileName());
        LYXERR(Debug::GRAPHICS, "\t we have: from " << from << " to " << to);
        LYXERR(Debug::GRAPHICS, "\tthe orig file is: " << orig_file);

Reply via email to