Commit Graph

232 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
Günter Milde
2fce4d49ee lyx2lyx refactoring.
* use unicode.transform() instead of loop over replacements
* telling variable names
* remove trailing whitespace
* documentation update
* don't set use_ligature_dashes if both dash types are found
* remove spurious warning, normalize indentation, and use
  Python idioms in revert_baselineskip()
2018-01-31 21:13:43 +01:00
Juergen Spitzmueller
648ddd25ec Collapsable -> Collapsible (part 1)
The current spelling is not strictly wrong, but flagged as unusual or
historical by some authorities. It is also found fault with many
spell checkers. Thus we decided to move to the more standard "-ible"
form once and for all.

See #10678 for discussion

This part only covers the usage in comments and the like. More to follow.

This will all also all be backported to 2.3.x, for the sake of backwards
compatibility (cherry-picking).
2017-10-16 10:03:05 +02:00
José Matos
bcf715f398 lyx2lyx: fix #9006 (python3 with non-utf8 encoding as the system default)
This patch fixes lyx2lyx running on python 3 for those systems
where the default encoding is not UTF-8, since open by default
uses the default system encoding.
2017-03-27 11:35:29 +01:00
José Matos
1269860b45 lyx2lyx: remove trailing whitespaces from lyx_1_6.py 2017-03-27 11:26:58 +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
9558d863c8 Some python 3 fixes for lyx2lyx
These were found by 2to3 and later adapted to use the compatibility code
which was already used in some parts of lyx2lyx, e.g. lyx_1_5.py.
2016-06-11 11:06:11 +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
Uwe Stöhr
14bcaa5f9d lyx2lyx/lyx_1_6.py: fix a typo (port from branch)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40451 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-08 23:16:34 +00:00
Julien Rioux
72cface90f Update links to the bug tracker.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40445 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-08 20:19:10 +00:00
Richard Heck
b87297b8a0 Fix infinite loop reported on the list, which revealed another, which
revealed another. So fix a bunch of such things.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39530 a592a061-630c-0410-9148-cb99ea01b6c8
2011-08-26 23:06:19 +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
Pavel Sanda
fe5f90b556 typo
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39224 a592a061-630c-0410-9148-cb99ea01b6c8
2011-07-01 22:31:42 +00:00
Pavel Sanda
51c4b0761e Comment only
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39223 a592a061-630c-0410-9148-cb99ea01b6c8
2011-07-01 21:53:18 +00:00
Richard Heck
05df2a7cc6 Fix python 3 deprecation warning.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36267 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-12 15:42:50 +00:00
Richard Heck
23499e63ba Move get_value_string to lyx_1_6, since it is only used there. A more
suitable replacement is forthcoming.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36112 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-05 15:07:32 +00:00
Richard Heck
4d2b6ffc78 Fix another infinite loop.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35997 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-02 15:22:16 +00:00
Richard Heck
d7c31dfff3 Prevent infinite loop.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35996 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-02 14:55:33 +00:00
Jürgen Spitzmüller
71001a8087 Fix bug 6179 ("|" in index entries not embraced in ERT by lyx2lyx).
* OutputParams.{cpp,h}:
	- new param inIndexEntry
* InsetIndex.cpp (latex):
	- set param.
* InsetErt.cpp (plainText):
	- output active chars in IndexInsets

* lib/lyx2lyx/lyx_1_6.py:
	- embrace "|" in ERT when converting old index entries to collapsables.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31360 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-10 12:07:42 +00:00
Jürgen Spitzmüller
3a8121ddee * lyx2lyx/lyx_1_6.py: fix convert_url routine (bug 6121).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30869 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-06 08:05:31 +00:00
Jürgen Spitzmüller
5ef8c7bc54 * lyx_1_6.py:
- Fix reversion of aligned tables in subfloats to LyX 1.5 (bug 5918).
	- Fix reversion of info insets with a backslash to LyX 1.5.
	- Fix unicode characters > LaTeX macro reversion to LyX 1.5.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29421 a592a061-630c-0410-9148-cb99ea01b6c8
