From 879ed8e2edd1c1d82120962c9b8ecba7fb5ec0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Thu, 1 Apr 2010 00:40:19 +0000 Subject: [PATCH] fileformat change: - support for Turkmen git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34000 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 3 +++ lib/languages | 1 + lib/lyx2lyx/lyx_2_0.py | 23 +++++++++++++++++++++-- src/Buffer.cpp | 2 +- src/BufferParams.cpp | 13 +++++++++---- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 9208577903..31237f7828 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,9 @@ The good example would be 2010-01-10 entry. ----------------------- +2010-03-31 Uwe Stöhr + * Format incremented to 383: support for Turkmen + 2010-03-31 Uwe Stöhr * Format incremented to 382: support to change the font color for greyed-out notes: new parameter \notefontcolor diff --git a/lib/languages b/lib/languages index 54be6912a4..50198e98a1 100644 --- a/lib/languages +++ b/lib/languages @@ -82,6 +82,7 @@ spanish-mexico spanish "Spanish (Mexico)" false iso8859-15 es_MX "\addto\s 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 "" +turkmen turkmen "Turkmen" false utf8 tk_TM "" ukrainian ukrainian "Ukrainian" false koi8-u uk_UA "" uppersorbian uppersorbian "Upper Sorbian" false iso8859-2 hsb_DE "" vietnamese vietnam "Vietnamese" false utf8 vi_VN "" diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index d1f4620538..39f118874b 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1376,6 +1376,23 @@ def revert_notefontcolor(document): + ' {\\textcolor{note_fontcolor}\\bgroup}{\\egroup}\n') +def revert_turkmen(document): + "Set language Turkmen to English" + i = 0 + if document.language == "turkmen": + 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 turkmen", j) + if j == -1: + return + document.body[j] = document.body[j].replace("\\lang turkmen", "\\lang english") + j = j + 1 + + ## # Conversion hub # @@ -1417,10 +1434,12 @@ convert = [[346, []], [379, [convert_math_output]], [380, []], [381, []], - [382, []] + [382, []], + [383, []] ] -revert = [[381, [revert_notefontcolor]], +revert = [[382, [revert_turkmen]], + [381, [revert_notefontcolor]], [380, [revert_equalspacing_xymatrix]], [379, [revert_inset_preview]], [378, [revert_math_output]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 1fe191a26a..646cd7616a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -126,7 +126,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 382; // uwestoehr: support to change font color for greyed-out notes +int const LYX_FORMAT = 383; // uwestoehr: support for Turkmen typedef map DepClean; typedef map > RefCache; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index bd43f2819f..480ab941c2 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1210,10 +1210,12 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // viet = string::npos when not found // the same is for all other languages that are not directly supported by // babel, but where LaTeX-packages add babel support. - // this is currently the case for Latvian, Lithuanian, and Mongolian + // this is currently the case for Latvian, Lithuanian, Mongolian + // and Turkmen size_t latvian = language_options.str().find("latvian"); size_t lithu = language_options.str().find("lithuanian"); size_t mongo = language_options.str().find("mongolian"); + size_t turkmen = language_options.str().find("turkmen"); // if Japanese is used, babel must directly be loaded // with language options, not in the class options, see // http://www.lyx.org/trac/ticket/4597#c4 @@ -1221,7 +1223,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, if (lyxrc.language_global_options && !language_options.str().empty() && viet == string::npos && japan == string::npos && latvian == string::npos && lithu == string::npos - && mongo == string::npos) + && mongo == string::npos && turkmen == string::npos) clsoptions << language_options.str() << ','; } @@ -2103,17 +2105,20 @@ string BufferParams::babelCall(string const & lang_opts) const // viet = string::npos when not found // the same is for all other languages that are not directly supported by // babel, but where LaTeX-packages add babel support. - // this is currently the case for Latvian, Lithuanian, and Mongolian + // this is currently the case for Latvian, Lithuanian, Mongolian + // and Turkmen size_t latvian = lang_opts.find("latvian"); size_t lithu = lang_opts.find("lithuanian"); size_t mongo = lang_opts.find("mongolian"); + size_t turkmen = lang_opts.find("turkmen"); // If Japanese is used, babel must directly be loaded with the // language options, see // http://www.lyx.org/trac/ticket/4597#c4 size_t japan = lang_opts.find("japanese"); if (!lyxrc.language_global_options || viet != string::npos || japan != string::npos || latvian != string::npos - || lithu != string::npos || mongo != string::npos) + || lithu != string::npos || mongo != string::npos + || turkmen != string::npos) return "\\usepackage[" + lang_opts + "]{babel}"; return lang_pack; }