From 5678dc566f8873b489c66ffa5772a74c387a6396 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Wed, 21 Apr 2010 15:18:25 +0000 Subject: [PATCH] New XHTML math options. Format change. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34250 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 5 +++++ lib/lyx2lyx/lyx_2_0.py | 22 +++++++++++++++++++--- src/Buffer.cpp | 2 +- src/BufferParams.cpp | 22 +++++++++++++++++----- src/BufferParams.h | 6 ++++++ 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index f5ce5356ab..03d82413cb 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,11 @@ The good example would be 2010-01-10 entry. ----------------------- +2010-04-21 Richard heck + * Format incremented to 387: New options for XHTML math output. + New BufferParams: html_math_img_scale, html_latex_start, + html_latex_end. + 2010-04-17 Richard heck * Format incremented to 386: LyX version for InsetInfo: new parameters: type "lyxinfo", arg "version". diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 71489a1144..57d0a1319b 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1512,6 +1512,20 @@ def revert_lyx_version(document): i = i+1 +def revert_math_scale(document): + " Remove math scaling and LaTeX options " + i = find_token(document.header, '\\html_math_img_scale', 0) + if i != -1: + del document.header[i] + i = find_token(document.header, '\\html_latex_start', 0) + if i != -1: + del document.header[i] + i = find_token(document.header, '\\html_latex_end', 0) + if i != -1: + del document.header[i] + + + ## # Conversion hub # @@ -1557,10 +1571,12 @@ convert = [[346, []], [383, []], [384, []], [385, []], - [386, []] - ] + [386, []], + [387, []], + ] -revert = [[385, [revert_lyx_version]], +revert = [[386, [revert_math_scale]], + [385, [revert_lyx_version]], [384, [revert_shadedboxcolor]], [383, [revert_fontcolor]], [382, [revert_turkmen]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 338757254d..53f331a920 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 = 386; // rgh: LyX version for InsetInfo +int const LYX_FORMAT = 387; // rgh: XHTML math options typedef map DepClean; typedef map > RefCache; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index a51b4a93f9..95f82a5464 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -383,8 +383,11 @@ BufferParams::BufferParams() } // default index indiceslist().addDefault(B_("Index")); - html_be_strict = true; + html_be_strict = false; html_math_output = MathML; + html_math_img_scale = 1.0; + html_latex_start = ""; + html_latex_end = ""; } @@ -807,6 +810,12 @@ string BufferParams::readToken(Lexer & lex, string const & token, html_math_output = static_cast(temp); } else if (token == "\\html_be_strict") { lex >> html_be_strict; + } else if (token == "\\html_math_img_scale") { + lex >> html_math_img_scale; + } else if (token == "\\html_latex_start") { + lex >> html_latex_start; + } else if (token == "\\html_latex_end") { + lex >> html_latex_end; } else { lyxerr << "BufferParams::readToken(): Unknown token: " << token << endl; @@ -1024,10 +1033,13 @@ void BufferParams::writeFile(ostream & os) const } } - os << "\\tracking_changes " << convert(trackChanges) << "\n" - << "\\output_changes " << convert(outputChanges) << "\n" - << "\\html_math_output " << html_math_output << "\n" - << "\\html_be_strict " << convert(html_be_strict) << "\n"; + os << "\\tracking_changes " << convert(trackChanges) << '\n' + << "\\output_changes " << convert(outputChanges) << '\n' + << "\\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"; os << pimpl_->authorlist; } diff --git a/src/BufferParams.h b/src/BufferParams.h index 1e8174d12c..a4143a0c7e 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -393,6 +393,12 @@ public: /// whether to attempt to be XHTML 1.1 compliant or instead be /// a little more mellow bool html_be_strict; + /// + double html_math_img_scale; + /// + std::string html_latex_start; + /// + std::string html_latex_end; private: /// -- 2.39.2