Commit Graph

107 Commits

Author SHA1 Message Date
Günter Milde
a151b274bf Fix lyx2lyx dash conversion and make it faster. 2018-01-24 17:38:19 +01:00
Günter Milde
a77cfef1c6 Fix some more lyx2lyx round-trips.
Also restore corrupted seminar example.
Add default return value to parser_tools.is_in_inset().
2018-01-24 01:04:14 +01:00
Günter Milde
8da6cdcf23 New lyx2lyx tools.
New lyx2lyx parser tools find_complete_lines() (replaces find_slice),
del_complete_lines(), and find_across_lines(). Default value 0
for start argument in utility functions.

Rework the implementation of dash-conversion.
2018-01-23 09:10:50 +01:00
Günter Milde
8e825de4b2 Fix preamble-code removal in lyx2lyx. Do some optimizations.
Fix failure of revert_dashes() found by lyx2lyx ctests
using an efficient function to find a given sequence of lines
in a list of lines.

Some optimizations using Python idioms instead of C-like code.
2018-01-21 19:55:27 +01:00
Günter Milde
9ce5d8578b Prevent rows of hyphens becoming dashes when back-porting to 2.1.
Insert ligature breaks between hyphens where
they are separate in 2.2 but ligated by TeX in 2.1.

This fixes output with LyX 2.1 and prevents -- and --- becoming
en and em dash in the LyX source after a round-trip to 2.1
and back.

Solves lyx2lyx ctest failures with a warning about
possible line-break changes.
2018-01-17 21:39:03 +01:00
Günter Milde
6fe2e45f97 Remove trailing whitespace in lyx2lyx. 2018-01-17 09:48:08 +01:00
Günter Milde
73b6f42362 Do not convert dashes/hyphens in LyX-Code.
See previous commit and #10961
2018-01-10 12:07:36 +01:00
Günter Milde
cb1fda9988 Do not convert dashes/hyphens in Code insets (logical markup).
Code is by default rendered as typewriter and should be treated
similar:
In text marked up as code, -- or --- is typically part of a
command (e.g. "lyx --help" or "x--") and not a transliteration
for en dash, see #10961.
This is already handled so for text in typewriter font
(see Text.cpp:500).
2018-01-10 12:07:36 +01:00
Günter Milde
586d16a49c Fix lyx2lyx conversion of dashes. 2017-12-19 14:10:57 +01:00
Uwe Stöhr
9ef3edf6d7 lyx_2_2.py: fix box reversion routine again
silly mistake, now Math.lyx reverts correctly again.
2017-04-21 01:05:54 +02:00
Uwe Stöhr
5b4cc6b6c8 lyx2lyx/lyx_2_2.py: correct reversion of boxes 2017-04-17 04:06:52 +02:00
Uwe Stöhr
e07cb1da96 lyx_2_2.py: fix reversion of colored boxes with special features 2017-04-15 19:58:56 +02:00
José Matos
37901e2e25 lyx2lyx: Cosmetic clean up of the lyx_2_?.py files.
Remove the duplicated \# -*- coding: utf-8 -*-
lines that show in the third line.
As far as I know they are not used, the first line though is used
by python and text editors (emacs, vi & co) to get the file encoding.
That will also work in the second lines (because of the shebang convention)
but not in other lines.

Remove trailing whitespaces.
2017-03-27 10:16:31 +01:00
Richard Heck
5cb5d2cb5a Do not replace "--" with "\twohyphens" in formula macros. 2017-01-18 21:48:35 -05:00
Richard Heck
1db883e183 In lib/lyx2lyx/: s/while 1/while True/ 2016-06-25 17:38:06 -04:00
Georg Baum
5ab19af782 Skip paragraph parameters for dash conversion
Some of them are directly passed to LaTeX, but for all of them a token
\twohyphens or \threehyphens is not valid. This fixes bug #10243.
2016-06-19 17:05:13 +02: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
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
e93013057f Add missing backslashes
Found by 2to3, but useful for python2 as well for consistency reasons.
2016-06-08 22:17:14 +02:00
Enrico Forestieri
d4ca8d7404 Introduce the latexpar separator.
This is the same as the parbreak separator and is represented on screen
as the old parbreak. Old parbreak separators are converted to latexpar
separators when they are used for introducing blank lines in the
latex output rather than for separating environments.
Instead, parbreak separators are now represented on screen by a
double line. In essence, latexpar and parbreak separators produce
the same output but are represented differently on screen.
The context menu does not account for latexpar separators and only
"true" separators can be turned each into the other one.
2016-04-06 05:25:27 +02:00
Jean-Marc Lasgouttes
fd1ee3b424 Rename Caption:LongTableNoNumber to Caption:Unnumbered
The term LongTable has been deprecated and moreover the renaming makes the interface easier to the eye.

File format updated to 507. (conversion based on jamatos patch)
Layout format updated to 60.
tex2ylx tests updated.
Document EmbeddedObjects.lyx has been updated.
2016-03-30 16:07:00 +02:00
Uwe Stöhr
0d30333ec6 acmsiggraph.layout: revert c1e0b243 partly 2016-02-03 00:03:55 +01:00
Uwe Stöhr
4a8a2ef9a8 lyx_2_2.py: remove double code
thanks Guillaume
2016-01-27 22:51:49 +01:00
Guillaume Munch
f58638c704 New LFUN tabular-feature: convert "inset-modify tabular" in LyX files
* Increase LyX format

