DocBook: add the MathML-namespace prefix in the GUI.

This commit is contained in:
Thibaut Cuvelier 2021-03-23 00:32:36 +01:00
parent 0f782b0ded
commit 6a5288e31e
5 changed files with 74 additions and 2 deletions

View File

@ -478,6 +478,7 @@ BufferParams::BufferParams()
html_math_img_scale = 1.0; html_math_img_scale = 1.0;
html_css_as_file = false; html_css_as_file = false;
docbook_table_output = HTMLTable; docbook_table_output = HTMLTable;
docbook_mathml_prefix = MPrefix;
display_pixel_ratio = 1.0; display_pixel_ratio = 1.0;
shell_escape = false; shell_escape = false;
@ -1191,6 +1192,10 @@ string BufferParams::readToken(Lexer & lex, string const & token,
int temp; int temp;
lex >> temp; lex >> temp;
docbook_table_output = static_cast<TableOutput>(temp); docbook_table_output = static_cast<TableOutput>(temp);
} else if (token == "\\docbook_mathml_prefix") {
int temp;
lex >> temp;
docbook_mathml_prefix = static_cast<MathMLNameSpacePrefix>(temp);
} else if (token == "\\output_sync") { } else if (token == "\\output_sync") {
lex >> output_sync; lex >> output_sync;
} else if (token == "\\output_sync_macro") { } else if (token == "\\output_sync_macro") {
@ -1555,6 +1560,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
<< "\\html_be_strict " << convert<string>(html_be_strict) << '\n'; << "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
os << "\\docbook_table_output " << docbook_table_output << '\n'; os << "\\docbook_table_output " << docbook_table_output << '\n';
os << "\\docbook_mathml_prefix " << docbook_mathml_prefix << '\n';
if (html_math_img_scale != 1.0) if (html_math_img_scale != 1.0)
os << "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n'; os << "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n';

View File

@ -3778,10 +3778,15 @@ void GuiDocument::applyView()
int tablefmt = outputModule->tableoutCB->currentIndex(); int tablefmt = outputModule->tableoutCB->currentIndex();
if (tablefmt == -1) if (tablefmt == -1)
tablefmt = 0; tablefmt = 0;
BufferParams::TableOutput const to = auto const to = static_cast<BufferParams::TableOutput>(tablefmt);
static_cast<BufferParams::TableOutput>(tablefmt);
bp_.docbook_table_output = to; bp_.docbook_table_output = to;
int mathmlprefix = outputModule->mathmlprefixCB->currentIndex();
if (mathmlprefix == -1)
mathmlprefix = 0;
auto const mp = static_cast<BufferParams::MathMLNameSpacePrefix>(mathmlprefix);
bp_.docbook_mathml_prefix = mp;
bp_.save_transient_properties = bp_.save_transient_properties =
outputModule->saveTransientPropertiesCB->isChecked(); outputModule->saveTransientPropertiesCB->isChecked();
bp_.postpone_fragile_content = bp_.postpone_fragile_content =
@ -4422,6 +4427,7 @@ void GuiDocument::paramsToDialog()
outputModule->cssCB->setChecked(bp_.html_css_as_file); outputModule->cssCB->setChecked(bp_.html_css_as_file);
outputModule->tableoutCB->setCurrentIndex(bp_.docbook_table_output); outputModule->tableoutCB->setCurrentIndex(bp_.docbook_table_output);
outputModule->mathmlprefixCB->setCurrentIndex(bp_.docbook_mathml_prefix);
outputModule->saveTransientPropertiesCB outputModule->saveTransientPropertiesCB
->setChecked(bp_.save_transient_properties); ->setChecked(bp_.save_transient_properties);

View File

@ -75,6 +75,63 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="mathmlprefixLA">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>&amp;MathML namespace prefix:</string>
</property>
<property name="buddy">
<cstring>mathmlprefixCB</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mathmlprefixCB">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>Namespace prefix to use for MathML formulae.</string>
</property>
<item>
<property name="text">
<string>No prefix (namespace defined inline for each tag)</string>
</property>
</item>
<item>
<property name="text">
<string>m (default)</string>
</property>
</item>
<item>
<property name="text">
<string>mml</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -554,6 +554,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
h_html_css_as_file = "0"; h_html_css_as_file = "0";
h_html_math_output = "0"; h_html_math_output = "0";
h_docbook_table_output = "0"; h_docbook_table_output = "0";
h_docbook_mathml_prefix = "1";
h_index[0] = "Index"; h_index[0] = "Index";
h_index_command = "default"; h_index_command = "default";
h_inputencoding = "auto-legacy"; h_inputencoding = "auto-legacy";
@ -2129,6 +2130,7 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
<< "\\html_css_as_file " << h_html_css_as_file << "\n" << "\\html_css_as_file " << h_html_css_as_file << "\n"
<< "\\html_be_strict " << h_html_be_strict << "\n" << "\\html_be_strict " << h_html_be_strict << "\n"
<< "\\docbook_table_output " << h_docbook_table_output << "\n" << "\\docbook_table_output " << h_docbook_table_output << "\n"
<< "\\docbook_mathml_prefix " << h_docbook_mathml_prefix << "\n"
<< authors_ << authors_
<< "\\end_header\n\n" << "\\end_header\n\n"
<< "\\begin_body\n"; << "\\begin_body\n";

View File

@ -193,6 +193,7 @@ private:
std::string h_html_css_as_file; std::string h_html_css_as_file;
std::string h_html_math_output; std::string h_html_math_output;
std::string h_docbook_table_output; std::string h_docbook_table_output;
std::string h_docbook_mathml_prefix;
std::string h_index[99]; std::string h_index[99];
std::string h_index_command; std::string h_index_command;
std::string h_inputencoding; std::string h_inputencoding;