2009-04-27 09:50:10 +00:00
Uwe Stöhr
0e8f00dbe1 lyx_1_6.py: remove wrong comment
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29219 a592a061-630c-0410-9148-cb99ea01b6c8
2009-04-11 21:17:58 +00:00
Richard Heck
376853cd7a Fix problem with conversion of empty insets. Also, fix problem with error message.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28753 a592a061-630c-0410-9148-cb99ea01b6c8
2009-03-11 18:58:38 +00:00
Jürgen Spitzmüller
3d018a6d94 * lyx2lyx/lyx_1_6.py:
- (convert_latexcommand_index): do not stop if a print_index inset is found,
	  but just skip this inset and proceed. There might be index insets after this (bug 5713).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28273 a592a061-630c-0410-9148-cb99ea01b6c8
2009-01-25 10:55:06 +00:00
Jürgen Spitzmüller
8382d7a9dc * lyx_1_6.py (revert_wrapplacement):
- fix reversion of placement argument (bug 5618).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27875 a592a061-630c-0410-9148-cb99ea01b6c8
2008-12-15 09:45:52 +00:00
Jürgen Spitzmüller
cf6e817709 * lyx_1_6.py:
- fix the conversion of some more complex index insets.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27759 a592a061-630c-0410-9148-cb99ea01b6c8
2008-12-02 07:40:23 +00:00
Jürgen Spitzmüller
c86be3e543 * lyx_1_6.py:
- another bug manifesting in the UG reversion: \slash and \nobreakdash can also occur
               in the middle of a line.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27394 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-12 09:42:37 +00:00
Richard Heck
0ff926b77b Fix lyx2lyx problem connected with subfloats that prevented the User Guide from being exported.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27390 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-12 01:17:47 +00:00
Richard Heck
d5d1987d99 Avoid infinite loop.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27387 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-11 17:44:55 +00:00
Jürgen Spitzmüller
24fe5b08c0 * lyx_1_6.py:
- fix reversion of info insets.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27386 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-11 17:24:07 +00:00
José Matox
bd64e75489 Fix bug 5411
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27329 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-07 19:17:35 +00:00
José Matox
c7b7331315 Do not reload unicode symbols each time they are used
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27166 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-28 16:00:42 +00:00
José Matox
c014f26820 Remove unneeded whitespaces (to help with another patch)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27154 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-27 16:51:51 +00:00
Richard Heck
e171ec6929 Fix for problem when subfigures in 1.5 don't have captions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27108 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-25 13:43:07 +00:00
Richard Heck
f67069ed4d Stupider still.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27061 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-23 19:18:42 +00:00
Richard Heck
cf06f04955 Stupid.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27060 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-23 19:18:21 +00:00
Richard Heck
d6a0a94883 Revert unintentional commit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27059 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-23 18:16:12 +00:00
Richard Heck
87f291c706 Fix issue with convert_macro_global reported by Enrico.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27058 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-23 18:08:26 +00:00
Uwe Stöhr
14adc7047d lyx2lyx/lyx_1_6.py: fix lyx2lyx for MathMacro conversions, fixes part of http://bugzilla.lyx.org/show_bug.cgi?id=5371
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26964 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-19 10:50:32 +00:00
Uwe Stöhr
263e72d53a lyx2lyx/lyx_1_6.py: fix remaining lyx2lyx issue of r26882
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26890 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-14 00:56:17 +00:00
Uwe Stöhr
2fe68fa743 lyx2lyx/lyx_1_6.py: fixes for r26882 as promised
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26885 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-13 21:43:14 +00:00
Pavel Sanda
308e2d9df3 Sanitize backreferences in hyperref.
http://bugzilla.lyx.org/show_bug.cgi?id=5340
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg144958.html



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26882 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-13 16:01:02 +00:00
Jürgen Spitzmüller
cc12f477d2 * lyx2lyx/lyx_1_6.py:
- fix reversion of aligned subfloats (bug 5352).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26879 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-13 07:51:02 +00:00
Jürgen Spitzmüller
d45ca67d1d ** fix bug 2114. Fileformat change.
** fix bug 5343 (patch from Richard, prerequisite for the other fix)

* Buffer.cpp:
	- increment format to 343
* src/BufferParams.{cpp,h}:
	- new param \use_default_options that allows to select/deselect
	  the "Other" class options defined in the layout file.
* src/frontends/qt4/GuiDocument.cpp:
* src/frontends/qt4/ui/LaTeXUi.ui:
	- add GUI to set \use_default_options, display predefined options in the dialog
	- update dialog correctly on class change.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26860 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-12 09:36:00 +00:00