]> git.lyx.org Git - lyx.git/commitdiff
Give ourselves a little more flexibility about math output under XHTML.
authorRichard Heck <rgheck@comcast.net>
Thu, 18 Mar 2010 20:35:08 +0000 (20:35 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 18 Mar 2010 20:35:08 +0000 (20:35 +0000)
I think it will be worth implementing a version of pure HTML output, for
some uses, a la eLyXer.

Note that at present none of this does anything, and there is no UI to
set it. I just want to make sure it's in the file format, in case I do
not get to this before 2.0.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33794 a592a061-630c-0410-9148-cb99ea01b6c8

development/FORMAT
lib/lyx2lyx/lyx_2_0.py
src/Buffer.cpp
src/BufferParams.cpp
src/BufferParams.h

index e7c3fbd6ee640f2c017a3b9a7c4406c536a6aae0..8ebcf5de22ca9879e855a76a5a5991634d319ea3 100644 (file)
@@ -1,6 +1,11 @@
 LyX file-format changes
 -----------------------
 
+2010-03-18: Richard Heck <rgheck@comcast.net>
+  * Format incremented to 379: revise format 374
+         Replace boolean \html_use_mathml with \html_math_output,
+               which at the moment can be: MathML, HTML, or Images.
+
 2010-02-12 Pavel Sanda <sanda@lyx.org>
        * Format incremented to 378: support for revision InsetInfo.
          Various "vcs-*" strings could be argument of arg parameter
index 8ad26ef9388cee2f864d563358fbdcd9607841a1..64250f31093aedbb7e0534136fc7476b1b4e7909 100644 (file)
@@ -1205,6 +1205,36 @@ def revert_multirow(document):
         add_to_preamble(document, ["\\usepackage{multirow}"])
 
 
+def convert_math_output(document):
+    " Convert \html_use_mathml to \html_math_output "
+    i = find_token(document.header, "\\html_use_mathml", 0)
+    if i == -1:
+        return
+    rgx = re.compile(r'\\html_use_mathml\s+(\w+)')
+    m = rgx.match(document.header[i])
+    if rgx:
+        newval = "MathML"
+        val = m.group(1)
+        if val != "true":
+            newval = "Images"
+        document.header[i] = "\\html_math_output " + newval
+
+
+def revert_math_output(document):
+    " Revert \html_math_output to \html_use_mathml "
+    i = find_token(document.header, "\\html_math_output", 0)
+    if i == -1:
+        return
+    rgx = re.compile(r'\\html_math_output\s+(\w+)')
+    m = rgx.match(document.header[i])
+    if rgx:
+        newval = "false"
+        val = m.group(1)
+        if val != "MathML":
+            newval = "true"
+        document.header[i] = "\\html_use_mathml " + newval
+                
+
 ##
 # Conversion hub
 #
@@ -1242,10 +1272,12 @@ convert = [[346, []],
            [375, []],
            [376, []],
            [377, []],
-           [378, []]
+           [378, []],
+           [379, [convert_math_output]]
           ]
 
-revert =  [[377, []],
+revert =  [[378, [revert_math_output]],
+           [377, []],
            [376, [revert_multirow]],
            [375, [revert_includeall]],
            [374, [revert_includeonly]],
index 1da4d9912a64269bf6c775f2d0f97696540ac15f..cdea9e6496fc417e2a3591529c58ef9826a06b37 100644 (file)
@@ -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 = 378; // ps: rev insetinfo
+int const LYX_FORMAT = 379; // rgh: xhtml math output type
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
index 9a64ec6cf5e6a859de99c7e8eddcb7056eaab53b..37fba33142e96898a0021c1cc9bc0463028287b2 100644 (file)
@@ -377,7 +377,7 @@ BufferParams::BufferParams()
        // default index
        indiceslist().addDefault(B_("Index"));
        html_be_strict = true;
-       html_use_mathml = true;
+       html_math_output = MathML;
 }
 
 
@@ -775,8 +775,10 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                                toktmp << endl;
                        return toktmp;
                }
-       } else if (token == "\\html_use_mathml") {
-               lex >> html_use_mathml;
+       } else if (token == "\\html_math_output") {
+               int temp;
+               lex >> temp;
+               html_math_output = static_cast<MathOutput>(temp);
        } else if (token == "\\html_be_strict") {
                lex >> html_be_strict;
        } else {
@@ -992,7 +994,7 @@ void BufferParams::writeFile(ostream & os) const
 
        os << "\\tracking_changes " << convert<string>(trackChanges) << "\n"
           << "\\output_changes " << convert<string>(outputChanges) << "\n"
-          << "\\html_use_mathml " << convert<string>(html_use_mathml) << "\n"
+          << "\\html_math_output " << html_math_output << "\n"
           << "\\html_be_strict " << convert<string>(html_be_strict) << "\n";
 
        os << pimpl_->authorlist;
index 5055790ab351b790a1d36499739bbb81d7854124..cbd1d70d4a1133aa64bff86f3a31cf845ae4231f 100644 (file)
@@ -375,8 +375,13 @@ public:
        PDFOptions & pdfoptions();
        PDFOptions const & pdfoptions() const;
 
-       /// whether to use MathML for math output, or instead images
-       bool html_use_mathml;
+       enum MathOutput {
+               MathML,
+               HTML,
+               Images          
+       };
+       /// what to use for math output. present choices are above
+       MathOutput html_math_output;
        /// whether to attempt to be XHTML 1.1 compliant or instead be
        /// a little more mellow
        bool html_be_strict;