From b174e5616e4263024e6717705b463c31b5640e47 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 24 May 2010 19:34:43 +0000 Subject: [PATCH] Simplify storage of html_latex_* info. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34491 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 3 +++ lib/lyx2lyx/lyx_2_0.py | 43 ++++++++++++++++++++++++++++++++++++++++-- src/Buffer.cpp | 2 +- src/BufferParams.cpp | 10 ++++++---- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 6687c54087..9bd34626aa 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,9 @@ The good example would be 2010-01-10 entry. ----------------------- +2010-05-24 Richard Heck + * Format incremented to 389: remove quotes from html_latex_* params. + 2010-05-18 Uwe Stöhr * Format incremented to 388: support for page sizes A0-3, A6, B0-3, B6 and JIS B0-6 diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 5a124b3d71..bf62cbf599 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1540,6 +1540,43 @@ def revert_pagesizes(document): del document.header[i] +def convert_html_quotes(document): + " Remove quotes around html_latex_start and html_latex_end " + + i = find_token(document.header, '\\html_latex_start', 0) + if i != -1: + line = document.header[i] + l = re.compile(r'\\html_latex_start\s+"(.*)"') + m = l.match(line) + if m != None: + document.header[i] = "\\html_latex_start " + m.group(1) + + i = find_token(document.header, '\\html_latex_end', 0) + if i != -1: + line = document.header[i] + l = re.compile(r'\\html_latex_end\s+"(.*)"') + m = l.match(line) + if m != None: + document.header[i] = "\\html_latex_end " + m.group(1) + + +def revert_html_quotes(document): + " Remove quotes around html_latex_start and html_latex_end " + + i = find_token(document.header, '\\html_latex_start', 0) + if i != -1: + line = document.header[i] + l = re.compile(r'\\html_latex_start\s+(.*)') + m = l.match(line) + document.header[i] = "\\html_latex_start \"" + m.group(1) + "\"" + + i = find_token(document.header, '\\html_latex_end', 0) + if i != -1: + line = document.header[i] + l = re.compile(r'\\html_latex_end\s+(.*)') + m = l.match(line) + document.header[i] = "\\html_latex_end \"" + m.group(1) + "\"" + ## # Conversion hub # @@ -1588,9 +1625,11 @@ convert = [[346, []], [386, []], [387, []], [388, []], - ] + [389, [convert_html_quotes]] + ] -revert = [[387, [revert_pagesizes]], +revert = [[388, [revert_html_quotes]], + [387, [revert_pagesizes]], [386, [revert_math_scale]], [385, [revert_lyx_version]], [384, [revert_shadedboxcolor]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 96a990e32d..b80a69407a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -126,7 +126,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 388; // uwestoehr: support for more page sizes +int const LYX_FORMAT = 389; // rgh: change how html_latex_* is stored typedef map DepClean; typedef map > RefCache; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 920b6566d7..f809ba4dcd 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -831,9 +831,11 @@ string BufferParams::readToken(Lexer & lex, string const & token, } else if (token == "\\html_math_img_scale") { lex >> html_math_img_scale; } else if (token == "\\html_latex_start") { - lex >> html_latex_start; + lex.eatLine(); + html_latex_start = lex.getString(); } else if (token == "\\html_latex_end") { - lex >> html_latex_end; + lex.eatLine(); + html_latex_end = lex.getString(); } else { lyxerr << "BufferParams::readToken(): Unknown token: " << token << endl; @@ -1056,8 +1058,8 @@ void BufferParams::writeFile(ostream & os) const << "\\html_math_output " << html_math_output << '\n' << "\\html_be_strict " << convert(html_be_strict) << '\n' << "\\html_math_img_scale " << convert(html_math_img_scale) << '\n' - << "\\html_latex_start \"" << html_latex_start << "\"\n" - << "\\html_latex_end \"" << html_latex_end << "\"\n"; + << "\\html_latex_start " << html_latex_start << "\n" + << "\\html_latex_end " << html_latex_end << "\n"; os << pimpl_->authorlist; }