From 78f85b026fe161def95dd205b0d5e4f800ccc5b3 Mon Sep 17 00:00:00 2001 From: jamatos Date: Fri, 7 Nov 2008 19:17:35 +0000 Subject: [PATCH] Fix bug 5411 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27329 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 4 ++++ lib/lyx2lyx/LyX.py | 6 +++--- lib/lyx2lyx/lyx_1_6.py | 31 +++++++++++++++++++++++++++++-- src/Buffer.cpp | 2 +- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 436d074f08..9155e3a83f 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,10 @@ LyX file-format changes ----------------------- +2008-11-07 José Matos + * Format incremented to 345: for docbook backend CharStyle: -> Element: + (fix bug 5411) + 2008-10-12 Pavel Sanda * Format incremented to 344: sanitize backreference settings for hyperref (fix bug 5340). diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 9ad4c69c35..e5175355c7 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -79,8 +79,8 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)), ("1_2", [220], minor_versions("1.2" , 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" , 5)), - ("1_6", [] , minor_versions("1.6" , 0))] + ("1_5", range(246,277), minor_versions("1.5" , 6)), + ("1_6", range(277,346), minor_versions("1.6" , 0))] #################################################################### # This is useful just for development versions # @@ -113,7 +113,7 @@ def get_backend(textclass): " For _textclass_ returns its backend." if textclass == "linuxdoc" or textclass == "manpage": return "linuxdoc" - if textclass[:7] == "docbook": + if textclass.startswith("docbook") or textclass.startswith("agu-"): return "docbook" return "latex" diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 46855ecc4a..cefeea3ee2 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -3052,6 +3052,31 @@ def convert_backref_options(document): elif k != -1 and j != -1: document.header[k] = "\\pdf_backref section" + +def convert_charstyle_element(document): + "Convert CharStyle to Element for docbook backend" + if document.backend != "docbook": + return + i = 0 + while True: + i = find_token(document.body, "\\begin_inset Flex CharStyle:", i) + if i == -1: + return + document.body[i] = document.body[i].replace('\\begin_inset Flex CharStyle:', + '\\begin_inset Flex Element:') + +def revert_charstyle_element(document): + "Convert Element to CharStyle for docbook backend" + if document.backend != "docbook": + return + i = 0 + while True: + i = find_token(document.body, "\\begin_inset Flex Element:", i) + if i == -1: + return + document.body[i] = document.body[i].replace('\\begin_inset Flex Element:', + '\\begin_inset Flex CharStyle:') + ## # Conversion hub # @@ -3124,10 +3149,12 @@ convert = [[277, [fix_wrong_tables]], [341, []], [342, []], [343, [convert_default_options]], - [344, [convert_backref_options]] + [344, [convert_backref_options]], + [345, [convert_charstyle_element]] ] -revert = [[343, [revert_backref_options]], +revert = [[344, [revert_charstyle_element]], + [343, [revert_backref_options]], [342, [revert_default_options]], [341, [revert_mongolian]], [340, [revert_tabulators, revert_tabsize]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 44e35ab607..418ea5447f 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -117,7 +117,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 344; // ps: backref +int const LYX_FORMAT = 345; // jamatos: xml elements typedef map DepClean; typedef map > RefCache; -- 2.11.4.GIT