From 1e8f537481acd03816cb8b1c44daf05de0b52b43 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Wed, 11 Jul 2012 11:35:12 -0400 Subject: [PATCH] Math output flavor was not set when viewing source code. Cherry-picked from e7877f6fee86012b84af15c25776fc22d639f36c. --- src/Buffer.cpp | 36 ++++++++++++++++++++++-------------- src/Buffer.h | 2 ++ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 0b4679d85c..ec525f7f71 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -3224,6 +3224,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 if (runparams.flavor == OutputParams::TEXT) { bool dummy; @@ -3605,20 +3606,7 @@ bool Buffer::doExport(string const & format, 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)); @@ -3758,6 +3746,26 @@ bool Buffer::doExport(string const & format, 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; + } +} + + + bool Buffer::preview(string const & format, bool includeall) const { MarkAsExporting exporting(this); diff --git a/src/Buffer.h b/src/Buffer.h index 8a2de9e2b0..410cb978a7 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -676,6 +676,8 @@ public: int charCount(bool with_blanks) const; private: + /// + void setMathFlavor(OutputParams & op) const; /// Change name of buffer. Updates "read-only" flag. void setFileName(support::FileName const & fname); /// -- 2.39.5