* New function convert_info_insets in lyx2lyx_tools.py
  Use this function in the future for future updates of info insets

* Convert "inset-modify tabular" to "tabular-feature" in info insets

* Remove icon naming hack regarding "inset-modify tabular"
2016-01-27 18:33:09 +01:00
Uwe Stöhr
c1e0b24304 acmsiggraph.layout: update layout for ACM siggraph 0.92
fileformat change: update fileformat for all files
2016-01-27 01:58:13 +01:00
Guillaume Munch
9267b2b245 Amend 5c2d0499 2016-01-14 20:17:46 +00:00
Guillaume Munch
5c2d049996 Add \save_transient_properties parameter (#9841)
Increment LyX format to 504.

With this new parameter, the user can indicate that some other parameters that
are frequently switched must not be recorded in the file (as if they were a
setting specific to the user or transient, rather than a document setting). This
will play nicer with version control systems.

See the discussion, e.g.:
http://thread.gmane.org/gmane.editors.lyx.devel/157824/focus=157993 (third
solution mentioned)

TODO:
* The interface remains to be set up. We cannot change this setting from LyX
  for now.
* If save_transient_properties is false, we should read the user setting as a
  per-user-per-document (session) setting (e.g. like the cursor position).
* Once the above is done, we can treat \justification the same way (but it would
  be even better if \justification was moved to lyxrc).
2016-01-12 21:25:34 +00:00
Juergen Spitzmueller
77f5baec8f Fix thinko in revert_newgloss: only dissolve ERTs in glosses! 2015-12-27 18:20:49 +01:00
Juergen Spitzmueller
a80da13cc1 Rewrite and split the moderncv conversion routine.
This fixes several conversion problems, amongst others the redundant
\end_layout reported by Kornel.
2015-12-27 12:48:11 +01:00
Juergen Spitzmueller
4d7453ac86 Remove redundant \\end_layout in jss-article Code Chunk reversion. 2015-12-26 12:08:10 +01:00
Juergen Spitzmueller
c76d91bb47 Fix gloss, glossgroup and forest reversion routines.
These were using lyx2latex, assuming the result can be used in verbatim
insets as is, which is not the case (mostly due to \\backslash).

A new lyx2verbatim function is now used instead. Also, ERT insets are
dissolved in the gloss reversion process.
2015-12-25 12:03:38 +01:00
Richard Heck
1c66831825 Fix a couple minor issues noticed by tests. 2015-12-17 10:04:47 -05:00
Richard Heck
7831e11717 Simplify a bunch of tests in lyx2lyx code. 2015-11-28 23:58:50 -05:00
Richard Heck
01b4e811a6 Fix a few C++-isms that crept into lyx2lyx code. 2015-11-28 23:55:00 -05:00
Richard Heck
acf3e3a139 Clean up Solution and Solution* reversion code a bit. 2015-11-28 23:42:09 -05:00
Uwe Stöhr
6f221bab03 lyx_2_2.py: fix a logic mistake
- this message must be used for all cases
2015-11-29 04:26:14 +01:00
Uwe Stöhr
4ea80e077f lyx2lyx/lyx_2_2.py: correct reversion for solution*
- add reversion for the starred variant
- correct LaTeX output
2015-11-29 03:51:57 +01:00
Georg Baum
ad0643f4b5 Fix off by one error
Looks like I forgot to test this case without quotes, but fortunately the new
export test found it.
2015-11-28 18:25:33 +01:00
Uwe Stöhr
bfc749eb23 stdlayouts.inc: support for verbatim*
fileformat change
2015-11-24 23:56:26 +01:00
Uwe Stöhr
0ae337014e theorems-ams: add solution environment
fixes bug #6363 now completely
2015-11-18 02:36:49 +01:00
Uwe Stöhr
cc6c86ff3b theorems.inc: add environment "solution"
fileformat change, fixes bug #6363
2015-11-18 01:14:30 +01: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
Georg Baum
2fc430d5ae Store both sets of font selections
This is one part of bug 9744: If you toggle between TeX fonts and non-TeX
fonts, the settings of the other choice are no longer thrown away, but stored
and re-activated if you switch back. Most parts of the patch are purely
mechanical (duplicating some BufferParams members), the only non-mechanical
change is in the GUI logic.
2015-11-09 07:36:42 +01:00
Uwe Stöhr
43a80ef7df lyx_2_2.py: add a safe guard 2015-11-04 02:18:28 +01:00
Uwe Stöhr
4933399507 lyx_2_2.py: fix the conversion of colored boxes 2015-11-04 01:36:39 +01:00
Uwe Stöhr
e52a4b738c lyx2lyx/lyx_2_2.py: remove unused code 2015-11-04 01:22:03 +01:00
Uwe Stöhr
62a69584e6 achemso.layout: add a flex inset
- this one is in achemso since version 3.8

- fileformat change
2015-11-04 01:18:13 +01:00
Juergen Spitzmueller
0314464392 remove debug message. 2015-10-31 12:10:49 +01:00
Uwe Stöhr
2c1851e2ec moderncv.layout: update some styles and add new ones
- support for at least modernCV 1.5 (layout will still work with moderncv 1.3 as before)
- fileformat change
2015-10-28 02:27:32 +01:00