Commit Graph

52 Commits

Author SHA1 Message Date
José Matos
52295693d6 Clean python code (lyx2lyx)
Please linter where it makes sense:

* Avoid bare exceptions;
* Use formatted strings instead of string interpolation
2024-07-28 09:56:29 +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
Günter Milde
91bdcbbb82 Refactor lyx2lyx code.
Use helper functions for shorter, self-documenting code.

Drop optional arguments that equal the default value.

Remove hard TABs and trailing whitespace.
2020-03-05 00:24:08 +01:00
Stephan Witt
d05a8c805e correct typo in help message 2019-06-17 16:46:59 +02:00
Günter Milde
5a1fb5b5fa Improve readability of the lyx2lyx help output.
Also some small clean-up edits
2019-01-23 10:12:28 +01:00
José Matos
cac27076ea Replace /usr/bin/env python -> /usr/bin/python3 2018-08-29 17:26:21 +01: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
Georg Baum
1fc3d051b1 Set \origin correctly when upgrading docs
lyx2lyx did not yet know about /systemlyxdir/ and set \origin to the path
where my git tree lives instead. This path is not usable except on my machine,
so better write something more usable instead.
This is a special command line switch of lyx2lyx, so it does not interfere
with normal usage. I did not try to deduce the systemlyxdir from lyx2lyx to
be on the safe side.
2015-11-11 21:35:12 +01:00
Uwe Stöhr
cf29d21d7a lyx2lyx files: update GPL organization address and claim copyright also for the LyX team where it is necessary
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40524 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-18 22:56:49 +00:00
José Matox
32f469b851 If it is not broken then break it:
* Fix lyx2lyx default debug level
* Fix lyx2lyx verbose mode
* Use stderr consistently
* Update default version when running from src directory
* Output prettier and more useful information
* Allow to specify the target version, the format will be accordingly
* Have a more reliable chain of dependencies (fixes corner cases < 2.15)
* Add placeholder for future file format changes



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27506 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-15 22:55:53 +00:00
José Matox
bbb9075e51 Adjust profiling to new lyx2lyx call
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27155 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-27 16:55:53 +00:00
Richard Heck
a8d2d891ee Wow.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22489 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-11 08:03:48 +00:00
José Matox
1a221943db Fix handling of cjk_encoding for documents made with versions older than 1.5
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20380 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-20 16:12:47 +00:00
José Matox
dbe7b13f65 lyx2lyx: use parseopt instead of getopt (the documentation of options
is kept in sync with its usage)

LyX.py:  make source more readable, place whitespaces, break long
         lines, add documentation strings, etc.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20279 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-14 14:37:14 +00:00
Georg Baum
5b79207f3d Add commandline switch to read files from CJK-LyX
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17162 a592a061-630c-0410-9148-cb99ea01b6c8
2007-02-13 16:57:48 +00:00
José Matox
2987ccdd9e lyx2lyx: Remove -tt from header since it does not work.
Changed the enconding to utf-8.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14533 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-02 09:54:41 +00:00
Georg Baum
4ae87a3bb8 Call python with the -tt switch to make mixed tab/space indentation an error
* src/support/os.[Ch]
	(python): new function, return the python command

	* lib/lyx2lyx/lyx_1_5.py
	(revert_font_settings): replace tabs with spaces

