Error noticed by Coverity:
*** CID 382777: Memory - illegal accesses (RETURN_LOCAL)
/home/lasgoutt/src/lyx/coverity/lyx/src/insets/InsetIndex.cpp: 1866 in _ZNK3lyx15InsetPrintIndex5xhtmlB5cxx11ERNS_9XMLStreamERKNS_12OutputParamsE()
1860
1861 // Collect the index entries in a form we can use them.
1862 vector<IndexEntry> entries;
1863 const docstring & indexType = params().getParamOr("type", from_ascii("idx"));
1864 for (const TocItem& item : *toc) {
1865 const auto* inset = static_cast<const InsetIndex*>(&(item.dit().inset()));
>>> CID 382777: Memory - illegal accesses (RETURN_LOCAL)
>>> Using "indexType", which points to an out-of-scope temporary variable of type "lyx::docstring const".
1866 if (item.isOutput() && inset->params().index == indexType)
1867 entries.emplace_back(IndexEntry{inset, &op});
1868 }
1869
1870 // If all the index entries are in notes or not displayed, get out sooner.
1871 if (entries.empty())
ATM, the validation is commented out.
To use it, one has first to install html5validator with
$ pip3 install html5validator>=0.4.2
and uncomment the line 335 in export.cmake
Rationales:
- previously, <mstyle> was used, but it's being deprecated for MathML 4 Core in favour of CSS and <mrow> (not a big deal in itself)
- the whole box cannot be hosted within the same tag, because neither <mstyle> nor <mrow> can have text, they need an intermediate container, <mtext> (which cannot hold anything else that pure text)
- new behaviour: always output a container for the whole box that has the right attributes, i.e. an <mrow>; split the content of the cell to have text and other tags set apart (text in <mtext>, other tags left as they were)
Old behaviour, invalid MathML (2 to 4):
<mstyle XXX>text<mn>.</mn></mstyle>
New behaviour, valid MathML:
<mrow XXX><mtext>text</mtext><mn>.</mn></mrow>
The inset represents text (as opposed to maths in formulae). <m:mstyle> is used to give style to its children, it is not supposed to have any contents on its own.
With the current settings, a theorem with several paragraphs will have several wrapper tags (i.e. two `<db:figure>`, with one paragraph each, one next to the other when it's the same theorem), while there should be only one (one `<db:figure>` with two paragraphs).
It makes me wonder whether DocBookWrapperMergeWithPrevious should be the default value. I don't see a case where it would be set to `false` with a wrapper tag, but the test suite isn't developed enough to make the change with peace of mind (i.e. remove the parameter `DocBookWrapperMergeWithPrevious` and consider it is always `true` in the code).
For the record, the current code also works with two subsequent theorems with two paragraphs each (see new test case).
Instead of asserting when there are unprocessed row elements (which,
as I understand it, should almost never happen), play safe and keep
them for later processing.
Related to bug #12617.
- present appropriate alert message in case of missing Python
- add the option to quit LyX immediately
- recheck for Python interpreter on reconfigure if it was missing
A test from a recent file, KOMA-Script_Book.lyx, uncovered this
issue. It is an old routine so not critical to fix.
The following is the diff that prevents convergence:
\begin_inset Newpage cleardoublepage
\end_inset
\end_layout
\begin_layout Standard
If convert_bibtex_clearpage(document) in lyx_2_0.py is commented out, then
the test passes.
Replace \bf with \bfseries.
The error was as follows:
! Class scrbook Error: undefined old font command `\bf'.
This change is consistent with 3cecd4d3.
After this change (and the previous commits), the ctests for
Additional.lyx pass again.
The argument must specify "origin=...". Although that is confusing
(because the argument's name is "origin" so it might be expected
that this is done automatically), this is consistent with the use of
rotate box in our Embedded Objects manual.
After editing with the external sed command in the previous commit,
now resave with the LyX binary. This eliminates unnecessary language
switches (e.g., no need to switch from "English" to "English" now
that the intermediate switch to "British" is gone).
Use the following command to automate the process:
sed -i "/^\\\lang \(american\|british\)$/d" Additional.lyx
The next commit will just resave the file with LyX, so as to clean
up the file contents after the external command from this commit.