Commit Graph

176 Commits

Author SHA1 Message Date
Günter Milde
a151b274bf Fix lyx2lyx dash conversion and make it faster. 2018-01-24 17:38:19 +01:00
Günter Milde
67eca412ff Fix some lyx2lyx round-trip tests.
Fix cases where lyx2lyx adds changes with every round cycle
uncovered by recent ctest change.

Add optional `delete` argument to parser_tools.get*value():
If True, delete the matching line.

More efficient "allowbreak" con/reversion.
2018-01-23 14:01:30 +01:00
José Matos
37901e2e25 lyx2lyx: Cosmetic clean up of the lyx_2_?.py files.
Remove the duplicated \# -*- coding: utf-8 -*-
lines that show in the third line.
As far as I know they are not used, the first line though is used
by python and text editors (emacs, vi & co) to get the file encoding.
That will also work in the second lines (because of the shebang convention)
but not in other lines.

Remove trailing whitespaces.
2017-03-27 10:16:31 +01:00
Richard Heck
e57e008e88 Remove debugging code. 2016-08-05 21:39:58 -04:00
Richard Heck
0f4c14bba2 Fix hang reported at #10307.
Also, add a FIXME explaining what we'd need to do to fix the
convert_TeX_brace_to_Argument routine properly.
2016-07-23 13:44:34 -04:00
Richard Heck
1db883e183 In lib/lyx2lyx/: s/while 1/while True/ 2016-06-25 17:38:06 -04:00
Georg Baum
e93013057f Add missing backslashes
Found by 2to3, but useful for python2 as well for consistency reasons.
2016-06-08 22:17:14 +02:00
Juergen Spitzmueller
61b54f87df Simplify the logic 2015-12-28 16:11:26 +01:00
Juergen Spitzmueller
2e6f54b37f Eclude possible unwandted case 2015-12-28 16:10:26 +01:00
Juergen Spitzmueller
952a963c15 Escape correctly 2015-12-28 16:09:47 +01:00
Juergen Spitzmueller
28a22f40fb Whitespace 2015-12-28 13:42:36 +01:00
Richard Heck
1c66831825 Fix a couple minor issues noticed by tests. 2015-12-17 10:04:47 -05:00
Richard Heck
2c602ab051 Simplify lyx2lyx code a bit, and correct a mistake in my previous
patch. Also fix some escaping problems (\end instead of \\end).

My testing revealed some other problems with this routine: stray
\noindent tags popping up here and there. I don't have time to fix
it right now but will try to come back to it.
2015-11-25 00:51:05 -05:00
Uwe Stöhr
13c6350155 lyx_2_1.py: fix a mistake in previous commit 2015-11-25 00:05:44 +01:00
Uwe Stöhr
bfc749eb23 stdlayouts.inc: support for verbatim*
fileformat change
2015-11-24 23:56:26 +01:00
Juergen Spitzmueller
0e62bf9e0a Fix thinko in convert_corollary_args
Fixes: #9478
2015-03-24 21:43:25 +01:00
José Matos
9a0d70a45f First step to make lyx2lyx code support both python 2 and python 3 (3.3+)
Most of the changes are related with dictionaries returning views instead of
lists.

xrange -> range (since xrange is gone in python 3)

The code that is special to support both python 2 and 3 is enclosed in a comment
 \# Provide support for both python 2 and 3
and
 \# End of code to support for both python 2 and 3

And so later it can be removed safely when python 2 is no longer supported.
2015-03-11 12:09:18 +00:00
Juergen Spitzmueller
712773eeed Fix reversion of beamer description overlay args
Candidate for branch.
2015-02-13 17:45:38 +01:00
Juergen Spitzmueller
b47b4299e0 Fix conversion of beamer block arguments where the overlay argument and the closing title argument bracket share the same ERT
Fixes: #9411
2015-02-13 16:01:57 +01:00
Juergen Spitzmueller
24d3236493 Fix conversion of frame ends when frame is nested in inset
Fixes: #9409
2015-02-13 10:15:29 +01:00
Juergen Spitzmueller
9a84737d5b Honor paragraph parameters when converting chunk layouts.
Fixes: #9320.
2014-12-01 12:35:46 +01:00
Jean-Marc Lasgouttes
6442b3a0c0 Fix reverting of chunks insets to 2.0 format
When the chunk inset did not have an optional argument, the prefix of the chunk was omitted.

