mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
DocBook: fix crash with Linguistics example.
This was due to Floating::docbookTag not returning anything with the floattype_ tableau. Another issue that happened with that document is that the standard library's isspace crashed for some characters. I therefore implemented a more efficient version of the part that required it, and inlined the definition of isspace (even though that part becomes irrespective of locale, but was that feature ever used?).
This commit is contained in:
parent
594a4763b7
commit
abed1f3e6e
@ -98,6 +98,10 @@ string Floating::docbookTag(bool hasTitle) const
|
|||||||
// TODO: no good translation for now! Figures are the closest match, as they can contain text.
|
// TODO: no good translation for now! Figures are the closest match, as they can contain text.
|
||||||
// Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
|
// Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
|
||||||
return "figure";
|
return "figure";
|
||||||
|
} else {
|
||||||
|
// If nothing matches, return something that will not be valid.
|
||||||
|
LYXERR0("Unrecognised float type: " + floattype_);
|
||||||
|
return "float";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,6 +427,16 @@ void makeBibliography(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isNotOnlySpace(docstring const & str)
|
||||||
|
{
|
||||||
|
for (auto const & c: str) {
|
||||||
|
if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != '\f' && c != '\r')
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void makeParagraph(
|
void makeParagraph(
|
||||||
Text const & text,
|
Text const & text,
|
||||||
Buffer const & buf,
|
Buffer const & buf,
|
||||||
@ -518,8 +528,8 @@ void makeParagraph(
|
|||||||
auto nextpar = par;
|
auto nextpar = par;
|
||||||
++nextpar;
|
++nextpar;
|
||||||
auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end, special_case);
|
auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end, special_case);
|
||||||
for (auto & parXML : pars) {
|
for (docstring const & parXML : pars) {
|
||||||
if (!std::all_of(parXML.begin(), parXML.end(), ::isspace)) {
|
if (isNotOnlySpace(parXML)) {
|
||||||
if (open_par)
|
if (open_par)
|
||||||
openParTag(xs, &*par, prevpar);
|
openParTag(xs, &*par, prevpar);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user