From e7877f6fee86012b84af15c25776fc22d639f36c Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 6 Dec 2011 22:17:06 +0000 Subject: [PATCH] Math output flavor was not set when viewing source code. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40406 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 35 +++++++++++++++++++++-------------- src/Buffer.h | 2 ++ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 1744cf0e51..90285ec78a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -3258,6 +3258,7 @@ void Buffer::getSourceCode(odocstream & os, string const format, docbookParagraphs(text(), *this, os, runparams); else if (runparams.flavor == OutputParams::HTML) { XHTMLStream xs(os); + setMathFlavor(runparams); xhtmlParagraphs(text(), *this, xs, runparams); } else { // latex or literate @@ -3576,6 +3577,25 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir } +void Buffer::setMathFlavor(OutputParams & op) const +{ + switch (params().html_math_output) { + case BufferParams::MathML: + op.math_flavor = OutputParams::MathAsMathML; + break; + case BufferParams::HTML: + op.math_flavor = OutputParams::MathAsHTML; + break; + case BufferParams::Images: + op.math_flavor = OutputParams::MathAsImages; + break; + case BufferParams::LaTeX: + op.math_flavor = OutputParams::MathAsLaTeX; + break; + } +} + + Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir, bool includeall, string & result_file) const { @@ -3650,20 +3670,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir // HTML backend else if (backend_format == "xhtml") { runparams.flavor = OutputParams::HTML; - switch (params().html_math_output) { - case BufferParams::MathML: - runparams.math_flavor = OutputParams::MathAsMathML; - break; - case BufferParams::HTML: - runparams.math_flavor = OutputParams::MathAsHTML; - break; - case BufferParams::Images: - runparams.math_flavor = OutputParams::MathAsImages; - break; - case BufferParams::LaTeX: - runparams.math_flavor = OutputParams::MathAsLaTeX; - break; - } + setMathFlavor(runparams); makeLyXHTMLFile(FileName(filename), runparams); } else if (backend_format == "lyx") writeFile(FileName(filename)); diff --git a/src/Buffer.h b/src/Buffer.h index f8bd784fce..9a2d4844ad 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -645,6 +645,8 @@ private: bool includeall) const; /// ExportStatus preview(std::string const & format, bool includeall = false) const; + /// + void setMathFlavor(OutputParams & op) const; public: ///