commit 463e12827ce4466bd679d3f8c3fe3c6f5aff39e2 Author: José Matos <jama...@lyx.org> Date: Mon Mar 27 10:36:30 2017 +0100
lyx2lyx: more descriptive member name (document.start -> document.initial_format) --- lib/lyx2lyx/LyX.py | 4 ++-- lib/lyx2lyx/lyx_2_0.py | 2 +- lib/lyx2lyx/lyx_2_3.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index b924690..c76fc58 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -393,6 +393,7 @@ class LyX_base: self.inputencoding = get_value(self.header, b"\\inputencoding", 0, default = b"auto").decode('ascii') self.format = self.read_format() + self.initial_format = self.format self.encoding = get_encoding(self.language, self.inputencoding, self.format, self.cjk_encoding) @@ -698,7 +699,6 @@ class LyX_base: conversion are taken. It returns a list of modules needed to convert the LyX file from self.format to self.end_format""" - self.start = self.format format = self.format correct_version = 0 @@ -732,7 +732,7 @@ class LyX_base: # Convertion mode, back or forth steps = [] - if (initial_step, self.start) < (final_step, self.end_format): + if (initial_step, self.initial_format) < (final_step, self.end_format): mode = "convert" full_steps = [] for step in format_relation: diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 6f897d5..ad56364 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -820,7 +820,7 @@ def revert_suppress_date(document): def convert_mhchem(document): "Set mhchem to off for versions older than 1.6.x" - if document.start < 277: + if document.initial_format < 277: # LyX 1.5.x and older did never load mhchem. # Therefore we must switch it off: Documents that use mhchem have # a manual \usepackage anyway, and documents not using mhchem but diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py index 1da16f2..5b770ed 100644 --- a/lib/lyx2lyx/lyx_2_3.py +++ b/lib/lyx2lyx/lyx_2_3.py @@ -1846,7 +1846,7 @@ def convert_dashligatures(document): i = find_token(document.header, "\\use_microtype", 0) if i != -1: - if document.start > 474 and document.start < 509: + if document.initial_format > 474 and document.initial_format < 509: # This was created by LyX 2.2 document.header[i+1:i+1] = ["\\use_dash_ligatures false"] else: