commit 5111c76d7f4da8b35e6d1e98ed64a61cb6b74ed1
Author: Thibaut Cuvelier <[email protected]>
Date: Sat May 10 01:36:47 2025 +0200
InsetText::insetAsXHTML doesn't need to return anything.
Part of https://www.lyx.org/trac/ticket/12843 that is safe.
---
src/insets/InsetBox.cpp | 3 +--
src/insets/InsetCaption.cpp | 3 ++-
src/insets/InsetFloat.cpp | 3 ++-
src/insets/InsetListings.cpp | 5 +----
src/insets/InsetTabular.cpp | 6 ++++--
src/insets/InsetText.cpp | 9 ++++-----
src/insets/InsetText.h | 3 +--
src/insets/InsetWrap.cpp | 5 ++---
8 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp
index 90708b2c61..fc42fe39b9 100644
--- a/src/insets/InsetBox.cpp
+++ b/src/insets/InsetBox.cpp
@@ -785,9 +785,8 @@ docstring InsetBox::xhtml(XMLStream & xs, OutputParams
const & runparams) const
xs << xml::StartTag("div", attrs);
XHTMLOptions const opts = InsetText::WriteLabel |
InsetText::WriteInnerTag;
- docstring defer = InsetText::insetAsXHTML(xs, runparams, opts);
+ InsetText::insetAsXHTML(xs, runparams, opts);
xs << xml::EndTag("div");
- xs << defer;
return docstring();
}
diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp
index 6fad56dbd7..8722ca8b0a 100644
--- a/src/insets/InsetCaption.cpp
+++ b/src/insets/InsetCaption.cpp
@@ -389,7 +389,8 @@ docstring InsetCaption::getCaptionAsHTML(XMLStream & xs,
xs << full_label_ << ' ';
InsetText::XHTMLOptions const opts =
InsetText::WriteLabel | InsetText::WriteInnerTag;
- return InsetText::insetAsXHTML(xs, runparams, opts);
+ InsetText::insetAsXHTML(xs, runparams, opts);
+ return docstring();
}
diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index 72dfba2ce0..4d5bdd2993 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -361,9 +361,10 @@ docstring InsetFloat::xhtml(XMLStream & xs, OutputParams
const & rp) const
newxs << xml::StartTag(htmltype, attr);
InsetText::XHTMLOptions const opts =
InsetText::WriteLabel | InsetText::WriteInnerTag;
- docstring deferred = InsetText::insetAsXHTML(newxs, rp, opts);
+ InsetText::insetAsXHTML(newxs, rp, opts);
newxs << xml::EndTag(htmltype);
+ docstring deferred;
if (rp.inFloat == OutputParams::NONFLOAT) {
// In this case, this float needs to be deferred, but we'll put
it
// before anything the text itself deferred.
diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp
index 4360390301..d360d3fde2 100644
--- a/src/insets/InsetListings.cpp
+++ b/src/insets/InsetListings.cpp
@@ -462,13 +462,10 @@ docstring InsetListings::xhtml(XMLStream & os,
OutputParams const & rp) const
// We don't want to convert dashes here. That's the only conversion we
// do for XHTML, so this is safe.
newrp.pass_thru = true;
- docstring def = InsetText::insetAsXHTML(os, newrp, InsetText::JustText);
+ InsetText::insetAsXHTML(os, newrp, InsetText::JustText);
os << xml::EndTag(tag);
if (!isInline) {
- if (!def.empty()) {
- os << '\n' << def;
- }
os << xml::EndTag("div");
}
return {};
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 3552f3b0ee..d4d3e4578e 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -4901,8 +4901,10 @@ void InsetTableCell::addToToc(DocIterator const & di,
bool output_active,
docstring InsetTableCell::xhtml(XMLStream & xs, OutputParams const & rp) const
{
- if (!isFixedWidth)
- return InsetText::insetAsXHTML(xs, rp, InsetText::JustText);
+ if (!isFixedWidth) {
+ InsetText::insetAsXHTML(xs, rp, InsetText::JustText);
+ return docstring();
+ }
return InsetText::xhtml(xs, rp);
}
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 1615f649cc..b5641230f9 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -838,7 +838,8 @@ void InsetText::docbookText(XMLStream & xs, OutputParams
const & rp, XHTMLOption
docstring InsetText::xhtml(XMLStream & xs, OutputParams const & runparams)
const
{
- return insetAsXHTML(xs, runparams, WriteEverything);
+ insetAsXHTML(xs, runparams, WriteEverything);
+ return docstring();
}
@@ -855,7 +856,7 @@ docstring InsetText::xhtml(XMLStream & xs, OutputParams
const & runparams) const
// if so, try to close fonts, etc.
// There are probably limits to how well we can do here, though, and we will
// have to rely upon users not putting footnotes inside noun-type insets.
-docstring InsetText::insetAsXHTML(XMLStream & xs, OutputParams const & rp,
+void InsetText::insetAsXHTML(XMLStream & xs, OutputParams const & rp,
XHTMLOptions opts) const
{
// we will always want to output all our paragraphs when we are
@@ -868,7 +869,7 @@ docstring InsetText::insetAsXHTML(XMLStream & xs,
OutputParams const & rp,
xs.startDivision(false);
xhtmlParagraphs(text_, buffer(), xs, runparams);
xs.endDivision();
- return docstring();
+ return;
}
InsetLayout const & il = getLayout();
@@ -910,8 +911,6 @@ docstring InsetText::insetAsXHTML(XMLStream & xs,
OutputParams const & rp,
if (opts & WriteOuterTag)
xs << xml::EndTag(il.htmltag());
-
- return docstring();
}
diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h
index f46bf1bbfe..864e95ce53 100644
--- a/src/insets/InsetText.h
+++ b/src/insets/InsetText.h
@@ -91,8 +91,7 @@ public:
WriteEverything = 7
};
///
- docstring insetAsXHTML(XMLStream &, OutputParams const &,
- XHTMLOptions) const;
+ void insetAsXHTML(XMLStream &, OutputParams const &, XHTMLOptions)
const;
/// Outputs the inset as DocBook, with the given options regarding
outer tags.
void docbook(XMLStream &, OutputParams const &, XHTMLOptions opts)
const;
/// Outputs the whole inset as DocBook.
diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp
index 1d84491dd5..fc07cf2441 100644
--- a/src/insets/InsetWrap.cpp
+++ b/src/insets/InsetWrap.cpp
@@ -221,10 +221,9 @@ docstring InsetWrap::xhtml(XMLStream & xs, OutputParams
const & rp) const
string const & tag = il.htmltag();
string const attr = il.htmlGetAttrString() + " style='width:" + width +
";'";
xs << xml::StartTag(tag, attr);
- docstring const deferred =
- InsetText::insetAsXHTML(xs, rp, InsetText::WriteInnerTag);
+ InsetText::insetAsXHTML(xs, rp, InsetText::WriteInnerTag);
xs << xml::EndTag(tag);
- return deferred;
+ return docstring();
}
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs