Bo Peng wrote:
Richard (JMarc), will you accept a 'open by winzip' solution as Enrico
proposed?
Note that we could as well use the internal zip for opening such files, no
need to do that externally.
There are some issues here.
1. When a user opens filename.lyz, Richard's proposal, as far as I
understand, it to create filename.lyxdir/content.lyx directly. From a
user's point of view, he is working on filename.lyz. (There is a
current directory problem I will talk about later when we decide on
this issue).
2. Enrico's proposal was that by letting users extract the zip file
explicitly, *we* do not have to worry about where the user want to put
it, whether or not some file will be overwritten, and whether or not
some file might be extracted to some improper places. If Lyx does
this, this will be our responsibility.
I guess my question is: do you want users to *think* they are working
on filename.lyz in that directory (Richard's), or they are working on
filename.lyxdir/content.lyx in a new folder created by lyx (Enrico's)?
The way _I_ would like things to work for me (the use case 2 I was
talking about) is as follow:
1) I write a document in tradional, unbundled, fashion: 'filename.lyx'
2) When I am done, I click "save in bundled format". This will generate
a 'filename.lyz' file wherever I said to generate it (could be in the
same directory). This bundle creation was done in two steps:
a) create a [tmpdir]/filenamedir.lyxdir/ directory
b) copy filename.lyx to [tmpdir]/filename.lyxdir/content.lyx
c) copy layout (if not standard) and biblio to
[tmpdir]/filenamedir.lyxdir/embed/
d) copy referenced files to [tmpdir]/filename.lyxdir/embed/
e) modify [tmpdir]/filenamedir.lyxdir/content.lyx so that file
reference point to the corresponding files in
[tmpdir]/filenamedir.lyxdir/embed/. The session info should keep a trace
of the original referenced file paths.
f) zip the directory filenamedir.lyxdir/ into filenamedir.lyz
3) I send this filenamedir.lyz to my reviewer. There is basically two
modes of operation for the reviewer:
3-a) He only want to touch at the text contents. In this case there is
no real need for him to unbundle. So LyX should automatically unzip the
archive in [tmpdir]/filenamedir.lyxdir/ and open
[tmpdir]/filename.lyxdir/content.lyx, this user doesn't need to know
where the other files are. When saving, only content.lyx in the archive
needs to be updated, simple.
3-b) The reviewer wants to touch at some of the embedded files. In this
case, he should first unbundle filenamedir.lyz into current directory.
This will create 'filename.lyx' directly extracted from 'content.lyx' in
the archive as well as the 'filename.embed' subdirectory directly
extracted from the 'embed/' directory in the archive. When the reviewer
is done with his corrections/additions, he just has to click on "save in
bundled format" (step 2 above) and send me back the file.
4) I receive the file and review the change in bundled mode.
4-a) If I am fine with the addition I can click on "merge with lyx
file". I select the original filename.lyx file. LyX notice that there is
a session for this file and proceed to the merging. For each of the
embedded file that has changed, LyX should ask me whether I want to
overwrite the original file. An "accept all" button could speed up this
process if desired.
4-b) I want to study a bit deeper the addition so I choose to unbundle
the file, see 3-b. I revert any change file that I am not happy with and
then I can merge the file.
This has something to do with user's understanding with how embedding
works, and how to interpret ../../images/file.png if we ever allow
such file to exist in our .lyx file.
If the lyx file is coming from a bundle, this won't happen as all images
will be in the embed/ directory. There is no room for interpretation the
way I see it.
And do you keep our 1.5.x way of working? I
mean, allow users to user any files without copying them to a
directory.
Yes, we should of course not forbid out of tree reference files.
You said that you also want to keep 1.5.x (non-dir) format, right?
Not really, I just said that, following the KISS principle, we should
not allow out of tree file reference. Everything needs to be properly
moved before the bundling can take place, see step 2.
To
what degree do you want to be able to convert *back* from the bundled
directory format to the non-dir format?
IMHO only the original author needs to convert back to the original
filename. All others can stay working with the bundle. Any more
complicated way of working need a proper solution using an SCM or just
by exchanging archive file; but this is out of the LyX domain IMHO.
This has two implications
1. Content.lyx in the bundle is actually in 1.5.x format, so there is
actually no *back* conversion.
This cannot happen with my proposal, see above.
When you open content.lyx directly in
unbundled mode, as Richard suggested, you simply stops copying files
to this directory. Note that there is a 'bundle content.lyx' problem
here so either lyx should know it is in a bundled directory (open
content.lyx directly), or a content.lyxdir/content.lyx will be created
when you bundle content.lyx.
I am not very keen personally on having filename.lyxdir created when
unbundling. As I said in step 3-b, LyX should unzip the archive
filename.lyz in the temp directory and move the archived 'content.lyx'
file and 'embed/' directory to 'filename.lyx' and 'filename.embed/'
respectively.
2. However, when you convert from an existing file to the bundled
format, you lose a lot of information, and you copy files around. Do
you wish to be able to recover your original file?
Yes, via the session info, see 2-e and 4
Abdel, please do not get mad at these subtle questions, I am not being
annoying here, these are indeed my concerns.
I hope I was clear enough. But I am affraid I ended up providing yet
another proposal. Hopefully you can make something out of it :-)
Abdel.