From a4ec2fc8fea8c947967bde9bb124af9e9aade705 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 28 Mar 2010 14:52:47 +0000 Subject: [PATCH] New file format for InsetPreview introduced in r38890. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33891 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 33 +++++++++++++++++++++++++++++++-- src/Buffer.cpp | 2 +- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index bd718445f8..37de77032d 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1237,6 +1237,33 @@ def revert_math_output(document): document.header[i] = "\\html_use_mathml " + newval + +def revert_inset_preview(document): + " Dissolves the preview inset " + i = 0 + j = 0 + k = 0 + while True: + i = find_token(document.body, "\\begin_inset Preview", i) + if i == -1: + return + j = find_end_of_inset(document.body, i) + if j == -1: + document.warning("Malformed LyX document: Could not find end of Preview inset.") + return + #If the layout is Standard we need to remove it, otherwise there + #will be paragraph breaks that shouldn't be there. + k = find_token(document.body, "\\begin_layout Standard", i) + if k == i+2: + del document.body[i : i+3] + del document.body[j-5 : j-2] + i -= 6 + else: + del document.body[i] + del document.body[j-1] + i -= 2 + + ## # Conversion hub # @@ -1275,10 +1302,12 @@ convert = [[346, []], [376, []], [377, []], [378, []], - [379, [convert_math_output]] + [379, [convert_math_output]], + [380, []] ] -revert = [[378, [revert_math_output]], +revert = [[379, [revert_inset_preview]], + [378, [revert_math_output]], [377, []], [376, [revert_multirow]], [375, [revert_includeall]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 27d0fe9c8e..83f8cda756 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 = 379; // rgh: xhtml math output type +int const LYX_FORMAT = 380; // vfr: introduction of insetpreview typedef map DepClean; typedef map > RefCache;