Commit Graph

282 Commits

Author SHA1 Message Date
José Matos
44e0940d75 Order imports
This is similar to what we have in C++ code where we order the standard
includes to be easier to read.

This is a readability change only.
2024-06-18 10:25:52 +01:00
José Matos
4534a20f1a Fix functions that used functions but did not defined it
The functions were selected from the parser files where document is
always defined.

The only case was this code was used was on document.warning.

Since our documents are well formed this code was never active and thus
the reason why we did not saw this before.

One possible solution to assure that these type of errors do not occur
is to make the convention that all the functions in lyx2lyx_tools have
as the first argument document.
2024-06-17 11:31:10 +01:00
José Matos
a0a5892ae8 Fix code
Run "ruff check --fix"

Remove unneeded imports;
Reword code to make clear the "not in" operator;
Put imports in its own line (readability);
2024-06-15 11:26:28 +01:00
José Matos
b4db3ea137 Reformat lyx2lyx code using ruff 2024-06-15 10:06:06 +01:00
José Matos
f9ec4186d7 Update lyx2lyx folder to Python 3+
Remove support for Python 2
Take advantage of new features (euphemism) not possible before due to
python 2 compatibility
2024-06-10 10:55:40 +01:00
Scott Kostyshak
677dc3b7a6 Python fixes from José Matos
See here:

  https://www.mail-archive.com/search?l=mid&q=a7960223ee91696e916b281d1d9fc55df10a9480.camel%40gmail.com

Description from José pasted below:

  Functions `length_in_bp` and `revert_flex_inset` have an error in a
  (almost) never used path. The reason why this was never triggered is
  because this is part of the code where we try all the best efforts
  to recover from an ill-formed LyX file.

  The problem is that the functions call the `document` variable to
  issue an warning if the file does not follow the usual structure.
  The simple fix is to add that variable (as the first for the
  functions) and to add them at all the places where the functions are
  called.

  For reference this code was introduced by Georg (Baum) more than 8
  years ago and it was never reported. So the issue is not urgent in
  any meaningful way. :-)

  In `lyx2lyx/lyx_2_0.py`, in the function `revert_nameref`, there is
  a call to the document variable. The same as all the above.

  In `lyx2lyx/lyx_2_4.py`, in the `class fontmapping`. Similar to the
  above but now for error.
