From 9608e4971bdc4108b8de353f051e18cca6b64e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Sun, 25 Nov 2007 21:09:01 +0000 Subject: [PATCH] support for the languages Latin and North Sami - fileformat change (I wonder why support for them was removed (must be before LyX 1.3), because the old reLyX script listed them as supported) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21783 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 3 +++ lib/languages | 11 +++++++---- lib/lyx2lyx/LyX.py | 2 +- lib/lyx2lyx/lyx_1_6.py | 40 ++++++++++++++++++++++++++++++++++++++-- src/Buffer.cpp | 2 +- 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 298a787d9c..7af2d070aa 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,9 @@ LyX file-format changes ----------------------- +2007-11-25 Uwe Stöhr + * Format incremented to 302: support for Latin and North Sami + 2007-11-24 Uwe Stöhr * Format incremented to 301: support for \linebreak diff --git a/lib/languages b/lib/languages index 429c399394..2cd3478ee0 100644 --- a/lib/languages +++ b/lib/languages @@ -41,6 +41,7 @@ hebrew hebrew "Hebrew" true cp1255 he_IL "" # "hungarian" is a synonym for the "magyar" babel language option # "hungarian" might be used for special purposes, see http://www.math.bme.hu/latex/magyar_pre_tug2004.pdf #hungarian hungarian "Hungarian" false iso8859-2 hu_HU "" +icelandic icelandic "Icelandic" false iso8859-15 is_IS "" irish irish "Irish" false iso8859-15 ga_IE "" italian italian "Italian" false iso8859-15 it_IT "" japanese "" "Japanese" false euc-jp ja_JP "" @@ -48,10 +49,11 @@ japanese-plain "" "Japanese (non-CJK)" false euc-jp-plain ja_JP "" kazakh kazakh "Kazakh" false pt154 kk_KZ "" # there is no country code for Korean because ko_KR is the same as ko_KI korean "" "Korean" false euc-kr ko "" -lowersorbian lowersorbian "Lower Sorbian" false iso8859-2 dsb_DE "" -lithuanian lithuanian "Lithuanian" false iso8859-13 lt_LT "" +# there is no country code for Latin because it is a dead language +latin latin "Latin" false iso8859-15 la "" latvian latvian "Latvian" false iso8859-13 lv_LV "" -icelandic icelandic "Icelandic" false iso8859-15 is_IS "" +lithuanian lithuanian "Lithuanian" false iso8859-13 lt_LT "" +lowersorbian lowersorbian "Lower Sorbian" false iso8859-2 dsb_DE "" magyar magyar "Hungarian" false iso8859-2 hu_HU "" norsk norsk "Norsk" false iso8859-15 nb_NO "" nynorsk nynorsk "Nynorsk" false iso8859-15 nn_NO "" @@ -59,12 +61,13 @@ polish polish "Polish" false iso8859-2 pl_PL "" portuguese portuges "Portuguese" false iso8859-15 pt_PT "" romanian romanian "Romanian" false iso8859-2 ro_RO "" russian russian "Russian" false koi8 ru_RU "" +samin samin "North Sami" false iso8859-15 se_NO "" scottish scottish "Scottish" false iso8859-15 gd_GB "" serbian croatian "Serbian" false iso8859-5 sr_HR "" serbocroatian croatian "Serbo-Croatian" false iso8859-2 sh_HR "" -spanish spanish "Spanish" false iso8859-15 es_ES "\deactivatetilden\renewcommand\shorthandsspanish{}" slovak slovak "Slovak" false iso8859-2 sk_SK "" slovene slovene "Slovene" false iso8859-2 sl_SI "" +spanish spanish "Spanish" false iso8859-15 es_ES "\deactivatetilden\renewcommand\shorthandsspanish{}" swedish swedish "Swedish" false iso8859-15 sv_SE "" thai thai "Thai" false tis620-0 th_TH "\usepackage{thswitch}" turkish turkish "Turkish" false iso8859-9 tr_TR "" diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 6cb03c5b3a..1f98a2d0b8 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -80,7 +80,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)), ("1_3", [221], minor_versions("1.3" , 7)), ("1_4", range(222,246), minor_versions("1.4" , 5)), ("1_5", range(246,277), minor_versions("1.5" , 2)), - ("1_6", range(277,302), minor_versions("1.6" , 0))] # Uwe: \linebreak + ("1_6", range(277,303), minor_versions("1.6" , 0))] # Uwe: Latin and North Sami def formats_list(): diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 1d191621da..c33160caea 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -810,6 +810,40 @@ def revert_linebreak(document): i = i + 1 +def revert_latin(document): + "Set language Latin to English" + i = 0 + if document.language == "latin": + document.language = "english" + i = find_token(document.header, "\\language", 0) + if i != -1: + document.header[i] = "\\language english" + j = 0 + while True: + j = find_token(document.body, "\\lang latin", j) + if j == -1: + return + document.body[j] = document.body[j].replace("\\lang latin", "\\lang english") + j = j + 1 + + +def revert_samin(document): + "Set language North Sami to English" + i = 0 + if document.language == "samin": + document.language = "english" + i = find_token(document.header, "\\language", 0) + if i != -1: + document.header[i] = "\\language english" + j = 0 + while True: + j = find_token(document.body, "\\lang samin", j) + if j == -1: + return + document.body[j] = document.body[j].replace("\\lang samin", "\\lang english") + j = j + 1 + + ## # Conversion hub # @@ -839,10 +873,12 @@ convert = [[277, [fix_wrong_tables]], [298, []], [299, []], [300, []], - [301, []] + [301, []], + [302, []] ] -revert = [[300, [revert_linebreak]], +revert = [[301, [revert_latin, revert_samin]], + [300, [revert_linebreak]], [299, [revert_pagebreak]], [298, [revert_hyperlinktype]], [297, [revert_macro_optional_params]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 526c4bae6b..223767aed8 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -153,7 +153,7 @@ namespace os = support::os; namespace { -int const LYX_FORMAT = 301; // Uwe: \linebreak +int const LYX_FORMAT = 302; // Uwe: Latin and North Sami } // namespace anon