On 2018-01-09, Kornel Benko wrote: > Am Montag, 8. Januar 2018 um 23:20:24, schrieb Guenter Milde > <mi...@users.sf.net> >> On 2018-01-02, Kornel Benko wrote: >> > Am Dienstag, 2. Januar 2018 um 08:58:47, schrieb Günter Milde >> > <mi...@lyx.org> >> >> commit 20f3b828f942f8b6d76fb48fd34f9187532092d8 >> >> Author: Günter Milde <mi...@lyx.org> >> >> Date: Mon Jan 1 22:52:08 2018 +0100
>> Just turning off an "offending" test is not a good idea generally. > Yes. >> The test failures reveales several problems: >> a) Wrong conversion of -- in "Code" logical markup insets (see #10961). >> b) Missing spacing around en dash in several documents. >> c) "False positive" warning from the lyx2lyx converter. >> However: >> While problems a) and b) are now solved, problem c) still leads >> (spurious) warnings of possible line-break changes. >> The problem is in the limited detection capability in the lyx2lyx converter: >> Currently, there is no reliable test for the current font in lyx2lyx. >> We can invert the failing tests as LyX-bug (#10836) >:( >> It may be that the patch >> http://www.lyx.org/trac/raw-attachment/ticket/10961/0001-Do-not-convert-dasheshyphens-in-Code-insets-logical-markup.patch >> already fixes the Additional.lyx tests. > This seems already applied. I don't see it applied in origin/2.3.x. >> Eventually, we also need to skip -- to \twohyphens conversion in typewriter, >> see appended patch. > (With reverted changes of filterCheckWarnings) > Without your patch > all lyx22-exports pass > 7 lyx21-exports fail out of 338 > 1641 - export/doc/UserGuide_lyx21 (Failed) > 2080 - export/doc/de/UserGuide_lyx21 (Failed) > 2112 - export/doc/es/Additional_lyx21 (Failed) > 2320 - export/doc/fr/Additional_lyx21 (Failed) > 2672 - export/doc/ja/Additional_lyx21 (Failed) > 3525 - export/examples/lilypond_lyx21 (Failed) > 5369 - export/examples/ja/lilypond_lyx21 (Failed) > With your patch applied > all lyx22-exports pass > 184 lyx21-exports fail out of 338 > (Too many to list) I forgot an import in lyx_2_2.py. Günter diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py index 12ccd4a003..49287cade3 100644 --- a/lib/lyx2lyx/lyx_2_2.py +++ b/lib/lyx2lyx/lyx_2_2.py @@ -36,7 +36,7 @@ from lyx2lyx_tools import add_to_preamble, put_cmd_in_ert, get_ert, lyx2latex, \ from parser_tools import find_token, find_token_backwards, find_re, \ find_end_of_inset, find_end_of_layout, find_nonempty_line, \ - get_containing_layout, get_value, check_token + get_containing_layout, get_value, check_token, find_end_of_font_switch #################################################################### # Private helper functions @@ -634,6 +634,16 @@ def convert_dashes(document): else: i = j continue + if words == ["\\family", "typewriter"]: + j = find_end_of_font_switch(document.body, i, "\\family") + if j == -1: + document.warning("Malformed LyX document: Can't find end of " + + words[1] + " font switch at line " + str(i)) + i += 1 + else: + i = j + continue + if len(words) > 0 and words[0] in ["\\leftindent", "\\paragraph_spacing", "\\align", "\\labelwidthstring"]: # skip paragraph parameters (bug 10243) i += 1