Commit Graph

1299 Commits

Author SHA1 Message Date
José Matos
08182ead14 Remove spurious spaces at the end of lines 2018-04-28 18:31:31 +01:00
José Matos
ea8b0df0e4 Add new semantic functions to add an remove document options.
The objective is to identify common operations and place them
in functions in order to improve the readability and correctness of the code.

is_document_option(document, option):
  Find if _option_ is a document option (\\options in the header).

insert_document_option(document, option):
  Insert _option_ as a document option.

remove_document_option(document, option):
  Remove _option_ as a document option.
2018-04-28 15:10:09 +01:00
José Matos
91ded82b52 Small improvement to pre-historic file format conversion. 2018-04-28 14:57:57 +01:00
José Matos
1fe328666c Improve the readability of lyx2lyx -l option
Example:
$ lyx2lyx -l
...
2.2     stable format:       508
        stable versions:     ['2.2.0', '2.2.1', '2.2.2', '2.2.3', '2.2.4']
        development formats: 475 - 507

2.3     stable format:       544
        stable versions:     ['2.3.0']
        development formats: 509 - 543

2.4     stable format:       -- not yet --
        stable versions:     -- not yet --
        development formats: 545 - 550
2018-04-28 14:42:31 +01:00
Juergen Spitzmueller
26ea1e1496 Align fontenc with document fonts
Following a request by Günter, we consider the document fonts (only rm
for now) when selecting an appropriate font encoding.

See #9741

The new default font encoding setting "auto" does

* consider the font encoding needed by the language(s), which can now
  have fallback alternatives
* Consider which font encoding is provided by the document font

Thus, cm now will result in OT1 fontenc, if the language can deal with
that.

The font_enc pref is ditched: it is no longer needed.

The automatism is still very basic and is subject to extension.

File format and prefs format change.
2018-04-22 19:06:46 +02:00
Juergen Spitzmueller
02d37932d0 \textcyr -> \textcyrillic
Use the command as defined by Babel. This allows us to use the (more
advanced) Babel command if provided instead of rolling our own.

I add a dummy file format change in case it turns out we need to
do something here for old documents (e.g. with user preamble definitions)
2018-04-21 16:28:15 +02:00
Juergen Spitzmueller
97e1806c4a Add a floating landscape inset 2018-04-18 16:20:19 +02:00
Juergen Spitzmueller
2551614ff1 Add Landscape module
Support for the (pdf)lscape package.

Fixes: #10801
2018-04-18 14:36:49 +02:00
Juergen Spitzmueller
feab528fd1 Add support for rotated longtabulars (via [pdf]lscape)
Fixes: #9194

See #9194 for why we use an earlier file format change here.
2018-04-18 13:22:29 +02:00
Richard Kimberly Heck
aabd3514dc Update version number in lyx2lyx. 2018-03-26 10:41:49 -04:00
Juergen Spitzmueller
cf9f077100 lyx2lyx fixes for the recent font additions. 2018-03-16 09:02:29 +01:00
Juergen Spitzmueller
6a0f0d28a5 Add support for xcharter font.
File format change.

Patch by Yuriy Skalko.
2018-03-15 15:44:49 +01:00
Uwe Stöhr
d3c51876a9 add support for the PT fonts
- fileformat change
- I also started https://wiki.lyx.org/LyX/NewInLyX24 for new features
2018-03-10 19:59:48 +01:00
Juergen Spitzmueller
e0a5babde7 Add literal param to InsetInclude
This is used by lstinput

File format change.

Fixes: #10544.
2018-02-23 08:58:16 +01:00
Juergen Spitzmueller
5b331b1466 Fix convert_separator routine with ancient LyX files. 2018-02-19 18:03:52 +01:00
Günter Milde
8f86b72cf4 lyx2lyx fixes and cleanup.
Don't insert empty line when translating QuoteInsets to literal
quotes.

Fix regexp pattern in re/convert_dashligatures.

