]> git.lyx.org Git - lyx.git/commitdiff
New file format for InsetPreview introduced in r38890.
authorVincent van Ravesteijn <vfr@lyx.org>
Sun, 28 Mar 2010 14:52:47 +0000 (14:52 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sun, 28 Mar 2010 14:52:47 +0000 (14:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33891 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_2_0.py
src/Buffer.cpp

index bd718445f845d9e1af6364ecfb42faa94cd3359a..37de77032d3d112bf590aa323a72e88e63e155e0 100644 (file)
@@ -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]],
index 27d0fe9c8e7e3de442cbd57138f47a7988121308..83f8cda7566e8ea22003d62ca6a33b255625817d 100644 (file)
@@ -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<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;