Commit Graph

86 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
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
Richard Heck
1db883e183 In lib/lyx2lyx/: s/while 1/while True/ 2016-06-25 17:38:06 -04:00
Georg Baum
c6610453e0 Use unicode cmdline args consistently
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.
2016-06-16 22:05:56 +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
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
Richard Heck
98c80361f4 Move del_token into the files where it is used. We could use such a
thing, but not one that returns what this does.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36122 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-05 16:20:32 +00:00
Jürgen Spitzmüller
76c98826a2 * lib/lyx2lyx/lyx_1_4.py:
* lib/lyx2lyx/lyx_1_6.py:
	- improve reversion method for floats.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22508 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 09:59:37 +00:00
Jürgen Spitzmüller
4b799833e7 *** Support for generic sideways floats ***
* src/Buffer.cpp:
	- format is up to 312.
* src/LaTeXFeatures.cpp:
	- add rotfloat.
* src/Insets/InsetFloat.cpp:
	- handle starred and generic sideways floats.
* src/frontends/qt4/FloatPlacement.{cpp,h}:
	- adjust GUI to the new features.
* lib/chkconfig.ltx:
	- add rotfloat
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
	- add reversion methods for new floats
* lib/lyx2lyx/lyx_1_4.py:
	- add proper reversion method for sideways floats (this was missing).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22495 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-11 18:56:53 +00:00
Uwe Stöhr
3ab8eef56a lyx2lyx/lyx_1_4.py: fix typo
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20463 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-24 13:46:40 +00:00
José Matox
74f45fc0e9 Fix bug 3404 (from Bo Peng)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19114 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-18 10:49:33 +00:00
Georg Baum
2e04ee3317 * lib/lyx2lyx/lyx_1_4.py
(convert_ert_paragraphs): Fix off-by-one error that causes an out of
	range error in find_token


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17271 a592a061-630c-0410-9148-cb99ea01b6c8
2007-02-20 09:32:12 +00:00
Georg Baum
8b31062e50 fix typo
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16886 a592a061-630c-0410-9148-cb99ea01b6c8
2007-01-27 16:40:39 +00:00
Michael Schmitt
1a4b549a53 * lib/lyx2lyx/lyx_1_4.py:
* lib/examples/noweb2lyx.lyx: fix typo: "can not" => "cannot"


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15976 a592a061-630c-0410-9148-cb99ea01b6c8
2006-11-19 12:32:38 +00:00
Georg Baum
29012f2596 Fix output of labels and references that contain characters with an UCS4
codepoint > 255.
I decided that this is no file format change: We already had the change to
format 249 that allowed unicode in .lyx files. The output to .tex of
non-ascii characters is now different than before (even for those that were
supported previously, e.g. german umlauts in latin1), but this is only
relevant if people referenced a label in ERT. Since we cannot detect this
anyway we don't need a file format change.

	* src/support/lstrings.C
	(escape): Extend the escaping algorithm from 8 bit to 24 bit.

	* src/support/lstrings.h
	(escape): Update comment

	* lib/lyx2lyx/lyx_1_4.py
	(lyx_support_escape): Update comment


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15883 a592a061-630c-0410-9148-cb99ea01b6c8
2006-11-12 13:42:20 +00:00
José Matox
7f552526fc string.join(lst) -> " ".join(lst) and not "".join(lst)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14538 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-02 16:13:01 +00:00
José Matox
26c0f379c7 Remove calls to deprecated module string.
The calls are now made to string methods, the advantage being that they work with
unicode strings.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14537 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-02 15:45:44 +00:00
José Matox
695bfd88ed Convert all python files to utf-8.
Add a documentation string to each module.

Add a documentation string to every function in the modules.

file is a python reserved word => s/file/document/g as variable

add a new property to modules, supported_versions that holds
 the versions supported by that module

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14534 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-02 14:19:22 +00:00
José Matox
8fc2c1dd05 * LyX.py
* lyx_1_1_5.py
	* lyx_1_2.py
	* lyx_1_3.py
	* lyx_1_4.py
	* lyx_1_5.py

	* parser_tools.py: remove functions that are not generic, i.e.
