Re: [LyX/master] skip graphics conversion when runparams.dryrun is true

2017-06-05 Thread Tommaso Cucinotta

On 04/06/2017 03:40, Enrico Forestieri wrote:

On Fri, Jun 02, 2017 at 12:55:47AM +0200, Enrico Forestieri wrote:


So, output_file is always empty, whatever op.dryrun. I think that
the following change was instead meant:

-   string const output_file = prepareHTMLFile(op);
+   string const output_file = op.dryrun ? string() : prepareHTMLFile(op);


Good catch. I agree. Please commit.


Done at 8ae652eb.


thx Enrico !

T.



Re: [LyX/master] skip graphics conversion when runparams.dryrun is true

2017-06-03 Thread Enrico Forestieri
On Sat, Jun 03, 2017 at 03:22:32PM -0400, Scott Kostyshak wrote:

> On Fri, Jun 02, 2017 at 12:55:47AM +0200, Enrico Forestieri wrote:
> 
> > So, output_file is always empty, whatever op.dryrun. I think that
> > the following change was instead meant:
> > 
> > -   string const output_file = prepareHTMLFile(op);
> > +   string const output_file = op.dryrun ? string() : 
> > prepareHTMLFile(op);
> 
> Good catch. I agree. Please commit.

Done at 8ae652eb.

-- 
Enrico


Re: [LyX/master] skip graphics conversion when runparams.dryrun is true

2017-06-03 Thread Scott Kostyshak
On Fri, Jun 02, 2017 at 12:55:47AM +0200, Enrico Forestieri wrote:

> So, output_file is always empty, whatever op.dryrun. I think that
> the following change was instead meant:
> 
> -   string const output_file = prepareHTMLFile(op);
> +   string const output_file = op.dryrun ? string() : prepareHTMLFile(op);

Good catch. I agree. Please commit.

Scott


signature.asc
Description: PGP signature


Re: [LyX/master] skip graphics conversion when runparams.dryrun is true

2017-06-01 Thread Enrico Forestieri
On Thu, Jun 01, 2017 at 01:24:35PM -0400, Scott Kostyshak wrote:

> On Fri, May 05, 2017 at 08:30:51AM +0200, Tommaso Cucinotta wrote:
> > commit 0cf394dd79337b14adb2930a617c2027e0d6f2d8
> > Author: Tommaso Cucinotta 
> > Date:   Thu May 4 07:49:07 2017 +0200
> > 
> > skip graphics conversion when runparams.dryrun is true
> 
> After this commit, if I copy a selection that has an image in it, I get
> the following message:
> 
> insets/InsetGraphics.cpp (956): InsetGraphics::xhtml: Unable to prepare file 
> `/home/scott/lyxbuilds/2017-05-17/repo/lib/images/buffer-write.svgz' for 
> output. File missing?
> 
> Attached is a patch but I have no idea if it's correct.

I think the problem is in the commit itself, which contains only
this change:

-   string const output_file = prepareHTMLFile(op);
+   string const output_file;
+   if (!op.dryrun)
+   prepareHTMLFile(op);

So, output_file is always empty, whatever op.dryrun. I think that
the following change was instead meant:

-   string const output_file = prepareHTMLFile(op);
+   string const output_file = op.dryrun ? string() : prepareHTMLFile(op);

-- 
Enrico


Re: [LyX/master] skip graphics conversion when runparams.dryrun is true

2017-06-01 Thread Scott Kostyshak
On Fri, May 05, 2017 at 08:30:51AM +0200, Tommaso Cucinotta wrote:
> commit 0cf394dd79337b14adb2930a617c2027e0d6f2d8
> Author: Tommaso Cucinotta 
> Date:   Thu May 4 07:49:07 2017 +0200
> 
> skip graphics conversion when runparams.dryrun is true

After this commit, if I copy a selection that has an image in it, I get
the following message:

insets/InsetGraphics.cpp (956): InsetGraphics::xhtml: Unable to prepare file 
`/home/scott/lyxbuilds/2017-05-17/repo/lib/images/buffer-write.svgz' for 
output. File missing?

Attached is a patch but I have no idea if it's correct.

Scott
diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
index 16a482f..2a0a90a 100644
--- a/src/insets/InsetGraphics.cpp
+++ b/src/insets/InsetGraphics.cpp
@@ -952,8 +952,10 @@ docstring InsetGraphics::xhtml(XHTMLStream & xs, 
OutputParams const & op) const
prepareHTMLFile(op);
 
if (output_file.empty()) {
-   LYXERR0("InsetGraphics::xhtml: Unable to prepare file `" 
-   << params().filename << "' for output. File missing?");
+   if (!op.dryrun) {
+   LYXERR0("InsetGraphics::xhtml: Unable to prepare file 
`" 
+   << params().filename << "' for output. File 
missing?");
+   }
string const attr = "src='" + params().filename.absFileName() 
+ "' alt='image: " + output_file + "'";
xs << html::CompTag("img", attr);


signature.asc
Description: PGP signature