2023-08-19 22:08:08 -04:00
Juergen Spitzmueller
d89a48483e Add missing revert routine to lyx_2_0.py 2023-01-06 14:40:25 +01:00
Pavel Sanda
d79637a88e Various python fixes suggested by pyupgrade.
Patch from Jose.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg217770.html
2022-07-31 00:36:51 +02:00
Juergen Spitzmueller
07e8e4352f lyx_2_0.pyx_ add convert_includeall method
It's better to have that param explicitly in the document.
2020-03-15 09:32:02 +01:00
Juergen Spitzmueller
4bd065f871 use revert_language in more cases 2019-03-10 13:00:10 +01:00
Günter Milde
a77cfef1c6 Fix some more lyx2lyx round-trips.
Also restore corrupted seminar example.
Add default return value to parser_tools.is_in_inset().
2018-01-24 01:04:14 +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
Uwe Stöhr
bc0591a265 lyx2lyx/lyx_2_0.py: fix a box reversion bug
- the use_makebox statement was not removed for nested boxes
2017-04-17 19:17:54 +02:00
José Matos
463e12827c lyx2lyx: more descriptive member name (document.start -> document.initial_format) 2017-03-27 10:36: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
857c099e03 Remove very old debug code. 2017-01-15 11:35:50 -05: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
b930f2a18e Remove unneeded warning. 2015-12-28 12:34:11 +01:00
Juergen Spitzmueller
ee1a99b340 cosmetics 2015-12-28 12:26:29 +01:00
Juergen Spitzmueller
106d89f7e6 revert_tabularvalign: fix removal of tabularvalign feature tag 2015-12-27 17:34:01 +01:00
Juergen Spitzmueller
6b5d5666ac Fix thinko in revert_tabularvalign 2015-12-27 17:23:16 +01:00
Richard Heck
1c66831825 Fix a couple minor issues noticed by tests. 2015-12-17 10:04:47 -05: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
Georg Baum
187790135b Fix bug #5029: Support \smash, \mathclap, \mathllap and \mathrlap.
Also improve lyx2lyx roundtrip for automatically loaded packages.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40589 a592a061-630c-0410-9148-cb99ea01b6c8
2012-01-08 12:34:12 +00:00
Georg Baum
efa0f19836 More sensible longtable caption handling (needed for bug #7412)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40522 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-18 21:27:17 +00:00
Pavel Sanda
aef6b16811 Update FSF address, patch from cornelisbb, #7735.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39523 a592a061-630c-0410-9148-cb99ea01b6c8
2011-08-25 23:10:36 +00:00
Uwe Stöhr
b9abcbb708 lyx_2_0.py: fix the format (there was a Python warning)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39385 a592a061-630c-0410-9148-cb99ea01b6c8
2011-07-30 16:45:16 +00:00
Uwe Stöhr
73810266cf lyx_2_0.py: fix bug when exporting documents containing \iddots in math to LyX 1.6.x
This must also go to branch, OK Richard?

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39383 a592a061-630c-0410-9148-cb99ea01b6c8
2011-07-30 16:40:03 +00:00
Georg Baum
e1a9839e35 remove dead code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38950 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-05 10:03:32 +00:00
Richard Heck
d87ee9fbba User Guide will not export to 1.6.x. This ID can be negative!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38486 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-25 01:47:10 +00:00
Richard Heck
74245321ca Change the passthru conversion routine again.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37833 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-02 21:46:47 +00:00
Richard Heck
6127141d4b Introduce BufferParam to control whether CSS is output in the header of
the XHTML file or to a separate style file.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37682 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-15 17:44:17 +00:00
Richard Heck
5b9b74572b Remove debugging code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37588 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-10 22:19:50 +00:00
Jürgen Spitzmüller
099394c230 * lyx_2_0.py: fix revert_xetex method.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37570 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-09 09:26:33 +00:00
Jürgen Spitzmüller
839213e389 fix lyx2lyx after r37471.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37477 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-04 07:35:12 +00:00
Edwin Leuven
119ea9cd24 support for tabular*
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37471 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-03 23:11:26 +00:00
Jürgen Spitzmüller
345a14ef09 d'oh!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37460 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-03 15:38:22 +00:00
Jürgen Spitzmüller
f27d5aa9ae * Allow to set language package on a per-document basis (fixes bug 2909).
File format change. Commit approved by Pavel on trac.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37457 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-03 14:17:31 +00:00
Richard Heck
5123774bd1 Fix lyx2lyx problem with sweave files and ParBreakIsNewline.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37353 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-28 19:48:03 +00:00
Pavel Sanda
1246a70abd Update years
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37284 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-21 13:24:23 +00:00
Richard Heck
06ee6bde14 Fix bug #7214 as best we can. The point here is that we only
want to add the \clearpage if the class has chapters.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37266 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-20 16:38:41 +00:00
Georg Baum
96bcf145d9 Fix conversion of nested box insets
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37264 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-19 22:04:45 +00:00
Georg Baum
cff0f635cc fix endless loop
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36695 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-03 19:27:35 +00:00
Jürgen Spitzmüller
f1b586d445 * lyx2lyx/lyx_2_0.py:
- remove wrong warning (bug 7100).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36574 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-29 07:09:58 +00:00
Richard Heck
7f8b868f4a Fix bug #2607.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36520 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-26 17:21:17 +00:00
Richard Heck
d83c9f3fe3 Minor style.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36509 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-26 16:07:17 +00:00
Jürgen Spitzmüller
2dc2e4770b Implement GUI for LuaTeX. File format change due to the renaming of the \use_xetex buffer param.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36500 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-26 09:42:03 +00:00
Georg Baum
f3ad535dbd Fix conversion of 1.5.x documents that conflict with mchchem
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36437 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-22 21:07:20 +00:00
Georg Baum
dea050cb93 fix bug 3008: Add subscript/superscript inset for text
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36424 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-21 17:00:12 +00:00