Both lyx2lyx and LyX write output to the terminal, and it's helpful
to know which messages are coming from lyx2lyx. For example, before
this commit if we opened a document in LyX that has a newer file format than
lyx2lyx can deal with, we see the following output in the terminal:
Warning: 619: Format not supported.
Warning: Quitting.
Error: Document format failure
The first two lines (the warnings) are output from lyx2lyx, and the
third is output by LyX. This output was particularly confusing
because I first thought "LyX tries to quit if the document is too
new?", but in fact LyX still stays open; it just doesn't open the
document. After this change, the output is now the following:
lyx2lyx warning: 619: Format not supported.
lyx2lyx warning: Quitting.
Error: Document format failure
FWIW this code is important for very old versions of lyx, older than 1.1.5 (released 19 years ago - 2000/06/06).
Funny fact of the day, byte strings do not behave as regular strings in python3 when taking and index.
To get a sub-string we need to pass a range, a integer index will not work as it happens in a regular string:
$ ipython3
...
In [30]: line
Out[30]: b'#This file was created by <mike> Tue Jan 25 10:36:51 2000'
In [31]: line[0]
Out[31]: 35
In [32]: line[0:1]
Out[32]: b'#'
The range notations works for both byte and regular strings in python 3, and it also works in python 2.
Thus the change is simple and effective. In any case I should confess that I was quite surprised by this. :-)
The external date inset was implemented as a demonstrator for external insets
in general. It was never intended for production code. Now that we have several
external insets defined we do not need the demonstrator anymore. This fixes
bugs #4398 and #9948.
Previously the commandline arguments were processed in an operating system
dependent encoding if running under python 2. Now they are converted to
unicode during the parsing, using the more modern argpase instead of optparse.
The individual conversion methods do no longer need to know anything about
commandline encoding. This fixes a bug similar to #10218 if running under
python 2 which I probably introduced during the python 3 conversion.
The LyX class works now with python 3. Certain file format conversions may
still fail (convert_multiencoding() is a hot candidate), but this will need
to be fixed in the individual modules.
This is the same as the parbreak separator and is represented on screen
as the old parbreak. Old parbreak separators are converted to latexpar
separators when they are used for introducing blank lines in the
latex output rather than for separating environments.
Instead, parbreak separators are now represented on screen by a
double line. In essence, latexpar and parbreak separators produce
the same output but are represented differently on screen.
The context menu does not account for latexpar separators and only
"true" separators can be turned each into the other one.
The term LongTable has been deprecated and moreover the renaming makes the interface easier to the eye.
File format updated to 507. (conversion based on jamatos patch)
Layout format updated to 60.
tex2ylx tests updated.
Document EmbeddedObjects.lyx has been updated.
* Increase LyX format
* New function convert_info_insets in lyx2lyx_tools.py
Use this function in the future for future updates of info insets
* Convert "inset-modify tabular" to "tabular-feature" in info insets
* Remove icon naming hack regarding "inset-modify tabular"
Increment LyX format to 504.
With this new parameter, the user can indicate that some other parameters that
are frequently switched must not be recorded in the file (as if they were a
setting specific to the user or transient, rather than a document setting). This
will play nicer with version control systems.
See the discussion, e.g.:
http://thread.gmane.org/gmane.editors.lyx.devel/157824/focus=157993 (third
solution mentioned)
TODO:
* The interface remains to be set up. We cannot change this setting from LyX
for now.
* If save_transient_properties is false, we should read the user setting as a
per-user-per-document (session) setting (e.g. like the cursor position).
* Once the above is done, we can treat \justification the same way (but it would
be even better if \justification was moved to lyxrc).
lyx2lyx did not yet know about /systemlyxdir/ and set \origin to the path
where my git tree lives instead. This path is not usable except on my machine,
so better write something more usable instead.
This is a special command line switch of lyx2lyx, so it does not interfere
with normal usage. I did not try to deduce the systemlyxdir from lyx2lyx to
be on the safe side.
This is one part of bug 9744: If you toggle between TeX fonts and non-TeX
fonts, the settings of the other choice are no longer thrown away, but stored
and re-activated if you switch back. Most parts of the patch are purely
mechanical (duplicating some BufferParams members), the only non-mechanical
change is in the GUI logic.
then just perform a null conversion. This seems better than aborting
with an error. I can imagine a script that converted all files in a
certain directory to format 498, and you don't want it to be an error
if one of them is already 498.
Prior to this, what lyx2lyx would do is convert to the lowest format
in the current version. So, e.g., asked to convert 498 to 498 it would
convert to 474. That is obviously wrong.
This brings the external inset on par with the graphics insets as far as the
clipping option is concerned. The graphicxs package supports both: A bounding
box without units (which means that bp ia assumed), and a bounding box with
units, so we can simply output the values including the units.
Being able to compile document with zipped .eps files was a useful feature of
the graphicxs package 20 years ago, but the LyX support is no longer relevant:
- The flag is ignored if preview is on
- If pdflatex is used then uncompressing happens during the compilation anyway
- If set, the flag prevents LyX from issuing proper error messages if
something with the image is wrong
- For hard disk capacities from 20 years ago not uncompressing is a useful
feature, but for current hard disk capacities it does not matter
- The external inset does not have it, and if we want to merge both insets
one day we would need to implement it there, which is even more difficult
than in InsetGraphics
Since lyX 2.0 we support to use the in_preamble tag. This allows to support more commands. For an unknown reason I forgot the jss.layout when I updated the other layouts once.
Fileformat change
The math parser could not handle multicolumn grids. This is a problem because
there is no true ERT in math (everything is parsed).
Now multicolumn cells are parsed correctly. The display is also somewhat OK,
but apart from that any multicolumn related UI is missing. Since the file
format change is now done the UI can be added at any later point. The most
important part of bug 396 is now fixed: tex2lyx does not create invalid .lyx
files anymore for formulas containing \multicolumn.
I updated the tex2lyx test cases that produce correct output. tex2lyx does
still produce invalid output for the test cases which are not updated because
of the previous format change.