rename buffer parameter math_number_before to math_numbering_side

this is a fileformat change

also try to fix an UI issue that JMarc gets
This commit is contained in:
Uwe Stöhr 2017-05-13 20:39:45 +02:00
parent c592fb58bb
commit 0dd3311dd4
25 changed files with 135 additions and 76 deletions

View File

@ -6,29 +6,34 @@ changes happened in particular if possible. A good example would be
2010-01-10 entry.
-----------------------
2017-05-13 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 543: rename buffer parameter
math_number_before to math_numbering_side
2017-04-25 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 542: support for document class option "leqno"
New buffer parameter \math_number_before
* Format incremented to 542: support for document class option "leqno"
New buffer parameter \math_number_before
2017-04-19 Günter Milde <milde@lyx.org>
* Format incremented to 541: changes \SpecialChar:
* Format incremented to 541: changes \SpecialChar:
- new argument "allowbreak" to mark an optional line break
without inserting a hyphen (= ZWSP). See #10585.
2017-04-15 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 540: support for rotated float placements
- no new LFUN or buffer parameters
* Format incremented to 540: support for rotated float placements
- no new LFUN or buffer parameters
2017-04-08 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 539: support for \baselineskip.
- new length unit BLS
* Format incremented to 539: support for \baselineskip.
- new length unit BLS
2017-04-05 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 538: support for document class option "fleqn"
and for length \mathindent.
New buffer parameters
- \is_math_indent
- \math_indentation
* Format incremented to 538: support for document class option "fleqn"
and for length \mathindent.
New buffer parameters
- \is_math_indent
- \math_indentation
2017-04-04 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 537: support for \xout.
@ -36,7 +41,7 @@ changes happened in particular if possible. A good example would be
LFUN_FONT_CROSSOUT
2017-04-04 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 536: support for Noto fonts.
* Format incremented to 536: support for Noto fonts.
- \usepackage[rm]{noto} > \font_roman "NotoSerif-TLF" "<nontexfont>"
- \usepackage[sf]{noto} > \font_sans "NotoSans-TLF" "<nontexfont>"
- \renewcommand{\ttdefault}{NotoMono-TLF}

View File

