]> git.lyx.org Git - features.git/commitdiff
fix bug 4837.
authorJürgen Spitzmüller <spitz@lyx.org>
Thu, 8 May 2008 09:43:27 +0000 (09:43 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Thu, 8 May 2008 09:43:27 +0000 (09:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24682 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_1_6.py
src/insets/InsetIndex.cpp

index c8bc593777ba2298b8d3c6cf5350bd03da4d1fa8..f96d9d8696c87fbf985d56238969dca6e20d5e80 100644 (file)
@@ -788,7 +788,7 @@ def convert_latexcommand_index(document):
           document.body.insert(i + 4, "\\end_inset")
           i += 2
         # Generic, \\ -> \backslash:
-        g = wrap_into_ert(g, r'\\', '\\backslash{}')
+        g = wrap_into_ert(g, r'\\', '\\backslash')
         g = wrap_into_ert(g, '{', '{')
         g = wrap_into_ert(g, '}', '}')
         document.body.insert(i + 3, g)
index 76d31ca26e1a81c90da8e2cea70a2ac85efbc950..da82e7e64a178d2764aafd957a3cd8c4604354cd 100644 (file)
@@ -49,17 +49,26 @@ int InsetIndex::latex(odocstream & os,
        os << "\\index";
        os << '{';
        odocstringstream ods;
-       InsetText::latex(ods, runparams);
+       int i = InsetText::latex(ods, runparams);
+       bool sorted = false;
        // correctly sort macros and formatted strings
        // if we do find a command, prepend a plain text
        // version of the content to get sorting right,
        // e.g. \index{LyX@\LyX}, \index{text@\textbf{text}}
        // Don't do that if the user entered '@' himself, though.
        if (contains(ods.str(), '\\') && !contains(ods.str(), '@')) {
-               if (InsetText::plaintext(os, runparams) > 0)
+               if (InsetText::plaintext(os, runparams) > 0) {
                        os << '@';
+                       sorted = true;
+               }
        }
-       int i = InsetText::latex(os, runparams);
+       // if a hierarchy tag '!' is used, ommit this in the post-@ part.
+       if (sorted && contains(ods.str(), '!')) {
+               string dummy;
+               // FIXME unicode
+               os << from_utf8(rsplit(to_utf8(ods.str()), dummy, '!'));
+       } else
+               i = InsetText::latex(os, runparams);
        os << '}';
        return i;
 }