Adjust logic in re/convert_dash(ligatur)es.
2018-02-09 16:49:23 +01:00
Günter Milde
e4f90cdf65 lyx2lyx refactoring.
Avoid duplicate code. Fix some corner-cases.
2018-02-07 18:49:21 +01:00
Günter Milde
2ddaa0a59b New lyx2lyx parser tools find_substring() and set_bool_value(). 2018-02-07 18:49:20 +01:00
Günter Milde
2b451f01f5 Add newlines around \backslash in put_cmd_in_ert.
Fix for 2fce4d49ee.
2018-02-04 10:16:54 +01: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
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
67eca412ff Fix some lyx2lyx round-trip tests.
Fix cases where lyx2lyx adds changes with every round cycle
uncovered by recent ctest change.

Add optional `delete` argument to parser_tools.get*value():
If True, delete the matching line.

More efficient "allowbreak" con/reversion.
2018-01-23 14:01:30 +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
Juergen Spitzmueller
7da8473c4f Start inset at new line 2018-01-06 10:43:44 +01:00
Scott Kostyshak
713fd70e8f Fix Python escaping of unicode string
When removing "r" from "ur", it is needed to add extra backslashes.
See:

  https://www.mail-archive.com/search?l=mid&q=2024193.iXIh6cq6L3%40myth

Thanks to José.

This commit amends b7983478 (and thus 586d16a4).
2017-12-26 02:10:49 -05:00
Scott Kostyshak
b7983478e1 Fix Python unicode string in lyx2lyx
This commit amends 586d16a4.
2017-12-23 21:47:08 -05:00
Günter Milde
586d16a49c Fix lyx2lyx conversion of dashes. 2017-12-19 14:10:57 +01:00
Uwe Stöhr
6c6cf5e071 use https:// in the first line of .lyx files
- also support to detect https via tex2lyx
2017-12-17 02:24:26 +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
Juergen Spitzmueller
4c62e25ed6 Fix #10760 2017-09-10 19:45:01 +02:00
Enrico Forestieri
8dab1cfe7e Fix bug #9101
Update the listings inset to optionally use the minted package
(instead of the listings one) for typesetting code listings.
Only one of the two packages can be used in a document, but it
is possible to switch packages without issues if the used options
are the same. If a switch is made and the options differ, one needs
to manually adjust them if they were entered in the advanced options
tab, or apply again the gui settings.
Note that minted requires the -shell-escape option for the latex
backend and the installation of additional software (python pygments).
2017-06-07 00:55:23 +02:00
Uwe Stöhr
bc9a7a21c8 lyx_2_3.py: assure that leqno /reqno is only handled if it is a document class option 2017-05-17 01:23:59 +02:00
Uwe Stöhr
220f504941 lyx_2_3.py: remove senseless warning 2017-05-17 01:11:58 +02:00
Richard Heck
d75c0ec8b1 Fix reversion of noprefix option for InsetRef.
Basically forgot to remove the option when we're not dealing with
a labelonly inset.
2017-05-16 12:34:56 -04:00
Uwe Stöhr
0dd3311dd4 rename buffer parameter math_number_before to math_numbering_side
this is a fileformat change

also try to fix an UI issue that JMarc gets
2017-05-13 20:39:45 +02:00
Juergen Spitzmueller
f943897d85 IndexPrint and Nomencl were not fully latexified.
Do not treat them as non-verbatim in conversion. This keeps math $...$
as math.

There will be problems with characters that are outside the given
encoding, but as long as there is no way to convert them to the
respective LaTeX macros from within lyx2lyx, I don't know how to solve
this.
2017-04-29 13:54:01 +02:00
Uwe Stöhr
3f8c15a7c6 support for the document class option leqno
- fileformat change
2017-04-25 02:28:10 +02: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
Günter Milde
f5ac0580ff special character "allowbreak" (ZWSP), fileformat change
New special character to mark an optional line break
without inserting a hyphen (ZWSP). See #10585.

Corresponds to the Unicode character U+200B ZERO WIDTH SPACE

 This isn't a “space”. It is an invisible character that can be used
 to provide line break opportunities.
 ​http://unicode.org/notes/tn27/