@ -2142,7 +2142,7 @@ def revert_allowbreak(document):
def convert_mathnumberpos(document):
" add the \math_number_before tag "
" add the \\math_number_before tag "
# check if the document uses the class option "leqno"
k = find_token(document.header, "\\quotes_style", 0)
regexp = re.compile(r'^.*leqno.*')
@ -2155,7 +2155,7 @@ def convert_mathnumberpos(document):
document.header[i] = document.header[i].replace("leqno,", "")
j = find_re(document.header, regexp, 0)
if i == j:
# then we have fleqn as the only option
# then we have leqno as the only option
del document.header[i]
else:
document.header.insert(k, "\\math_number_before 0")
@ -2180,6 +2180,58 @@ def revert_mathnumberpos(document):
del document.header[i + 1]
def convert_mathnumberingname(document):
" rename the \\math_number_before tag to \\math_numbering_side "
document.warning("Malformed LyX document: Missing '\\end_inset' of Float inset.")
regexp = re.compile(r'(\\math_number_before 1)')
i = find_re(document.header, regexp, 0)
if i != -1:
document.header[i] = "\\math_numbering_side left"
regexp = re.compile(r'(\\math_number_before 0)')
i = find_re(document.header, regexp, 0)
if i != -1:
document.header[i] = "\\math_numbering_side default"
# check if the document uses the class option "reqno"
k = find_token(document.header, "\\math_numbering_side", 0)
regexp = re.compile(r'^.*reqno.*')
i = find_re(document.header, regexp, 0)
if i != -1:
document.header[k] = "\\math_numbering_side right"
# delete the found option
document.header[i] = document.header[i].replace(",reqno", "")
document.header[i] = document.header[i].replace(", reqno", "")
document.header[i] = document.header[i].replace("reqno,", "")
j = find_re(document.header, regexp, 0)
if i == j:
# then we have reqno as the only option
del document.header[i]
def revert_mathnumberingname(document):
" rename the \\math_numbering_side tag back to \\math_number_before "
# just rename
regexp = re.compile(r'(\\math_numbering_side left)')
i = find_re(document.header, regexp, 0)
if i != -1:
document.header[i] = "\\math_number_before 1"
# add the option reqno and delete the tag
regexp = re.compile(r'(\\math_numbering_side right)')
i = find_re(document.header, regexp, 0)
if i != -1:
document.header[i] = "\\math_number_before 0"
k = find_token(document.header, "\\options", 0)
if k != -1:
document.header[k] = document.header[k].replace("\\options", "\\options reqno,")
else:
l = find_token(document.header, "\\use_default_options", 0)
document.header.insert(l, "\\options reqno")
# add the math_number_before tag
regexp = re.compile(r'(\\math_numbering_side default)')
i = find_re(document.header, regexp, 0)
if i != -1:
document.header[i] = "\\math_number_before 0"
##
# Conversion hub
#
@ -2219,10 +2271,12 @@ convert = [
[539, []],
[540, []],
[541, [convert_allowbreak]],
[542, [convert_mathnumberpos]]
[542, [convert_mathnumberpos]],
[543, [convert_mathnumberingname]]
]
revert = [
[542, [revert_mathnumberingname]],
[541, [revert_mathnumberpos]],
[540, [revert_allowbreak]],
[539, [revert_rotfloat]],

View File

@ -385,7 +385,7 @@ BufferParams::BufferParams()
makeDocumentClass();
paragraph_separation = ParagraphIndentSeparation;
is_math_indent = false;
math_number = DEFAULT;
math_numbering_side = DEFAULT;
quotes_style = InsetQuotesParams::EnglishQuotes;
dynamic_quotes = false;
fontsize = "default";
@ -669,8 +669,8 @@ void BufferParams::setDefSkip(VSpace const & vs)
BufferParams::MathNumber BufferParams::getMathNumber() const
{
if (math_number != DEFAULT)
return math_number;
if (math_numbering_side != DEFAULT)
return math_numbering_side;
// FIXME: do not hardcode language here
else if (language->lang() == "arabic_arabi"
|| documentClass().provides("leqno"))
@ -866,15 +866,15 @@ string BufferParams::readToken(Lexer & lex, string const & token,
} else if (token == "\\math_indentation") {
lex.next();
pimpl_->mathindent = Length(lex.getString());
} else if (token == "\\math_number_before") {
} else if (token == "\\math_numbering_side") {
string tmp;
lex >> tmp;
if (tmp == "true")
math_number = LEFT;
else if (tmp == "false")
math_number = RIGHT;
if (tmp == "left")
math_numbering_side = LEFT;
else if (tmp == "right")
math_numbering_side = RIGHT;
else
math_number = DEFAULT;
math_numbering_side = DEFAULT;
} else if (token == "\\quotes_style") {
string qstyle;
lex >> qstyle;
@ -1375,13 +1375,13 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
os << "\n\\is_math_indent " << is_math_indent;
if (is_math_indent && !getMathIndent().empty())
os << "\n\\math_indentation " << getMathIndent().asString();
os << "\n\\math_number_before ";
switch(math_number) {
os << "\n\\math_numbering_side ";
switch(math_numbering_side) {
case LEFT:
os << "true";
os << "left";
break;
case RIGHT:
os << "false";
os << "right";
break;
case DEFAULT:
os << "default";
@ -1670,7 +1670,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
if (is_math_indent)
clsoptions << "fleqn,";
switch(math_number) {
switch(math_numbering_side) {
case LEFT:
clsoptions << "leqno,";
break;

View File

@ -112,7 +112,7 @@ public:
enum MathNumber { DEFAULT, LEFT, RIGHT };
/// number formulas on left/right/default
MathNumber math_number;
MathNumber math_numbering_side;
/// Convenience function for display: like math_number, but
/// DEFAULT is replaced by the best guess we have.

View File

@ -2943,17 +2943,17 @@ void GuiDocument::applyView()
}
switch (mathsModule->MathNumberingPosCO->currentIndex()) {
case 0:
bp_.math_number = BufferParams::LEFT;
bp_.math_numbering_side = BufferParams::LEFT;
break;
case 1:
bp_.math_number = BufferParams::DEFAULT;
bp_.math_numbering_side = BufferParams::DEFAULT;
break;
case 2:
bp_.math_number = BufferParams::RIGHT;
bp_.math_numbering_side = BufferParams::RIGHT;
break;
default:
// this should never happen
bp_.math_number = BufferParams::DEFAULT;
bp_.math_numbering_side = BufferParams::DEFAULT;
break;
}
@ -3419,7 +3419,7 @@ void GuiDocument::paramsToDialog()
mathsModule->MathIndentCO->setCurrentIndex(indent);
enableMathIndent(indent);
}
switch(bp_.math_number) {
switch(bp_.math_numbering_side) {
case BufferParams::LEFT:
mathsModule->MathNumberingPosCO->setCurrentIndex(0);
break;

View File

@ -126,7 +126,7 @@
<item row="4" column="0">
<widget class="QLabel" name="MathNumberingPosL">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>

View File

@ -494,7 +494,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
h_font_tt_scale[1] = "100";
//h_font_cjk
h_is_mathindent = "0";
h_math_number_before = "default";
h_math_numbering_side = "default";
h_graphics = "default";
h_default_output_format = "default";
h_html_be_strict = "false";
@ -1294,7 +1294,7 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
os << "\\is_math_indent " << h_is_mathindent << "\n";
if (!h_mathindentation.empty())
os << "\\math_indentation " << h_mathindentation << "\n";
os << "\\math_number_before " << h_math_number_before << "\n";
os << "\\math_numbering_side " << h_math_numbering_side << "\n";
os << "\\quotes_style " << h_quotes_style << "\n"
<< "\\dynamic_quotes " << h_dynamic_quotes << "\n"
<< "\\papercolumns " << h_papercolumns << "\n"
@ -1692,12 +1692,12 @@ void Preamble::parse(Parser & p, string const & forceclass,
// formula numbering side
if ((it = find(opts.begin(), opts.end(), "leqno"))
!= opts.end()) {
h_math_number_before = "true";
h_math_numbering_side = "left";
opts.erase(it);
}
else if ((it = find(opts.begin(), opts.end(), "reqno"))
!= opts.end()) {
h_math_number_before = "false";
h_math_numbering_side = "right";
opts.erase(it);
}

View File

@ -154,7 +154,7 @@ private:
std::string h_font_cjk;
std::string h_use_microtype;
std::string h_is_mathindent;
std::string h_math_number_before;
std::string h_math_numbering_side;
std::string h_mathindentation;
std::string h_graphics;
std::string h_default_output_format;

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -72,7 +72,7 @@
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -72,7 +72,7 @@
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -78,7 +78,7 @@
\paragraph_separation indent
\paragraph_indentation 3mm
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -78,7 +78,7 @@
\paragraph_separation indent
\paragraph_indentation 3mm
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -71,7 +71,7 @@
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -70,7 +70,7 @@ algorithm2e
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -107,7 +107,7 @@
\paragraph_separation skip
\defskip 3mm
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 2

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -114,7 +114,7 @@
\paragraph_separation indent
\paragraph_indentation 3mm
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -90,7 +90,7 @@
\paragraph_separation indent
\paragraph_indentation 3mm
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -68,7 +68,7 @@
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -68,7 +68,7 @@ theorems-ams
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -68,7 +68,7 @@ theorems-ams
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -65,7 +65,7 @@
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -101,7 +101,7 @@ logicalmkup
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -72,7 +72,7 @@
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 542
\lyxformat 543
\begin_document
\begin_header
\save_transient_properties true
@ -61,7 +61,7 @@
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_number_before 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1

View File

@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 542 // uwestoehr: support for class option leqno
#define LYX_FORMAT_TEX2LYX 542
#define LYX_FORMAT_LYX 543 // uwestoehr: rename math_number_before entry to math_numbering_side
#define LYX_FORMAT_TEX2LYX 543
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER