Give ourselves a little more flexibility about math output under XHTML.

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
This commit is contained in:
Richard Heck 2010-03-18 20:35:08 +00:00
parent 1e67084666
commit d8a1720d56
5 changed files with 53 additions and 9 deletions

View 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

View 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]],

View 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;

View 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;

View 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;