]> git.lyx.org Git - features.git/commitdiff
Support for Mongolian, fileformat change
authorUwe Stöhr <uwestoehr@web.de>
Sat, 11 Oct 2008 23:52:31 +0000 (23:52 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Sat, 11 Oct 2008 23:52:31 +0000 (23:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26848 a592a061-630c-0410-9148-cb99ea01b6c8

development/FORMAT
lib/languages
lib/lyx2lyx/lyx_1_6.py
src/Buffer.cpp
src/BufferParams.cpp

index 84539258657383f99d6da46590eac8dbb012bf70..4cc7df1a2df611afadb83f7de9f0e1797cebedd7 100644 (file)
@@ -1,6 +1,9 @@
 LyX file-format changes
 -----------------------
 
+2008-10-12 Uwe Stöhr <uwestoehr@web.de>
+       * Format incremented to 342: support for Mongolian".
+
 2008-09-30 Uwe Stöhr <uwestoehr@web.de>
        * Format incremented to 341: support for TABs in listings".
 
index 9fdf0d981ea7e898646316e127d16923114eb64d..c84de65febdc3241c21635ecb3177fdeff5d6764 100644 (file)
@@ -63,6 +63,7 @@ latvian     latvian   "Latvian"       false  iso8859-4  lv_LV  ""
 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  ""
+mongolian   mongolian  "Mongolian"     false  utf8       mn_MN  ""
 norsk       norsk      "Norsk"         false  iso8859-15 nb_NO  ""
 nynorsk     nynorsk    "Nynorsk"       false  iso8859-15 nn_NO  ""
 polish      polish     "Polish"        false  iso8859-2  pl_PL  ""
index c2dafd1209bc21affc4159c8f3e12a7dd976f3b6..d87d84d18f639f8fe2a3660629f94590d392d26b 100644 (file)
@@ -2937,6 +2937,23 @@ def revert_tabsize(document):
         j += 1
 
 
+def revert_mongolian(document):
+    "Set language Mongolian to English"
+    i = 0
+    if document.language == "mongolian":
+        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 mongolian", j)
+        if j == -1:
+            return
+        document.body[j] = document.body[j].replace("\\lang mongolian", "\\lang english")
+        j = j + 1
+
+
 ##
 # Conversion hub
 #
@@ -3006,10 +3023,12 @@ convert = [[277, [fix_wrong_tables]],
            [338, []],
            [339, []],
            [340, [add_plain_layout]],
-           [341, []]
+           [341, []],
+           [342, []]
           ]
 
-revert =  [[340, [revert_tabulators, revert_tabsize]],
+revert =  [[341, [revert_mongolian]],
+           [340, [revert_tabulators, revert_tabsize]],
            [339, []],
            [338, [revert_removed_modules]],
            [337, [revert_polytonicgreek]],
index 9db261dec7f0c085b8c7044c07d74f951bdfc389..f46f7b0029b45ac33d6c10efe0f5371bcd5a0f3f 100644 (file)
@@ -115,7 +115,7 @@ namespace os = support::os;
 
 namespace {
 
-int const LYX_FORMAT = 341; //uwestoehr: TAB support for listings
+int const LYX_FORMAT = 342; //uwestoehr: support for Mongolian
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
index ef47ea823d7fc0e053acd52a2613d5060104e391..329104080606030dc45eebe5babc22be89d34612 100644 (file)
@@ -1030,19 +1030,20 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129417.html
                size_t viet = language_options.str().find("vietnam");
                // 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
+               size_t latvian = language_options.str().find("latvian");
+               size_t lithu = language_options.str().find("lithuanian");
+               size_t mongo = language_options.str().find("mongolian");
                // if Japanese is used, babel must directly be loaded
                // with language options, not in the class options, see
                // http://bugzilla.lyx.org/show_bug.cgi?id=4597#c4
                size_t japan = language_options.str().find("japanese");
-               // if Latvian or Lithuanian is used, babel must directly be loaded
-               // with language options, not in the class options, see
-               // http://bugzilla.lyx.org/show_bug.cgi?id=5323
-               size_t latvian = language_options.str().find("latvian");
-               size_t lithu = language_options.str().find("lithuanian");
-               if (lyxrc.language_global_options
-                       && !language_options.str().empty()
+               if (lyxrc.language_global_options && !language_options.str().empty()
                        && viet == string::npos && japan == string::npos
-                       && latvian == string::npos && lithu == string::npos)
+                       && latvian == string::npos && lithu == string::npos
+                       && mongo == string::npos)
                        clsoptions << language_options.str() << ',';
        }
 
@@ -1872,18 +1873,19 @@ string BufferParams::babelCall(string const & lang_opts) const
        // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129417.html
        size_t viet = lang_opts.find("vietnam");
        // 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
+       size_t latvian = lang_opts.find("latvian");
+       size_t lithu = lang_opts.find("lithuanian");
+       size_t mongo = lang_opts.find("mongolian");
        // If Japanese is used, babel must directly be loaded with the
        // language options, see
        // http://bugzilla.lyx.org/show_bug.cgi?id=4597#c4
        size_t japan = lang_opts.find("japanese");
-       // If Latvian or Lithuanian is used, babel must directly be loaded with
-       // the language options, see
-       // http://bugzilla.lyx.org/show_bug.cgi?id=5323
-       size_t latvian = lang_opts.find("latvian");
-       size_t lithu = lang_opts.find("lithuanian");
        if (!lyxrc.language_global_options || viet != string::npos
                || japan != string::npos || latvian != string::npos
-               || lithu != string::npos)
+               || lithu != string::npos || mongo != string::npos)
                return "\\usepackage[" + lang_opts + "]{babel}";
        return lang_pack;
 }