]> git.lyx.org Git - features.git/commitdiff
Math output flavor was not set when viewing source code.
authorRichard Heck <rgheck@lyx.org>
Wed, 11 Jul 2012 15:35:12 +0000 (11:35 -0400)
committerRichard Heck <rgheck@lyx.org>
Wed, 11 Jul 2012 15:35:12 +0000 (11:35 -0400)
Cherry-picked from e7877f6fee86012b84af15c25776fc22d639f36c.

src/Buffer.cpp
src/Buffer.h

index 0b4679d85c8b7ad59e0cf6ac4841734946308c04..ec525f7f71c0dbb56baf2872313710e84292afaf 100644 (file)
@@ -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);
index 8a2de9e2b03bff02918b3d6e8d65d1c1da634a78..410cb978a72a86d7aee683981ec89e6bc92241a6 100644 (file)
@@ -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);
        ///