On Thu, Jun 14, 2007 at 06:49:17PM -0400, Richard Heck wrote:

> Enrico Forestieri wrote:
> > On Thu, Jun 14, 2007 at 04:06:16PM -0400, Richard Heck wrote:
> >
> >   
> >> I've added two scripts: a dir_copy.py script, that simply copies the 
> >> entire temporary directory over to a subdirectory of the intended output 
> >> directory, and a tex4html_copy.py script that copies only .png, .html, 
> >> and .css files, these (I'm pretty sure) being the only kinds of files 
> >> generated by htlatex. What happens, in the end, then, is that if you 
> >> open /path/to/file/LyXFile.lyx and do File>Export>HTML, then you end up 
> >> with a (possibly new) directory /path/to/file/LyXFile.html.LyXconv/ and 
> >> all the relevant files are in there. Rather, say, than scattered across 
> >> /path/to/file/, which would make it a hassle then to move them to a 
> >> webserver.
> >>     
> > When the html converter is not htlatex, why don't you simply take a
> > snapshot of the files that are in the temp dir just before calling the
> > converter, put their names in a file, say "FilesToNotBeCopied", and
> > then use a html_copy.py script that copies only those files that are
> > not listed in "FilesToNotBeCopied"?
> >   
> Yes, we discussed this before, and I thought about that, but there are 
> two problems. One is that we don't know that none of the files that are 
> generated by the HTML converter over-write files that are already 
> present. I don't know that this would be a common problem, but it's 
> possible. I had proposed trying to check the timestamps to avoid this 
> problem, but that turned out to be useless, because of the granularity 
> of the timestamps.

On POSIX systems the granularity is 1 second, on Windows with FAT it
is 2 seconds. So, what about creating a file, taking its timestamp,
waiting for 2 seconds and then calling the converter?

> The other is that it involves messing with 
> Converters.cpp, which is what I was kind of trying not to do. And we 
> don't want to check there what the converter is, so we'd have to 
> generate this file all the time. I guess there could be a special flag 
> for that, but that just seems so messy. The better solution would be for 
> me to find out what latex2html generates, then write a special script 
> for it.

This is wrong, as you also have to take into account tth, hevea and I am
sure that an user could use some other converter that you don't know
about.

> > You may also want to check if one of the `files' created by the
> > converter is instead a directory and properly copy that, too.
> >   
> I'll add that to the dir_copy.py program. It actually means I can just 
> use copytree(), so everything gets simpler.

Yes, simpler, but this way you are going to copy a lot of trash and
I am not sure that a casual user is able to sort out the mess.

-- 
Enrico

Reply via email to