Commit Graph

1488 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
Juergen Spitzmueller
ae1e1cb069 Add possibility to manually specify longest label in nomenclature
File format change
2024-07-21 17:59:34 +02:00
Juergen Spitzmueller
369c871609 Support MLA's \autocite variants 2024-07-13 17:32:54 +02:00
Juergen Spitzmueller
2dac89aca0 Add support for biblatex-apa's \nptextcite 2024-07-11 10:28:38 +02:00
Juergen Spitzmueller
f96422fc9c Fix glitch in revert_biblatex_chicago 2024-07-10 09:51:55 +02:00
Juergen Spitzmueller
8941b05774 Add support for biblatex-chicago (#12240)
File format change
2024-07-09 15:18:06 +02:00
José Matos
7a79a416b8 Remove profiling.py
The hotshot module used there only works for Python 2.

BTW the profiling turned out not be necessary.

As a case in point Python 3.13 is twice as fast as Python 3.6 when using
lyx2lyx. Not only that but Python 3 is almost 10 times faster than using
Python 2 for this particular case.
2024-06-27 21:20:49 +01:00
José Matos
95a7440b0e Sort and format comments
The last code change shuffled the comments out of place
2024-06-18 10:52:05 +01:00
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
160ac7242e Remove undisclosed imports (from xxx import *)
This was the last example in this directory.
2024-06-16 07:45:43 +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
Udi Fogiel
3854086e59 Remove hebrew letter document class
The only difference from regular letter is the alignment of
"Send To Address" layout, but it no longer reflect the output
corrctly, probably because LyX revert the alignment of layouts
in RTL context now.
2024-06-11 21:14:27 +03:00
José Matos
c92b481a44 Reformat imports for easier reading
This is in line with the current hints for better readability:

* one import per line;
* order the imports alphabetically to be easier to search;

Take the chance to remove unused imports.
2024-06-10 12:05:03 +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
Juergen Spitzmueller
d2db74f9ee Add support for glue length in parskip (#12867) 2024-06-01 13:47:39 +02:00
Juergen Spitzmueller
c23f731fae mumble 2024-05-15 18:36:47 +02:00
Juergen Spitzmueller
9d43fd2ae1 # and % need to be escaped in hyperref URL as well
Also fix some lyx2lyx glitches

This hopefully fixes the test issues.
2024-05-15 13:15:08 +02:00
Juergen Spitzmueller
1512216909 Fix comment 2024-05-13 10:26:45 +02:00
Juergen Spitzmueller
52d31155c1 Properly escape backslash in URLs with hyperref (#13012) 2024-05-13 09:17:30 +02:00
Juergen Spitzmueller
ed62816eb6 Handle URL escaping in beamer frames
File format change -- this introduces the first LyX 2.5 format and
hence sets up the lyx2lyx machinery
2024-05-13 07:26:41 +02:00
Jürgen Spitzmüller
de04f3270e Fix lyx2lyx bug with nested inset arguments 2024-03-05 15:41:21 +01:00
José Matos
db78555e29 Minor cleanup: one import per line 2024-02-10 22:02:13 +00:00
José Matos
a46b5f2de9 Remove extra whitespace at the end of line 2024-02-10 22:01:01 +00:00
Juergen Spitzmueller
b00ea51166 fixup convert_lineno (#13036)
This routine assumed \linenumbers to be preceded by \usepackage{lineno}
and that by a lyx2lyx comment.

Of course, this is not the case if users loaded lineno manually.
2024-01-26 10:30:31 +01:00
Udi-Fogiel
ca2c9d8b46 don't convert hebrew parentheses in passthru insets
Fix 12966. A few notes:

* we need to consider both regular insets and argument insets.
* in passthru layouts (such as verbatim) parentheses still need
  to be reversed.
* all arguments of type 'listpreamble' are passthru (this isn't a rule,
  this is just what happen in practice).
* custom layout and insets from the local layout, or a custom module
  are not considered.

Signed-off-by: Udi-Fogiel <udifoglle@gmail.com>
2024-01-01 12:40:00 +02:00
Juergen Spitzmueller
412d202fc3 Do not reverse parentheses in pass thru insets (#12966) 2023-11-08 15:14:37 +01:00
Juergen Spitzmueller
9b8183b877 Fix escape string (reported by José) 2023-09-30 13:07:00 +02:00
Juergen Spitzmueller
087f6bce71 Introduce default box frame color (#12921)
This better aligns with dark mode
2023-09-30 09:56:27 +02:00
Scott Kostyshak
77fc67d3f0 Fix lyx2lyx issue reported on ML
The issue was reported on lyx-users by Chris Menzel [1].

Patch is from José Matos [2].

[1] https://www.mail-archive.com/search?l=mid&q=BD744D7E-54B4-4E95-A4E3-6B28F4987DE1%40gmail.com
[2] https://www.mail-archive.com/search?l=mid&q=c2ac54c2322d24051f171558ad8487ea4f7078ed.camel%40gmail.com
2023-09-06 13:07:40 -04:00
Richard Kimberly Heck
2ad57dcb6b Preview formatted references in the work area.
Patch from Daniel Ramoeller <d.lyx@web.de>, fixed up by RKH.
2023-08-24 21:24:31 -04: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
Pavel Sanda
9e8901f997 Adding hebrew quotation marks (bug #12849).
Patch from Udi Fogiel.
2023-08-06 16:50:07 +02:00
Juergen Spitzmueller
dfab2898de Fix lyx2lyx reversion problem for covington examples
Do not take arguments of nested insets/layouts as your own
2023-07-21 09:46:47 +02:00
Juergen Spitzmueller
a91d1ebe82 Forgot these 2023-07-20 16:26:17 +02:00
Juergen Spitzmueller
2841a1c063 Update covington support in linguistics module (file format change) 2023-07-20 15:09:47 +02:00
Juergen Spitzmueller
86069c9e9a lyx2lyx: skip mathed in convert_hebrew_parentheses (#12824)
Those have not been swapped in Hebrew.
2023-07-04 07:37:06 +02:00
Richard Kimberly Heck
67178df979 Fix lyx2lyx bug reported by Herbert Voss.
For some reason, files converted from really old versions have fewer
lines in reference insets than in more recent versions.
2023-06-16 01:22:52 -04:00
Richard Kimberly Heck
c3f98d1fa4 The lyx2lyx for the previous commit. 2023-06-11 12:55:51 -04:00
Juergen Spitzmueller
6e5b3a1e31 Properly fix acknowledgment issue part 2/2
Remove acknowledgment theorem types

As we have learned, these shouldn't have been added from the get go.

Documents having it get a local layout definition.
2023-02-05 12:07:37 +01:00
Juergen Spitzmueller
0ab6a5c6d6 Add forgotten case 2023-02-05 09:34:04 +01:00
Juergen Spitzmueller
ac6314b834 Properly fix acknowledgment issue part 1/2
Bump file format and convert/revert styles to unique spelling
2023-02-04 17:47:52 +01:00
Juergen Spitzmueller
1b42d800a3 fix glitch in index reversion 2023-01-28 17:06:35 +01:00
Juergen Spitzmueller
b66a6dba43 lyx2lyx: fix convert_totalheight method
This didn't account for float values
2023-01-28 10:16:54 +01:00
Juergen Spitzmueller
d89a48483e Add missing revert routine to lyx_2_0.py 2023-01-06 14:40:25 +01:00
Juergen Spitzmueller
0c56f60535 Associate "run:" link types with "Other" 2022-12-26 13:19:52 +01:00
Richard Kimberly Heck
144cf4bb9a Allow an 'other' type for hyperlinks. Format change.
Also, perform the URL fixing magic for DocBook and XHTML.

As it was, it was impossible to enter e.g. "tel:" type links. Now
choosing the "Other" type just outputs the URL as given.

Also, the addition of "http" or "file" was not being done for
DocBook and XHTML. Now it is.
2022-12-25 12:45:48 -05:00
Juergen Spitzmueller
ceffadfbab lyx2lyx: fix glitch in revert_starred_refs 2022-12-21 08:52:44 +01:00
Juergen Spitzmueller
a066b81380 Fix comment 2022-12-11 15:12:06 +01:00