]> git.lyx.org Git - features.git/commitdiff
Fix warning in lyx2lyx 2.0<->2.1 round trip
authorGeorg Baum <baum@lyx.org>
Sun, 27 Apr 2014 16:04:40 +0000 (18:04 +0200)
committerGeorg Baum <baum@lyx.org>
Sun, 27 Apr 2014 16:05:22 +0000 (18:05 +0200)
revert_justification() issues a warning if the \justification parameter does
not exist, and LyX itself always writes it unconditionally as well, so add it
also in lyx2lyx when converting old documents.
Currently this does not have any user visible effect, but it decouples the
default value of BufferParams::justification from the conversion of old
documents: Now it is possible to set the default to false in LyX, and old
documents will still be converted correctly.

lib/lyx2lyx/lyx_2_1.py
status.21x

index 5459e1ddb45790bbbfab843a6db6591d0a30e043..9ecd232b382be8d26bc0fb6809cd047fb8e22891 100644 (file)
@@ -387,6 +387,15 @@ def revert_japanese_encodings(document):
         document.header[i] = "\\inputencoding %s" % jap_enc_dict[val]
 
 
+def convert_justification(document):
+    " Add the \\justification buffer param"
+    i = find_token(document.header, "\\use_indices" , 0)
+    if i == -1:
+        document.warning("Malformed LyX document: Missing \\use_indices.")
+        return
+    document.header.insert(i + 1, "\\justification true")
+
+
 def revert_justification(document):
     " Revert the \\justification buffer param"
     if not del_token(document.header, '\\justification', 0):
@@ -4432,7 +4441,7 @@ convert = [
            [415, [convert_undertilde]],
            [416, []],
            [417, [convert_japanese_encodings]],
-           [418, []],
+           [418, [convert_justification]],
            [419, []],
            [420, [convert_biblio_style]],
            [421, [convert_longtable_captions]],
index c32b380317979de160ba8803a01cda82932d7edf..fa59799dfc133259e4ece9b9cc6bad15cb7eac3f 100644 (file)
@@ -64,6 +64,9 @@ What's new
 
 - Fix conversion of beamer block titles ending with non-ERT insets to 2.1 format.
 
+- Add \justification parameter when converting to 2.1 format (avoids when
+  converting back to 2.0 format).
+
 
 * USER INTERFACE