From 1e681cdc805204e49559f7d116e9dd550649bf48 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 2 Dec 2012 15:19:40 +0100 Subject: [PATCH 1/2] Fix lyx2lyx (#8438) --- lib/lyx2lyx/lyx_2_1.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index f155395e89..97478bff22 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1210,6 +1210,9 @@ def convert_latexargs(document): # Find beginning and end of the containing paragraph parbeg = find_token_backwards(document.body, "\\begin_layout", i) + while get_value(document.body, "\\begin_layout", parbeg) == "Plain Layout": + # Probably a preceding inset. Continue searching ... + parbeg = find_token_backwards(document.body, "\\begin_layout", parbeg - 1) if parbeg == -1: document.warning("Malformed lyx document: Can't find parent paragraph layout") continue @@ -1623,11 +1626,12 @@ def convert_literate(document): def revert_itemargs(document): " Reverts \\item arguments to TeX-code " + i = 0 while True: - i = find_token(document.body, "\\begin_inset Argument item:", 0) - j = find_end_of_inset(document.body, i) + i = find_token(document.body, "\\begin_inset Argument item:", i) if i == -1: - break + return + j = find_end_of_inset(document.body, i) lastlay = find_token_backwards(document.body, "\\begin_layout", i) beginPlain = find_token(document.body, "\\begin_layout Plain Layout", i) endLayout = find_token(document.body, "\\end_layout", beginPlain) From fdee77a6b5fd337556afee83015934ad4cc23ac4 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 2 Dec 2012 15:47:23 +0100 Subject: [PATCH 2/2] Fix monolithic build --- src/insets/InsetArgument.cpp | 15 --------------- src/insets/InsetLayout.cpp | 4 ++-- src/insets/InsetLayout.h | 1 + 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index e4acd6b236..4b57f5515b 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -229,21 +229,6 @@ FontInfo InsetArgument::getLabelfont() const return getLayout().labelfont(); } -namespace { - -InsetLayout::InsetDecoration translateDecoration(std::string const & str) -{ - if (support::compare_ascii_no_case(str, "classic") == 0) - return InsetLayout::CLASSIC; - if (support::compare_ascii_no_case(str, "minimalistic") == 0) - return InsetLayout::MINIMALISTIC; - if (support::compare_ascii_no_case(str, "conglomerate") == 0) - return InsetLayout::CONGLOMERATE; - return InsetLayout::DEFAULT; -} - -}// namespace anon - InsetLayout::InsetDecoration InsetArgument::decoration() const { InsetLayout::InsetDecoration dec = getLayout().decoration(); diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index a86bef26cc..15b3dee7db 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -47,8 +47,6 @@ InsetLayout::InsetLayout() : } -namespace { - InsetLayout::InsetDecoration translateDecoration(std::string const & str) { if (support::compare_ascii_no_case(str, "classic") == 0) @@ -60,6 +58,8 @@ InsetLayout::InsetDecoration translateDecoration(std::string const & str) return InsetLayout::DEFAULT; } +namespace { + InsetLayout::InsetLaTeXType translateLaTeXType(std::string const & str) { if (support::compare_ascii_no_case(str, "command") == 0) diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h index 25e58c9ec7..6bad059232 100644 --- a/src/insets/InsetLayout.h +++ b/src/insets/InsetLayout.h @@ -272,6 +272,7 @@ private: /// InsetLayout::InsetLyXType translateLyXType(std::string const & str); +InsetLayout::InsetDecoration translateDecoration(std::string const & str); } // namespace lyx