assume a specific pattern for the file format, and move them to the
places where they are used.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14503 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-27 18:30:13 +00:00
Bo Peng
34001ec175 Remove all tabs in lib/lyx2lyx/*.py, corresponding to the added -tt option
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14285 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-01 19:16:09 +00:00
Martin Vermeer
f6848c168b * lyx_1_4.py
(convert_minipage): Proper handling of default height and 
	vertical position (bug report Garst Reese)



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13697 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-20 07:43:29 +00:00
José Matox
44aad9d818 lyx_1_4.py(convert_sgml_paragraphs):
convert SGML paragraphs to Standard + ERT, as SGML are not used anymore.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13616 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-10 09:14:08 +00:00
Georg Baum
8d914e2c52 * parser_tools.py (find_tokens_exact): new, extract tokens with
exact match
        * parser_tools.py (find_token2): rename to find_token_exact and make
        it work for tokens with spaces
        * lyx_1_4.py (revert_box, convert_collapsable, revert_bibtopic,
        convert_float): use find_token(s)_exact instead of find_token(s).
        This does not match "FloatList" when "Float" is searched (bug 2245)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13410 a592a061-630c-0410-9148-cb99ea01b6c8
2006-03-17 09:52:13 +00:00
José Matox
d5da885f21 Only reset the papersize for a4* paperpackages.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13312 a592a061-630c-0410-9148-cb99ea01b6c8
2006-03-07 11:21:08 +00:00
Georg Baum
3a56dd160f fix bug 2314
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13267 a592a061-630c-0410-9148-cb99ea01b6c8
2006-02-22 17:05:12 +00:00
Georg Baum
b8227ebda0 fix bug 2026 and bug 2088
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13226 a592a061-630c-0410-9148-cb99ea01b6c8
2006-02-13 07:48:26 +00:00
Georg Baum
d55a7468c0 fix bug 2244 (branch removal)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10804 a592a061-630c-0410-9148-cb99ea01b6c8
2006-02-02 21:30:04 +00:00
Georg Baum
a9bfd2b130 fix bug 2131
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10613 a592a061-630c-0410-9148-cb99ea01b6c8
2005-11-21 17:05:03 +00:00
Jürgen Spitzmüller
0ce45c32b6 fix bug 2090 (remove param \quotes_times). File format is up to 245 now.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10549 a592a061-630c-0410-9148-cb99ea01b6c8
2005-10-13 10:59:39 +00:00
Jürgen Spitzmüller
82765345ac fix space insets, increase version to 244.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10490 a592a061-630c-0410-9148-cb99ea01b6c8
2005-09-28 09:40:50 +00:00
Georg Baum
53a118caea fix bug 2031 (\lyxline conversion)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10466 a592a061-630c-0410-9148-cb99ea01b6c8
2005-09-20 12:47:45 +00:00
Georg Baum
c8c616688f fix bug 1990
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10411 a592a061-630c-0410-9148-cb99ea01b6c8
2005-09-05 07:06:11 +00:00
Georg Baum
9826fde5c9 fix bug 2004
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10408 a592a061-630c-0410-9148-cb99ea01b6c8
2005-08-30 07:23:20 +00:00
José Matox
a0c546831e fix bug 2001
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10407 a592a061-630c-0410-9148-cb99ea01b6c8
2005-08-29 18:43:15 +00:00
José Matox
7bd4678da5 Separate preamble from from header. Make its treatment more robust.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10398 a592a061-630c-0410-9148-cb99ea01b6c8
2005-08-18 17:33:26 +00:00
José Matox
24355f90da add \\leftindent to the list of allowed paragraph parameters.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10395 a592a061-630c-0410-9148-cb99ea01b6c8
2005-08-11 22:31:05 +00:00
José Matox
888342b465 Take into account the lines added to preamble.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10375 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-29 13:34:07 +00:00
José Matox
a69c7f771d Fix a4 package removal when the preamble is already there.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10374 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-29 11:22:18 +00:00
José Matox
255c2c247f Fix widemargins a4 convertion.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10372 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-29 09:54:50 +00:00
José Matox
2479ac8f5f Added a more precise date and details about 222 to 223 change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10371 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-29 09:39:17 +00:00
José Matox
4c2d658257 Put back support for format 222.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10370 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-29 09:23:19 +00:00
José Matox
85eed78238 remove wrong comments and add 1.3.6 to the list of releases
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10347 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-22 15:03:44 +00:00
José Matox
7b8d863cb3 small fixes to minipages convertions and retroversions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10334 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-18 18:37:05 +00:00
José Matox
54502b890e fix two typos converting frenchb (Thanks to Georg)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10327 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-18 14:46:53 +00:00
José Matox
8ed68ea860 convert frenchb language also in the body
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10304 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-17 23:55:05 +00:00
José Matox
9745fb8187 Remove the support for a4.sty, a4wide.sty and a4widemargins from lyx
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10273 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-17 11:17:13 +00:00