From 319ee3296a6bf7c44c202a1c6e24427d0b9b4138 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 9 Apr 2015 11:01:44 +0200 Subject: [PATCH] File format change caused by 34eadf5d4. --- development/FORMAT | 4 ++++ lib/lyx2lyx/LyX.py | 2 +- lib/lyx2lyx/lyx_2_2.py | 35 ++++++++++++++++++++++++++++++----- src/version.h | 4 ++-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 6fb18ec242..ffd2b07069 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -11,6 +11,10 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. ----------------------- +2015-04-09 Jürgen Spitzmüller + * Format incremented to 485: new par layout for sigplanconf.layout: + DOI. + 2015-04-06 Uwe Stöhr * Format incremented to 484: support for Georgian: \lang georgian diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 59723ef936..2ab78bb613 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -85,7 +85,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)), ("1_6", list(range(277,346)), minor_versions("1.6" , 10)), ("2_0", list(range(346,414)), minor_versions("2.0" , 8)), ("2_1", list(range(414,475)), minor_versions("2.1" , 0)), - ("2_2", list(range(475,485)), minor_versions("2.2" , 0)) + ("2_2", list(range(475,486)), minor_versions("2.2" , 0)) ] #################################################################### diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py index aedd376e7a..1fd0fed022 100644 --- a/lib/lyx2lyx/lyx_2_2.py +++ b/lib/lyx2lyx/lyx_2_2.py @@ -29,9 +29,9 @@ import sys, os # find_token_exact, find_end_of_inset, find_end_of_layout, \ # find_token_backwards, is_in_inset, get_value, get_quoted_value, \ # del_token, check_token, get_option_value - -from lyx2lyx_tools import add_to_preamble, put_cmd_in_ert#, \ -# insert_to_preamble, lyx2latex, latex_length, revert_flex_inset, \ + +from lyx2lyx_tools import add_to_preamble, put_cmd_in_ert, lyx2latex#, \ +# insert_to_preamble, latex_length, revert_flex_inset, \ # revert_font_attrs, hex2ratio, str2bool from parser_tools import find_token, find_token_backwards, find_re, \ @@ -703,7 +703,30 @@ def revert_georgian(document): else: l = find_token(document.header, "\\use_default_options", 0) document.header.insert(l + 1, "\\options georgian") - + + +def revert_sigplan_doi(document): + " Reverts sigplanconf DOI layout to ERT " + + if document.textclass != "sigplanconf": + return + + i = 0 + while True: + i = find_token(document.body, "\\begin_layout DOI", i) + if i == -1: + return + j = find_end_of_layout(document.body, i) + if j == -1: + document.warning("Malformed LyX document: Can't find end of DOI layout") + i += 1 + continue + + content = lyx2latex(document, document.body[i:j + 1]) + add_to_preamble(document, ["\\doi{" + content + "}"]) + del document.body[i:j + 1] + # no need to reset i + ## # Conversion hub @@ -723,10 +746,12 @@ convert = [ [481, [convert_dashes]], [482, [convert_phrases]], [483, [convert_specialchar]], - [484, []] + [484, []], + [485, []] ] revert = [ + [484, [revert_sigplan_doi]], [483, [revert_georgian]], [482, [revert_specialchar]], [481, [revert_phrases]], diff --git a/src/version.h b/src/version.h index 249106bad4..d9409d3e0d 100644 --- a/src/version.h +++ b/src/version.h @@ -32,8 +32,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 484 // uwestoehr: support for Georgian -#define LYX_FORMAT_TEX2LYX 484 +#define LYX_FORMAT_LYX 485 // spitz: support DOI in sigplanconf +#define LYX_FORMAT_TEX2LYX 485 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER -- 2.39.2