Commit Graph

104 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
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
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
José Matos
ea8b0df0e4 Add new semantic functions to add an remove document options.
The objective is to identify common operations and place them
in functions in order to improve the readability and correctness of the code.

is_document_option(document, option):
  Find if _option_ is a document option (\\options in the header).

insert_document_option(document, option):
  Insert _option_ as a document option.

remove_document_option(document, option):
  Remove _option_ as a document option.
2018-04-28 15:10:09 +01:00
Richard Heck
1db883e183 In lib/lyx2lyx/: s/while 1/while True/ 2016-06-25 17:38:06 -04:00
Georg Baum
166420d02c Make lyx2lyx infrastructure python3 ready
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.
2016-06-12 21:21:15 +02:00
Georg Baum
a2f127f8c3 Fix lyx2lyx unicodesymbols escaping
The escaping of symbols read from unicodesymbols was inconsistent, which lead
to wrong replacements (bug 9559). Now the escaping is consistent: unicode_reps
contains unescaped LaTeX commands, the needed escaping for LyX files is
applied in put_cmd_in_ert() and lyx2latex().
2015-06-14 12:44:44 +02: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
Georg Baum
8f1cbe000e Fix bug #4036 (lyx2lyx produces invalid LyX 1.4.x)
I should have had a closer look much earlier, since the fix is simple and
safe, but at that time I did not notice. The problem was that an invalid
.lyx document was created when converting unicode characters with two
backslashes in their LaTeX definition from lib/unicodesymbols to pre-unicode
LyX format.
2014-02-19 21:56:00 +01: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
Jürgen Spitzmüller
4e31cd60b3 * lyx2lyx/lyx_1_5.py:
- fix bug 6018.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30644 a592a061-630c-0410-9148-cb99ea01b6c8
2009-07-17 15:03:13 +00:00
José Matox
391ba1e592 fix bug 5333
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26828 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-09 13:07:13 +00:00
José Matox
13bf36618c possible fix to bug 5333
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26827 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-09 12:53:13 +00:00
José Matox
dec8e81ebd Trim end of line whitespaces (need to clean the difference for further fixes)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26825 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-09 12:09:01 +00:00
Jürgen Spitzmüller
ca6246e4da * lib/lyx2lyx/lyx_1_5.py:
- implement wrapper around normalize that handles specific cases
	  that must not be normalized (rest of bug 3313).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23227 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-25 13:32:08 +00:00
Jürgen Spitzmüller
7feaac16d2 * lib/lyx2lyx/lyx_1_5.py:
- fix bug 4333.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22019 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-08 15:38:39 +00:00
José Matox
155058a362 Another take at bug 4049
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19172 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-23 17:06:32 +00:00
José Matox
61cb6824a6 Second part of bug 4050 fix
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19168 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-22 20:10:28 +00:00
José Matox
972ec40b73 Fix problem reported by bug 4050 (I am not sure if this fixes the bug)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19167 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-22 19:03:11 +00:00
José Matox
b03bc96912 Fix bug 2049
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19166 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-22 18:20:22 +00:00
Bo Peng
cce9cfc975 fix wrong fix r19160. I did not have an extra \end_layout, but missed a \begin_layout
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19163 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-21 05:45:50 +00:00
Bo Peng
f668844789 Remove an extra \end_layout from revert_listings_inset
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19160 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-20 19:02:52 +00:00
José Matox
ce87f9dd49 (Atempt to) Fix bug 4048
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19159 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-20 16:02:24 +00:00
José Matox
6dfd1c17f3 Prepare code for refactorisation
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19158 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-20 15:06:48 +00:00
José Matox
d3f7996cdd Move related code together (no code added or deleted)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19157 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-20 14:25:04 +00:00
Jürgen Spitzmüller
586a07709f * lib/lyx2lyx/lyx_1_5.py (revert_unicode):
- reintroduce \n's accidentally removed in revision 19145
	  (fixes bug 4046)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19153 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-20 10:26:01 +00:00
