Commit Graph

45072 Commits

Author SHA1 Message Date
Thibaut Cuvelier
24cda9e94a Amend 2d56c01dcf 2023-01-08 22:51:01 +01:00
Thibaut Cuvelier
2d56c01dcf InsetIndex: make a condition more bullet-proof, a nullptr could be dereferenced.
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())
2023-01-08 22:19:39 +01:00
Thibaut Cuvelier
b42269f065 InsetIndex: remove unused code that created Coverity errors. 2023-01-08 22:17:02 +01:00
Thibaut Cuvelier
6e4cf808da InsetIndex: add a missing destructor for IndexNode and call it from xhtml() to avoid leaking resources.
Corresponding Coverity finding:

** CID 382778:  Resource leaks  (RESOURCE_LEAK)
/home/lasgoutt/src/lyx/coverity/lyx/src/insets/InsetIndex.cpp: 1909 in _ZNK3lyx15InsetPrintIndex5xhtmlB5cxx11ERNS_9XMLStreamERKNS_12OutputParamsE()

________________________________________________________________________________________________________
*** CID 382778:  Resource leaks  (RESOURCE_LEAK)
/home/lasgoutt/src/lyx/coverity/lyx/src/insets/InsetIndex.cpp: 1909 in _ZNK3lyx15InsetPrintIndex5xhtmlB5cxx11ERNS_9XMLStreamERKNS_12OutputParamsE()
1903            }
1904
1905            xs << xml::EndTag("ul");
1906            xs << xml::CR();
1907            xs << xml::EndTag("div");
1908
>>>     CID 382778:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "index_root" going out of scope leaks the storage it points to.
1909            return ods.str();
1910     }
1911
2023-01-08 22:03:36 +01:00
Kornel Benko
a71126904f Cmake export tests. Add validation of lyxhtml exported files
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
2023-01-08 17:18:30 +01:00
Juergen Spitzmueller
2d0941919f Additional.lyx: further fixes #2
More to come!
2023-01-08 15:31:37 +01:00
Juergen Spitzmueller
97112b8e80 Additional.lyx: further fixes
More to come!
2023-01-08 12:14:03 +01:00
Thibaut Cuvelier
e70cdfd3a2 InsetMathBox: split the boxed text into <mtext> and other tags, while boxing the whole inset within an <mrow>.
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>
2023-01-08 02:36:48 +01:00
Thibaut Cuvelier
d3c81eb2cb InsetMathBox: fix strange indentation (mix of spaces and tabs). 2023-01-08 00:51:43 +01:00
Thibaut Cuvelier
4412fdf09a MathML test case: fix a typo.
It was bugging me when looking at XHTML output: I was wondering if LyX was doing anything weird about ligatures! Hopefully not.
2023-01-08 00:50:29 +01:00
Thibaut Cuvelier
edcaad2419 MathML: convert InsetMathBox as <m:mtext>.
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.
2023-01-08 00:50:29 +01:00
Thibaut Cuvelier
0f8951e708 LyXHTML validation tests: explicitly exit the Python script if it fails 2023-01-07 21:27:50 +01:00
jpc
b12875206e Update fr.po 2023-01-07 17:59:59 +01:00
Thibaut Cuvelier
6a3bd64032 LyXHTML: use a lower-case meta for generator, this is the most common convention. 2023-01-07 16:24:57 +01:00
Thibaut Cuvelier
a5c6215ebd LyXHTML: add a missing space in the content-type annotation. 2023-01-07 16:23:56 +01:00
Scott Kostyshak
95dd4f6bf6 updatelayouts.py: skip .txt files 2023-01-07 09:43:47 -05:00
Kornel Benko
093a86270e Update sk.po 2023-01-07 13:38:01 +01:00
Juergen Spitzmueller
6c98a0a6d2 Some minor corrections to the Additional revisions
More might follow.
2023-01-07 13:17:05 +01:00
Thibaut Cuvelier
051c5f2728 LyXHTML: add explicit HTMLTag for titles.
This way, LyX can generate semantic <hX> tags instead of a generic <div>.
2023-01-07 03:59:22 +01:00
Thibaut Cuvelier
fb4a26577e LyXHTML: don't explicitly mention that the style is CSS, HTML5 doesn't like it. 2023-01-07 03:42:11 +01:00
Thibaut Cuvelier
4c1f9d1161 LyXHTML: use a value of font-weight that makes sense instead of a nonexistent medium. 2023-01-07 03:40:27 +01:00
Thibaut Cuvelier
fd2078f3aa LyXHTML: remove the double specification of charset.
The choice of content-type is arbitrary.
2023-01-07 03:36:57 +01:00
Thibaut Cuvelier
cabb12ba51 LyXHTML: fix the content-type attribute, it must be lower case (enforced for HTML5). 2023-01-07 03:33:48 +01:00
Thibaut Cuvelier
26e6b1c209 LyXHTML and DocBook: encode language codes as BCP47. 2023-01-07 03:31:40 +01:00
Thibaut Cuvelier
96023697f5 Amend 16a1aa99
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).
2023-01-07 03:06:44 +01:00
Thibaut Cuvelier
3cf8ced72e Make formatting of DocBook changes more similar to surrounding code.
Spaces between if and condition.
2023-01-07 02:56:40 +01:00
Scott Kostyshak
ec02df2bb9 ctests: uninvert a lyx2lyx test thanks to fix
Thanks to the fix at d89a4848, the roundtrip now converges.