While the literal Unicode character can be used in the LyX
file, it is invisible in the GUI.

For visible feedback, the patch adds a new special character "allowbreak".

The small mark is inspired by LibereOffice.
A tooltip is added.
2017-04-20 23:28:48 +02:00
Uwe Stöhr
bc0591a265 lyx2lyx/lyx_2_0.py: fix a box reversion bug
- the use_makebox statement was not removed for nested boxes
2017-04-17 19:17: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
6c2a8df504 lyx_2_3.py: whitespace fixes 2017-04-16 16:24:01 +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
Uwe Stöhr
3677c20be9 BufferParams.cpp: correct output for \mathindent after [fc1c5c6f/lyxgit]
- also adapt the lyx2lyx logic to the changed implementation
2017-04-15 17:32:58 +02:00
Uwe Stöhr
58e6c6c876 InsetFloat: allow float placement for rotated floats
- fixes bug #10270
- fileformat change
- fixes also a bug that unwanted placement was output to LaTeX on certain cases
2017-04-15 06:57:52 +02:00
Uwe Stöhr
fc1c5c6f28 BufferParams: rename formula_indent to math_indent etc. as requested
- also add flyx2lyx feature to import existing document class option as requested by JMarc
- also don't use a real default indentation length
2017-04-13 02:31:26 +02:00
Uwe Stöhr
b3b7675f54 Length.cpp: add new unit representing \baselineskip
- fileformat change
2017-04-08 03:30:21 +02:00
Uwe Stöhr
808339790c support to indent formulas
- adds support for the general document class option fleqn
- adds support to specify the formula indentation
- fileformat change
2017-04-05 22:22:47 +02:00
Uwe Stöhr
e575e7eebd Add support to cross out characters
- adds support for the command \xout of the LateX package ulem
- fileformat change
2017-04-05 00:01:19 +02:00
Uwe Stöhr
7aaa85915f latexfonts: support for the Noto fonts
- fileformat change
- the support to scale the sf and the tt fonts can be added later, see enhancement #10611
2017-04-04 23:02:47 +02:00
José Matos
67bf174b10 lyx2lyx: convert iteritems -> items to be compatible with python 2 and 3 2017-03-29 12:34:53 +01: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
José Matos
463e12827c lyx2lyx: more descriptive member name (document.start -> document.initial_format) 2017-03-27 10:36:30 +01: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
Enrico Forestieri
be3f628e7d Also account for development versions 2017-03-20 15:08:17 +01:00
Enrico Forestieri
56bec528b5 Amend 72a488d7
- Mention the new buffer parameter in development/FORMAT

- Assure that lyx2lyx generates the same output obtained when saving
  a converted document from within lyx

- Don't require any action when converting a document created with
  lyx 2.2 in order to assure unchanged output (thanks José for the hint)
2017-03-20 14:37:25 +01:00
Enrico Forestieri
72a488d7e6 Fix output of en- and em-dashes with TeX fonts
This commit fixes the regression introduced in 2.2 about the
output of en- and em-dashes. In 2.2 en- and em-dashes are output as
the \textendash and \textemdash macros when using TeX fonts, causing
changed output in old documents and also bugs (for example, #10490).

Now documents produced with older versions work again as intended,
while documents produced with 2.2 can be made to produce the exact
same output by simply checking "Don't use ligatures for en-and
em-dashes" in Document->Settings->Fonts.

When exporting documents using TeX fonts to earlier versions, in order
to avoid changed output, a zero-width space character is inserted after
each en/em-dash if dash ligatures are allowed. These characters are
removed when reloading  documents with 2.3, so that they don't accumulate.
2017-03-19 20:50:34 +01:00
José Matos
ef6ff7fb53 lyx2lyx: Remove UTF-8 BOM if present in the lyx file 2017-03-15 10:06:30 +00:00
Juergen Spitzmueller
bedebfc45a Support for multiple bibliographies setting "per child"
This adds support for the chapterbib package, but also adds ways to
produce this sort of multibib with biblatex and bibtopic (which are
both incompatible with chapterbib).

File format change.
2017-02-04 19:23:45 +01:00
Juergen Spitzmueller
7ca20b292c Support for multiple bibliographies
Using refsection=unit in biblatex, or bibtopic's btUnit environments
in BibTeX.

File format change.
2017-02-04 12:02:00 +01:00
Juergen Spitzmueller
e15a8f3551 Extend LATEXIFY command param handling and add literal param.
File format change.

This allows for the relevant InsetCommand-based dialogs (such as
citation text before/after, Bibitem label, hyperlink name etc.)
to provide both the input of verbatim code or text that is transformed
to proper LaTeX code.

Some dialogs (Nomencl, Href) already had some methods (although they
could not be toggled), which are now centralized and streamlined.

The initial work of this patch has been done by Georg Baum (see
http://www.lyx.org/trac/attachment/ticket/2751/x.diff)

Fixes: #2751, #8227.
2017-01-30 07:44:55 +01:00
Juergen Spitzmueller
68ab4023cc Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:

\cites(pre)(post)[pre1][post1]{key1}[pre2][post2]{key2}...

with an optional general pre- and postnote, which applies to the whole
list (like [][] in normal cite commands) and an optional pre- and
postnotes for each item, so that pagination can actually be specified in
multi-cite references, as in:
(cf. Miller 2015, 2; furthermore Smith 2013, 23-23; Jenkins 2012, 103,
also refer to chapter 6 in this book)

See the biblatex manual, sec. 3.8.3., for details.

File format change.
2017-01-21 14:25:17 +01:00
Richard Heck
5cb5d2cb5a Do not replace "--" with "\twohyphens" in formula macros. 2017-01-18 21:48:35 -05:00
Richard Heck
857c099e03 Remove very old debug code. 2017-01-15 11:35:50 -05:00
Juergen Spitzmueller
d9f7642bd7 Fix revert_bibpackopts lyx2lyx routine 2017-01-15 12:48:43 +01:00
Juergen Spitzmueller
fc546b7dcc Basic support for natbib & jurabib options
This re-uses the options line edit introduced for biblatex.
2017-01-13 18:23:42 +01:00
Juergen Spitzmueller
327602d01d Implement "key only" citation style
File format change.
2017-01-13 11:53:22 +01:00
Juergen Spitzmueller
352a8e115f Merge branch 'master' into biblatex2 2017-01-08 18:41:11 +01:00
Juergen Spitzmueller
ae708fbeb6 Fix typo 2017-01-08 18:37:08 +01:00
Juergen Spitzmueller
8319b3e9d6 Biblatex support
File format change
2017-01-08 09:39:46 +01:00
Richard Heck
ff3690a5fd Add a "noprefix" option to the "labelonly" version of the reference
inset.

If the reference is "sec:mysec", then this will output just "mysec".
This is what is needed, e.g., to use refstyle's range commands, e.g.,
    \secrangeref{mysec1}{mysec2}
You *cannot* use:
    \secrangeref{sec:mysec1}{sec:mysec2}
even if those are the actual labels.

Eventually, I'd like to add native support for this, but I'm a bit
frightened of trying to make the reference dialog support multiple
selections.
2017-01-07 15:07:44 -05:00
Richard Heck
516423c54e Polish plural and capitalized reference reversion.
Thanks to Scott for noticing the problem.
2017-01-05 02:50:18 -05:00
Richard Heck
73f59e87bd Add ability to use refstyle's plural and capitalization features. 2017-01-02 22:32:36 -05:00
Richard Heck
c513c26e62 Label only command for reference dialog. 2017-01-02 18:08:30 -05:00
Juergen Spitzmueller
f8a85f35be Add support for the Crimson font
We use the more comprehensive cochineal package if available and fall
back to the crimson package, if not.

Math support is provided by means of newtxmath

Fixes: #9974, #9976
2016-12-29 16:45:19 +01:00
Juergen Spitzmueller
89ce0c9069 Support for CJK quotation marks
File format change

Fixes: #2712
2016-12-26 14:03:48 +01:00
Juergen Spitzmueller
36a679344a Implement dynamic quotation marks
File format change.
2016-12-25 12:19:02 +01:00
Juergen Spitzmueller
237193f8a8 Some new quote styles
* b    `british'    (``inner quotation'')
* w    >>swedishg>> ('inner quotation')   ["g" = Guillemets]
* f    <<french>>   (``inner quotation'')
* i    <<frenchin>> (<<inner quotation>>) ["in" = Imprimerie Nationale]
* r    <<russian>>  (,,inner quotation``)

Rename "french" to "swiss"

Also rename "single/double" to "secondary/primary" ("inner/outer" in
the UI) and "left/right" to "opening/closing". Note that the inset
identifier string is left as is ("s/d" and "l/r")
2016-12-24 14:27:00 +01:00
Juergen Spitzmueller
1ed70d10fd Add "Plain" quotation mark style
File format change
2016-12-21 15:17:30 +01:00
Juergen Spitzmueller
857506e992 Rename \\quotes_language to\\quotes_style
File format change.
2016-12-20 18:54:07 +01:00
Richard Heck
7a584f71bd Simplify some lyx2lyx code.
Also, if the local layout we are removing is all there was, then
we can remove the entire block.
2016-12-13 22:03:59 -05:00
Richard Heck
b75c718d57 New format for changes to iopart.layout made at 91f980cf31. 2016-12-13 21:49:04 -05:00
Juergen Spitzmueller
a5ebabbb99 speed up lyx2lyx reversion for non-Hebrew documents 2016-12-13 07:30:40 +01:00
Juergen Spitzmueller
e8b1ec66fc Fix some thinkos in the revert_quotes routine 2016-12-12 10:49:08 +01:00
Juergen Spitzmueller
fceae79325 revert_quotes: consider verbatim layouts and some forgotten insets. 2016-12-10 12:54:12 +01:00
Juergen Spitzmueller
e8c932ff84 Enable InsetQuote in verbatim and Hebrew
In this context, the inset outputs straight quotes in LaTeX.

File format change.

Fixes: #7309
2016-12-10 11:53:42 +01:00
Günter Milde
81f5e596b4 File format update after 418016bf79
Removing unsupported encoding "pt254" from \inputencoding values makes documents using this value invalid (J.S.).
2016-12-07 18:38:41 +01:00
Uwe Stöhr
87c00f3383 add support for Urdu and Syriac
- fileformat change
- I could not update the tex2lyx testfiles because of bug #10440 (there is now a probable fix)
2016-10-28 00:21:58 +02:00
Uwe Stöhr
d9c52c7a3f support for Amharic, Asturian, Kannada and Khmer
- fileformat change
- I could not update the tex2lyx test files because of bug #10440
- maybe the lyx2lyx routine could be improved but since a document can also begin with another layout than "Standard" I could not use the lyx2lyx function put_cmd_in_ert
2016-10-22 15:33:59 +02:00
Uwe Stöhr
f179173e42 support for the languages Bosnian, Friulian, Macedonian, Piedmontese and Romansh
- file format change
- note that I could not update the tex2lyx test files because of bug #10440
2016-10-16 15:33:23 +02:00
Richard Heck
e57e008e88 Remove debugging code. 2016-08-05 21:39:58 -04:00
Juergen Spitzmueller
90f6eb01a4 Include all [scr]article styles in beamer article layouts.
File format change. On format reversion, we need to put some extra code
in the local layout that emulates the 2.3 behavior.
Simply Input'ing the respective layouts is unfortunately not enough,
due to the insertion order.

See #9977
2016-08-04 11:42:06 +02:00
Richard Heck
0f4c14bba2 Fix hang reported at #10307.
Also, add a FIXME explaining what we'd need to do to fix the
convert_TeX_brace_to_Argument routine properly.
2016-07-23 13:44:34 -04:00