commit 723b59f37ba7e2b7c9a2157ca06eccd8a40e8101
Author: Thibaut Cuvelier <[email protected]>
Date: Sat May 10 01:45:09 2025 +0200
InsetCaption::getCaptionAsHTML doesn't need to return anything.
Part of https://www.lyx.org/trac/ticket/12843 that is safe.
Also rename the method to writeCaptionAsHTML, because it write the caption
to the stream instead of returning it.
---
src/insets/InsetCaption.cpp | 7 +++----
src/insets/InsetCaption.h | 4 ++--
src/insets/InsetCaptionable.cpp | 5 +----
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp
index 8722ca8b0a..2076ed56e0 100644
--- a/src/insets/InsetCaption.cpp
+++ b/src/insets/InsetCaption.cpp
@@ -316,9 +316,9 @@ docstring InsetCaption::xhtml(XMLStream & xs, OutputParams
const & rp) const
attr = attr + " class='" + our_class + "'";
}
xs << xml::StartTag(tag, attr);
- docstring def = getCaptionAsHTML(xs, rp);
+ writeCaptionAsHTML(xs, rp);
xs << xml::EndTag(tag);
- return def;
+ return docstring();
}
@@ -383,14 +383,13 @@ void InsetCaption::getCaptionAsDocBook(XMLStream & xs,
}
-docstring InsetCaption::getCaptionAsHTML(XMLStream & xs,
+void InsetCaption::writeCaptionAsHTML(XMLStream & xs,
OutputParams const & runparams) const
{
xs << full_label_ << ' ';
InsetText::XHTMLOptions const opts =
InsetText::WriteLabel | InsetText::WriteInnerTag;
InsetText::insetAsXHTML(xs, runparams, opts);
- return docstring();
}
diff --git a/src/insets/InsetCaption.h b/src/insets/InsetCaption.h
index 8d624700c1..887de0e337 100644
--- a/src/insets/InsetCaption.h
+++ b/src/insets/InsetCaption.h
@@ -32,8 +32,8 @@ public:
int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
/// write the caption text as DocBook in os
void getCaptionAsDocBook(XMLStream & os, OutputParams const &) const;
- /// return the caption text as HTML
- docstring getCaptionAsHTML(XMLStream & os, OutputParams const &) const;
+ /// write the caption text as HTML in os
+ void writeCaptionAsHTML(XMLStream & os, OutputParams const &) const;
///
std::string contextMenuName() const override;
private:
diff --git a/src/insets/InsetCaptionable.cpp b/src/insets/InsetCaptionable.cpp
index 216d95a01c..b23e08c68b 100644
--- a/src/insets/InsetCaptionable.cpp
+++ b/src/insets/InsetCaptionable.cpp
@@ -146,10 +146,7 @@ docstring InsetCaptionable::getCaptionHTML(OutputParams
const & runparams) const
odocstringstream ods;
XMLStream xs(ods);
- docstring def = ins->getCaptionAsHTML(xs, runparams);
- if (!def.empty())
- // should already have been escaped
- xs << XMLStream::ESCAPE_NONE << def << '\n';
+ ins->writeCaptionAsHTML(xs, runparams);
return ods.str();
}
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs