> On Thursday 11 October 2007 11:35:26 Pavel Sanda wrote: > > no, they are not related. added & discarded unconditionally. > > > > pavel > > Something like this?
i changed few things. still i'm not able to make document.header[i].replace('"', '') work. have you some idea whats wrong? in the attached is current status of my branch. also dont understand why downgrade_pdf_options is connected to 292 in hub. pavel
Index: development/FORMAT =================================================================== --- development/FORMAT (revision 20902) +++ development/FORMAT (working copy) @@ -1,6 +1,10 @@ LyX file-format changes ----------------------- +2007-09-21 Pavel Sanda <[EMAIL PROTECTED]> + * Format incremented to 293: PDFOptions: add usetitle, + fix leftovers + 2007-10-09 Uwe StĂśhr Uwe StĂśhr <[EMAIL PROTECTED]> * Format incremented to 292: Support for Japanese without using CJK and inputenc. (japanese-plain) Index: src/PDFOptions.cpp =================================================================== --- src/PDFOptions.cpp (revision 20902) +++ src/PDFOptions.cpp (working copy) @@ -70,7 +70,7 @@ os << "\\pdf_bookmarks " << convert<string>(bookmarks) << '\n'; os << "\\pdf_bookmarksnumbered " << convert<string>(bookmarksnumbered) << '\n'; os << "\\pdf_bookmarksopen " << convert<string>(bookmarksopen) << '\n'; - os << "\\pdf_bookmarksopenlevel \"" << bookmarksopenlevel << "\"\n"; + os << "\\pdf_bookmarksopenlevel " << bookmarksopenlevel << '\n'; os << "\\pdf_breaklinks " << convert<string>(breaklinks) << '\n'; os << "\\pdf_pdfborder " << convert<string>(pdfborder) << '\n'; @@ -188,8 +188,6 @@ 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; } Index: src/Buffer.cpp =================================================================== --- src/Buffer.cpp (revision 20902) +++ src/Buffer.cpp (working copy) @@ -154,7 +154,7 @@ namespace { -int const LYX_FORMAT = 292; //Uwe Stöhr, Japanese +int const LYX_FORMAT = 293; //ps, pdfoptions } // namespace anon Index: lib/lyx2lyx/LyX.py =================================================================== --- lib/lyx2lyx/LyX.py (revision 20902) +++ lib/lyx2lyx/LyX.py (working copy) @@ -80,7 +80,7 @@ ("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,293), minor_versions("1.6" , 0))] # Uwe StĂśhr, Japanese + ("1_6", range(277,294), minor_versions("1.6" , 0))] # Pavel Sanda def formats_list(): Index: lib/lyx2lyx/lyx_1_6.py =================================================================== --- lib/lyx2lyx/lyx_1_6.py (revision 20902) +++ lib/lyx2lyx/lyx_1_6.py (working copy) @@ -455,6 +455,35 @@ document.header[k] = "\\inputencoding UTF8" +def upgrade_pdf_options(document): + k = find_token(document.header, "\\use_hyperref", 0) + if k == -1: return + document.header.insert(k + 1, "\\pdf_pdfusetitle true") + + i = find_token(document.header, "\\pdf_store_options", k) + if i != -1: + del document.header[i] + + i = find_token(document.header, "\\pdf_bookmarksopenlevel", k) + if i == -1: return + document.header[i].replace('"', '') + + +def downgrade_pdf_options(document): + 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 # @@ -475,10 +504,12 @@ [289, [convert_latexcommand_index]], [290, []], [291, []], - [292, []] + [292, []], + [293, [upgrade_pdf_options]] ] -revert = [[291, [revert_japanese, revert_japanese_encoding]], +revert = [[292, [downgrade_pdf_options]], + [291, [revert_japanese, revert_japanese_encoding]], [290, [revert_vietnamese]], [289, [revert_wraptable]], [288, [revert_latexcommand_index]],