Fixes bug: #9343
2014-11-27 16:32:58 +01:00
Juergen Spitzmueller
4066fcac16 Fix conversion of beamer block titles when the language is switched at the beginning of the title 2014-11-25 17:47:14 +01:00
Richard Heck
9ee9c9b97d Fix bug 9300. We need manually to convert newlines to paragraph breaks.
(cherry picked from commit 8f40d784c0)
2014-11-04 10:05:59 -05:00
Juergen Spitzmueller
15d3b7bae2 lyx2lyx: fix convert_chunks for empty chunk layouts
Fixes: #9298
2014-10-15 14:07:14 +02:00
Juergen Spitzmueller
5fed02159c Fix some convert_TeX_brace_to_Argument glitches
Fixes: #9273
2014-09-16 17:42:19 +02:00
Juergen Spitzmueller
98ab605041 Fix lyx2lyx issue with complex beamer arguments.
Fixes: #9254
2014-08-30 13:24:29 +02:00
Juergen Spitzmueller
e9681bbe08 Do not break documents with complex beamer block ERT usage we cannot handle
Fixes: #9144
2014-08-03 12:21:35 +02:00
Juergen Spitzmueller
d62ba3c333 Improve parsing of ERT arguments in beamer block titles.
Fixes: #9225
2014-08-01 09:42:43 +02:00
Juergen Spitzmueller
cc56c64ede Fix beamer block conversion when arguments are in multiple ERTS.
Fixes second part of #9208.
2014-07-27 11:30:25 +02:00
Juergen Spitzmueller
728cf1edf3 Add beamer-resenumerate (from our wiki) to the list of safe modules for argment conversion, since it is safe.
Fixes part of #9208.
2014-07-27 10:23:17 +02:00
Georg Baum
22dcdd6d8f Fix bug #9162: Missing \use_indices
The lyx2lyx conversion for format 352 was incomplete: It should have been
added the \use_indices setting, but it relied on the fact that the default in
LyX for missing \use_indices is the same as the old format without that
setting used. However, the default might change in the future, and later
lyx2lyx conversions rely on that setting as well.
2014-07-04 19:55:44 +02:00
Enrico Forestieri
0080201977 Avoid processing multiple times the same paragraph when converting latex arguments. 2014-05-29 11:05:34 +02:00
Enrico Forestieri
dbd4d781dc Fix an off-by-one error in the reversion of beamer documents. 2014-05-29 10:55:30 +02:00
Enrico Forestieri
da75d31948 Fix reversion of box insets. 2014-05-29 10:44:02 +02:00
Juergen Spitzmueller
c7eb04158f Clean up empty ERTs that are produced in comples beamer argument conversions 2014-05-25 22:46:42 +02:00
Juergen Spitzmueller
e8e75f45b9 Support spreaded argument delimiters in beamer block conversion 2014-05-25 22:42:44 +02:00
Juergen Spitzmueller
57664026f2 In collorary conversion, support argument delimiters spread over several ERTs
The roundtrip still has issues.
2014-05-25 15:08:08 +02:00
Juergen Spitzmueller
36051e1daa Fixes in the beamer block routine
This makes beamerlyxexample1 open after the roundtrip, but the file does not compile yet (remaining issues in other routines)
2014-05-25 15:00:38 +02:00
Juergen Spitzmueller
c21e51a4f9 Fix nesting in some beamer reversion methods.
Patch by Enrico
2014-05-21 11:37:51 +02:00
Juergen Spitzmueller
9b4160e0f8 Fix reversion of beamer overprint when a nested paragraph has an argument 2014-05-21 11:36:47 +02:00
Richard Heck
72acf9fb27 Fix copy/paste error, and whitespace. 2014-05-19 09:41:05 -04:00
Richard Heck
eb26d85dc9 Add limits to searches in convert_TeX_brace_to_Argument. 2014-05-18 11:24:53 -04:00
Juergen Spitzmueller
769b585176 Beamer block conversion: consider ERT arguments with leading/trailing blanks
Should also go to branch.
2014-05-08 15:14:44 +02:00
Georg Baum
d6fecb4aa4 Fix table rotate conversion to 2.0 format
The old code did create invalid documents, since the space between the rotate
flag dn the previous flag was removed.
2014-04-27 20:58:53 +02:00
Juergen Spitzmueller
dced492489 Fix conversion of beamer block titles that end with a non-ERT inset.
Should also go to branch!
2014-04-26 17:39:56 +02:00
Georg Baum
52d2588613 Fix lyx2lyx math package defaults (bug #9069)
lyx2lyx sets all new math packages to off when converting from old formats.
This is correct if any command which would cause an automatic package loading
exists in the document. However, it is wrong if no command exists: This leads
to problems if later a command is added (bug #9069), which is especially
annoying for templates.
The fix consists of two parts:
1) convert_use_package() considers now the used commands like
   revert_use_package(), and uses them to decide whether to set the package to
   auto or off.
2) convert_undertilde() and revert_undertilde() use a slightly adjusted copy of
   convert_use_package() and revert_use_package(), so that the bug is also
   fixed for undertilde. We cannot use the latter functions directly, because
   of "\usepackage undertilde" vs. "\use_undertilde".
2014-04-25 22:39:22 +02:00
Georg Baum
5710f68c34 Fix math package conversion to 2.0 format
When doing the lyx2lyx round trip of the 2.0.8 user guide from format
413 -> 474 -> 413 you get an invalid document, because the math packages
mhchem and undertilde are incorrectly converted.
It turned out that the old reversion code did only work for particular
package oderings. The new one works for abitrary sorted packages.
2014-04-25 22:12:04 +02:00
Georg Baum
2fe07e1fe1 Fix data loss in user guide conversion to 2.0.x
When doing the lyx2lyx round trip of the 2.0.8 user guide from format
413 -> 474 -> 413 you do not get a zero diff. The most important problem is
caused by the conversion of the argument insets to the old syntax: This
conversion adds an additional empty line (harmless), and it destroys the
document structure if the first inset in e.g. a subsection is not an argument
inset, but e.g. an index or label inset.
The fix is quite easy: Ensure that the paragraph begin is set to the first
argument inset.
2014-04-25 21:35:51 +02:00
Georg Baum
cacd2a041d Fix warning in lyx2lyx 2.0<->2.1 round trip
revert_justification() issues a warning if the \justification parameter does
not exist, and LyX itself always writes it unconditionally as well, so add it
also in lyx2lyx when converting old documents.
Currently this does not have any user visible effect, but it decouples the
default value of BufferParams::justification from the conversion of old
documents: Now it is possible to set the default to false in LyX, and old
documents will still be converted correctly.
2014-04-24 21:52:32 +02:00