Dov Feldstern
11441c8560 Fix a few edge-cases which in the lyx2lyx conversion to format 249
(multi-encoding -> utf8); specifically, the language was being          
incorrectly identified in certain insets, which of course led to
encoding problems.
This fixes part of bug 3613 (http://bugzilla.lyx.org/show_bug.cgi?id=3613).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19151 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-20 02:10:28 +00:00
José Matox
aa5848f957 Clean and speedup code in revert_unicode
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19145 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-19 17:15:31 +00:00
Jürgen Spitzmüller
f36e1b4b31 * lib/lyx2lyx/lyx_1_5.py (revert_unicode): fixes by Georg Baum (bug 3985)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19138 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-19 14:59:43 +00:00
José Matox
b3059e2070 Fix bug 4033 (Georg)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19137 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-19 12:24:01 +00:00
Jürgen Spitzmüller
e12b2d31ed * lib/lyx2lyx/lyx_1_5.py:
- use document.default_layout instead of hardcoded "Standard" layout (bug 4035)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19135 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-19 10:33:40 +00:00
José Matox
8397a051fa Improve revert unicode (bug 3958) from Anders Ekberg
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19113 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-18 10:47:44 +00:00
José Matox
aafefdbe26 Fix crash loading old files (http://www.mail-archive.com/lyx-users%40lists.lyx.org/msg57472.html)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19101 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-17 16:46:19 +00:00
Uwe Stöhr
d4fb110865 lyx_1_5.py: fix typo
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18995 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-06 00:30:29 +00:00
Jürgen Spitzmüller
7562340249 fix unicode decomposition (bugs 3313 and 3498):
* src/support/docstring.{cpp,h}:
	- rename normalize_kc to normalize_c and use normalization form C (instead of KC)

* src/callback.cpp:
* src/Trans.cpp:
* src/frontends/qt4/GuiClipboard.cpp:
* src/frontends/qt4/GuiSelection.cpp:
* lib/lyx2lyx/lyx_1_5.py:
	- use normalization forms C and D instead of KC and KD.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18991 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-05 14:45:00 +00:00
Jürgen Spitzmüller
768addedfd * lib/lyx2lyx/lyx_1_5.py (revert_unicode): fix typo in comment
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18950 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-30 06:56:15 +00:00
Jürgen Spitzmüller
2bde238feb * lib/lyx2lyx/lyx_1_5.py:
- fix convert_graphics_rotation and make revert_graphics_rotation actually work.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18948 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-30 06:07:20 +00:00
Uwe Stöhr
0b3c217b79 lyx_1_5.py: last part of fix for bug 3313
OK from José: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg121628.html

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18918 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-27 20:46:04 +00:00
José Matox
0d3295f1cf Fix bug 3313 (unicode error when invoking lyx2lyx) by Anders Ekberg
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18890 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-26 13:15:29 +00:00
Uwe Stöhr
d8993d2d6c - Fileformat change: rename "arabic" to "arabic_arabtex"
- Split the language Arabic into "arabic_arabi" that uses the arabi-package and "arabic-arabtex" that uses the arabTeX-package to typeset Arabic. This is needed because both packages have some advantages over the other people need.
(This change is a consequence of a long and fruitful discussion with Mostafa, Dov, and me.)

Patch by Dov and me.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18887 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-26 00:11:03 +00:00
Jürgen Spitzmüller
bcf64dd11c Fix bug 1749. CAUTION: lyx2lyx not fully working yet (see FIXMEs).
* development/FORMAT: 
	- document file format change

* src/Buffer.cpp: bump format to 275.

* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_5.py:
	- conversion and reversion of scaleBeforeRotation param (doesn't work yet!)

* src/insets/InsetGraphicsParams.{cpp,h}: 
	- new param scaleBeforeRotation
* src/insets/InsetGraphics.cpp:
	- swap order of scale and rotate (if scaleBeforeRotation is false)

* src/frontends/qt4/QGraphics.C:
* src/frontends/qt4/QGraphicsDialog.{cpp,h}:
* src/frontends/qt4/ui/GraphicsUi.ui:
	- add checkbox to toggle scaleBeforeRotation.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18885 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-25 13:49:51 +00:00
Dov Feldstern
a529b7e6e7 lyx2lyx to convert the language of spaces surrounding text in a foriegn
language to be in the paragraph's language. This is necessary due to format
change 259, but the language was forgotten in lyx2lyx back then. It's important
for Bidi documents.

(fixes bug http://bugzilla.lyx.org/show_bug.cgi?id=3789)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18766 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-13 19:12:38 +00:00
Bo Peng
dad101c2e3 Add --Separator-- environment
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18764 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-13 15:09:28 +00:00
Bo Peng
6551f0afa8 lyx2lyx support for unrecognizable listings parameter
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18763 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-13 14:38:34 +00:00
José Matox
04e3cd2297 Add file format change to support the standard font size for ext* family of textclasses
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18358 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-15 23:31:47 +00:00
Bo Peng
49cb2e69e7 InsetListings: lyx2lyx for caption and label
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18328 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-15 01:38:48 +00:00
José Matox
5aefff5be0 Fix importing of klewer template, add fix for recent update (null update for format 270)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18325 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-14 23:10:56 +00:00
Martin Vermeer
fd70aabcc8 Add charstyles Alert and Structure to beamer
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18322 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-14 19:56:05 +00:00