diff --git a/development/FORMAT b/development/FORMAT index c4bf1b7ef9..0b1d110db4 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,17 +1,21 @@ LyX file-format changes ----------------------- +2007-10-12 Pavel Sanda + * Format incremented to 294: PDFOptions: add usetitle, + fix leftovers + 2007-10-11 Bo Peng * Format incremented to 293: Add InsetInfo. -2007-10-09 Uwe Stöhr Uwe Stöhr +2007-10-09 Uwe Stöhr * Format incremented to 292: Support for Japanese without using CJK and inputenc. (japanese-plain) -2007-10-04 Uwe Stöhr Uwe Stöhr +2007-10-04 Uwe Stöhr * Format incremented to 291: Support for Vietnamese. -2007-10-03 Uwe Stöhr Uwe Stöhr +2007-10-03 Uwe Stöhr * Format incremented to 290: Add table wrap floats. 2007-10-03 Martin Vermeer diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 0354ca364e..121a453bde 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -79,8 +79,8 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)), ("1_2", [220], minor_versions("1.2" , 4)), ("1_3", [221], minor_versions("1.3" , 7)), ("1_4", range(222,246), minor_versions("1.4" , 5)), - ("1_5", range(246,277), minor_versions("1.5" , 1)), - ("1_6", range(277,294), minor_versions("1.6" , 0))] + ("1_5", range(246,277), minor_versions("1.5" , 2)), + ("1_6", range(277,295), minor_versions("1.6" , 0))] # Pavel pdfoptions def formats_list(): diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 24abefb907..8f0e3e40f5 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -22,7 +22,7 @@ import re import unicodedata import sys, os -from parser_tools import find_token, find_end_of, find_tokens +from parser_tools import find_token, find_end_of, find_tokens, get_value #################################################################### # Private helper functions @@ -480,6 +480,34 @@ def revert_inset_info(document): document.body[i : (j + 1)] = [type + ':' + arg] +def convert_pdf_options(document): + # Set the pdfusetitle tag, delete the pdf_store_options, + # set quotes for bookmarksopenlevel" + has_hr = get_value(document.header, "\\use_hyperref", 0, default = "0") + if has_hr == "1": + k = find_token(document.header, "\\use_hyperref", 0) + document.header.insert(k + 1, "\\pdf_pdfusetitle true") + k = find_token(document.header, "\\pdf_store_options", 0) + if k != -1: + del document.header[k] + i = find_token(document.header, "\\pdf_bookmarksopenlevel", k) + if i == -1: return + document.header[i] = document.header[i].replace('"', '') + + +def revert_pdf_options(document): + # reset the pdfusetitle tag, set quotes for bookmarksopenlevel" + k = find_token(document.header, "\\use_hyperref", 0) + i = find_token(document.header, "\\pdf_pdfusetitle", k) + if i != -1: + del document.header[i] + i = find_token(document.header, "\\pdf_bookmarksopenlevel", k) + if i == -1: return + values = document.header[i].split() + values[1] = ' "' + values[1] + '"' + document.header[i] = ''.join(values) + + ## # Conversion hub # @@ -501,10 +529,12 @@ convert = [[277, [fix_wrong_tables]], [290, []], [291, []], [292, []], - [293, []] + [293, []], + [294, [convert_pdf_options]] ] -revert = [[292, [revert_inset_info]], +revert = [[293, [revert_pdf_options]], + [292, [revert_inset_info]], [291, [revert_japanese, revert_japanese_encoding]], [290, [revert_vietnamese]], [289, [revert_wraptable]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 3037e5864a..03ddffaa84 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -154,7 +154,7 @@ namespace fs = boost::filesystem; namespace { -int const LYX_FORMAT = 293; +int const LYX_FORMAT = 294; //pavel pdfoptions } // namespace anon diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp index 8abb0d9898..fdc2ff7cdb 100644 --- a/src/PDFOptions.cpp +++ b/src/PDFOptions.cpp @@ -188,8 +188,6 @@ string PDFOptions::readToken(Lexer &lex, string const & token) lex >> pagemode; } else if (token == "\\pdf_quoted_options") { lex >> quoted_options; - } else if (token == "\\pdf_store_options") { - //leftover from previous option; intended for later removal } else { return token; }