On Friday, February 26, 2016 02:45:08 PM Jean-Marc Lasgouttes wrote:
> Le 26/02/2016 05:07, Scott Kostyshak a écrit :
> >> We don't have a patch.
> > 
> > Nevermind. A patch was proposed here:
> > https://www.mail-archive.com/search?l=mid&q=56B365D0.4040203%40free.fr
> 
> So someone has to update it and add the lyx2lyx glue. Before you ask, I
> am not really at ease with this :)
> 
> JMarc

This is an easy task. The lyx2lyx code follows untested and it should be 
correct (TM). :-)

>From the original patch the changes to lib/lyx2lyx/lyx_2_1.py should be 
dropped as we are not changing the format there but only in 2.2.

I hope that this helps,
-- 
José Abílio
diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py
index a1f3005..dcffb01 100644
--- a/lib/lyx2lyx/lyx_2_2.py
+++ b/lib/lyx2lyx/lyx_2_2.py
@@ -104,6 +104,36 @@ def revert_Argument_to_TeX_brace(document, line, endline, n, nmax, environment,
 ###
 ###############################################################################
 
+def convert_longtable_label_internal(document, forward):
+    """
+    Convert the reference to "longtable" into "multi-page table" if forward is True
+    else revert it.
+    """
+    old_reference = "\\begin_inset Caption LongTableNoNumber"
+    new_reference = "\\begin_inset Caption MultiPageTableNoNumber"
+
+    # if the purpose is to revert swap the strings roles
+    if not forward:
+        old_reference, new_reference = new_reference, old_reference
+
+    i = 0
+    while True:
+        i = find_token(document.body, old_reference, i)
+
+        if i == -1:
+            return
+
+        document.body[i] = new_reference
+
+
+def convert_longtable_label(document):
+    convert_longtable_label_internal(document, True)
+
+
+def revert_longtable_label(document):
+    convert_longtable_label_internal(document, False)
+
+
 def convert_separator(document):
     """
     Convert layout separators to separator insets and add (LaTeX) paragraph
@@ -2253,10 +2283,12 @@ convert = [
            [503, []],
            [504, [convert_save_props]],
            [505, []],
-           [506, [convert_info_tabular_feature]]
+           [506, [convert_info_tabular_feature]],
+           [507, [convert_longtable_label]] 
           ]
 
 revert =  [
+           [506, [revert_longtable_label]],
            [505, [revert_info_tabular_feature]],
            [504, []],
            [503, [revert_save_props]],

Reply via email to