This reverts commit 83c72a3ece.
2023-01-06 14:06:06 -05:00
Jean-Marc Lasgouttes
9dd716da3a Row breaking: keep unused tail for later (instead of assertion)
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.
2023-01-06 16:02:29 +01:00
Jean-Marc Lasgouttes
cb3de88cc4 Fixup dcef1a9c: better handling of front-of-string splitting
When splitting a string leads to a break before the first character, the
best is to declare that splitting failed.

Fixes bug #12617.
2023-01-06 15:56:54 +01:00
Juergen Spitzmueller
d89a48483e Add missing revert routine to lyx_2_0.py 2023-01-06 14:40:25 +01:00
Scott Kostyshak
bee08b19ee Typo in a comment 2023-01-05 23:33:16 -05:00
Stephan Witt
bbc2270972 #12523 check for existence of usable Python interpreter
- 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
2023-01-06 00:32:09 +01:00
Scott Kostyshak
83c72a3ece ctests: invert a bug from old routine
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.
2023-01-05 12:55:54 -05:00
Kornel Benko
0f7f61b29e Fix "origin" in KOMA-Script_Book.lyx 2023-01-05 16:24:00 +01:00
Jean-Marc Lasgouttes
7c5bad56c4 Add information to Row::operator<< 2023-01-05 11:56:56 +01:00
Richard Kimberly Heck
30189332c8 Fix minor bug mentioned in #10827 2023-01-04 23:23:30 -05:00
Richard Kimberly Heck
04025d0259 Fix compilation problem 2023-01-04 23:04:02 -05:00
Scott Kostyshak
cb27aaa826 Additional.lyx: address scrbook error re old font
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.
2023-01-04 22:36:23 -05:00
Scott Kostyshak
6e45bf2da7 Additional.lyx: fix "origin" arg of rotate box
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.
2023-01-04 22:20:59 -05:00
Scott Kostyshak
0677c161a1 Additional.lyx: resave with LyX binary
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).
2023-01-04 22:11:18 -05:00
Scott Kostyshak
3c8a5d4dad Additional.lyx: rm English variant switches
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.
2023-01-04 22:10:05 -05:00
Pavel Sanda
3e97b90b40 Add note about deprecated layouts. 2023-01-04 22:13:38 +01:00
Pavel Sanda
d1080b0352 * Additional.lyx : Final remarks from John Hudson 2023-01-04 21:59:39 +01:00
John R Hudson
b2c2a7aaa3 Update entries for Foils, Slides and Reports in Chapter 3 Document classes and do final tidying up of Additional.lyx 2023-01-03 19:18:33 +01:00
Richard Kimberly Heck
1567a7e3b8 Ignore python cache 2023-01-03 12:49:28 -05:00
John R Hudson
ead6a5beb9 Insert entries for Tufte, frletter, G-Brief and lettre into Chapter 3 Document classes of Additional.lyx 2023-01-02 20:37:19 +01:00
Pavel Sanda
03b4502260 Forgotten files 2023-01-01 22:36:04 +01:00
John R Hudson
be362357ec Add KOMA-Script_Book.lyx and associated BibTeX file and CC logo to examples/Books and update Makefile.am 2023-01-01 22:29:14 +01:00
Thibaut Cuvelier
017588973f Revert "New Theorems Module. Contributed by Udicoudco <udifoglle@gmail.com> on the mailing list. Rebased on top of master."
This reverts commit 42c2a25fb8.
2022-12-31 11:28:56 +01:00
Thibaut Cuvelier
42c2a25fb8 New Theorems Module. Contributed by Udicoudco <udifoglle@gmail.com> on the mailing list. Rebased on top of master.
I've modified all the non-AMS theorem modules so they would be independent of packages. currently
	the code support \theoremstyle, but only with definition, plain and remark.

	I'v added a new theorem module that support the thmtools \listoftheorems.

	I've modified the syntax of all theorem modules, such that it would be easier to
	create a new one, or maintaining the ones that exists. Instead of using \newtheorem
	in the preamble of a lyaout, I wrote \lyx@newtheorem, and in each module I've defiened
	\lyx@newtheorem as fitted. This way, there is only need in the files thorems-base, and theorems-extended,
	instead of an .inc file for each module.

	I've added theorems-labels.inc, a file that suppose to be included in a "Numbered by type" module,
	to change the Label and the LabelCounter of the layouts in theorems-base.inc.

	Note that in this configuration, all non-AMS modules will clash with the AMS ones, and so as the
	proof versions. theorems-proof-std.inc suppose to be in the non-AMS while theorems-proof.inc
	should be included only in AMS variants.
2022-12-31 01:56:51 +01:00