The rest is simply s/python/python -tt/ and
s/"python"/lyx::support::os::python()/ where appropriate.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14270 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-30 13:54:01 +00:00
José Matox
fb1e227a93 Implement return codes consistently.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10132 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-05 15:28:44 +00:00
José Matox
9b4136de38 add --try-harder for lyx2lyx
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10131 a592a061-630c-0410-9148-cb99ea01b6c8
2005-07-05 11:14:13 +00:00
Angus Leeming
65f9fc786e Enable lyx2lyx to work with "file names with spaces".
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9954 a592a061-630c-0410-9148-cb99ea01b6c8
2005-05-19 08:43:52 +00:00
José Matox
eb0de102db Unify the call to converters into LyX.py. (lyx2lyx)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9442 a592a061-630c-0410-9148-cb99ea01b6c8
2005-01-05 18:52:59 +00:00
José Matox
3c84dfb21e lyx2lyx is now a frontend to the LyX module.
The code in LyX was refactorized and now we have two different classes that
derive from a base class. One for new files and the other for existing files.
New class for paragraphs. New code to return the toc of a file.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9092 a592a061-630c-0410-9148-cb99ea01b6c8
2004-10-16 22:56:10 +00:00
José Matox
43c844920c Add code that profiles lyx2lyx.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9075 a592a061-630c-0410-9148-cb99ea01b6c8
2004-10-10 19:25:48 +00:00
José Matox
ba7ff6f4a1 Format up to 237.
Use true or false in the header instead of 0 or 1.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9072 a592a061-630c-0410-9148-cb99ea01b6c8
2004-10-09 21:32:56 +00:00
José Matox
6c79118290 Reorganised lyx2lyx, transfering it knowleadge of the file format to LyX.py,
and using it as library. The lyx2lyx script now becomes a simple cliente.
Simple fix in the UserGuide.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8941 a592a061-630c-0410-9148-cb99ea01b6c8
2004-08-15 16:29:04 +00:00
José Matox
34b9ed8ac9 whitespace, bugfixes, and convertions dependent on the document type, if need.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8749 a592a061-630c-0410-9148-cb99ea01b6c8
2004-05-11 16:13:33 +00:00
José Matox
17ec2aa061 fix handling of gzipped files, move default warning level to 1
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8725 a592a061-630c-0410-9148-cb99ea01b6c8
2004-05-03 13:40:12 +00:00
José Matox
bc7f66b2b7 The big lyx2lyx rewrite.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8653 a592a061-630c-0410-9148-cb99ea01b6c8
2004-04-14 08:45:46 +00:00
Jürgen Spitzmüller
7aadb167bf add bibtopic support (bug 870).
That's it for now.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8560 a592a061-630c-0410-9148-cb99ea01b6c8
2004-03-29 13:17:25 +00:00
Jürgen Spitzmüller
4072a82b6e support for sidewaysfloats and fix for bug 1016 (float placement allows impossible settings).
BTW: floats are still broken (dialogs do not get updated). No idea where this bug sits.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8557 a592a061-630c-0410-9148-cb99ea01b6c8
2004-03-29 11:38:39 +00:00
Jürgen Spitzmüller
891bb08e37 support for second \cite option.
Natbib users can now use the before field.
file format is up to 230.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8479 a592a061-630c-0410-9148-cb99ea01b6c8
2004-03-05 14:49:10 +00:00
Jürgen Spitzmüller
260a79e3a5 change the file format number to 229 for the sake of a cleaner minipage/box conversion
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8287 a592a061-630c-0410-9148-cb99ea01b6c8
2003-12-29 15:49:50 +00:00
Angus Leeming
faaea50708 Handle Michael's changes to InsetCollapsable.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8255 a592a061-630c-0410-9148-cb99ea01b6c8
2003-12-15 22:04:31 +00:00
Angus Leeming
d43da3679e Modify the InsetBox format to always start 'Box'.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8229 a592a061-630c-0410-9148-cb99ea01b6c8
2003-12-10 21:48:40 +00:00
Angus Leeming
c2d7777341 InsetNote clean-up.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8226 a592a061-630c-0410-9148-cb99ea01b6c8
2003-12-10 17:28:14 +00:00
José Matox
62715f910e Fix warnings in python 2.3.
Add redirection of log as an option.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8209 a592a061-630c-0410-9148-cb99ea01b6c8
2003-12-05 20:09:24 +00:00
José Matox
a003e4a08d Convert vertical spaces to new format
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8186 a592a061-630c-0410-9148-cb99ea01b6c8
2003-12-03 12:29:42 +00:00
Angus Leeming
a60b5c0b72 Whitespace only.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7905 a592a061-630c-0410-9148-cb99ea01b6c8
2003-10-13 09:50:10 +00:00
José Matox
0b24926473 support backward saving for 1.3.x format.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7857 a592a061-630c-0410-9148-cb99ea01b6c8
2003-10-03 17:11:22 +00:00
Dekel Tsur
5765dce6ca Declare encoding for python >= 2.3
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7728 a592a061-630c-0410-9148-cb99ea01b6c8
2003-09-10 11:21:58 +00:00
Angus Leeming
e2df724add I do believe that 'The LyX Team' doesn't claim copyright on any files in the
lib directory...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7589 a592a061-630c-0410-9148-cb99ea01b6c8
2003-08-22 11:08:44 +00:00
José Matox
2b2b83803a lyx2lyx supports gziped files, version header correct
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7426 a592a061-630c-0410-9148-cb99ea01b6c8
2003-07-28 21:14:33 +00:00
José Matox
c198343f93 lyxl2yx catches \end_layout
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7408 a592a061-630c-0410-9148-cb99ea01b6c8
2003-07-28 10:13:56 +00:00
Angus Leeming
aa7c2f32e1 Make lyx2lyx output the new external inset format.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7111 a592a061-630c-0410-9148-cb99ea01b6c8
2003-06-05 22:44:04 +00:00
Dekel Tsur
b76510c433 Fix loading of files created by the development version
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6503 a592a061-630c-0410-9148-cb99ea01b6c8
2003-03-14 13:37:34 +00:00
André Pönitz
adcd9fbe8a bare bones to convert 222
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6080 a592a061-630c-0410-9148-cb99ea01b6c8
2003-02-10 10:27:46 +00:00
Angus Leeming
a359be2d65 Enable the debug level to be set
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6046 a592a061-630c-0410-9148-cb99ea01b6c8
2003-02-07 11:01:46 +00:00
José Matox
0efa3f71a0 Fix weird case where the first body line has only a space
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5914 a592a061-630c-0410-9148-cb99ea01b6c8
2003-01-07 17:03:59 +00:00
John Levon
6af5ac769a Rob's followup (nr. 1 ;)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5127 a592a061-630c-0410-9148-cb99ea01b6c8
2002-08-27 20:30:20 +00:00
José Matox
4125f05d3e Approaching null diff for 2.16
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5088 a592a061-630c-0410-9148-cb99ea01b6c8
2002-08-24 12:05:17 +00:00