commit f1742ee26950f2f1cf520b787e59e6adaa06d34d
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sat Jun 8 13:02:26 2024 +0200

    Implement InsetLayout::requiresPackage()
---
 src/Paragraph.cpp          | 2 +-
 src/insets/InsetLayout.cpp | 6 ++++++
 src/insets/InsetLayout.h   | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index a63017db32..90358d6903 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1247,7 +1247,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
        // Both a layout tag and a dedicated inset seem too much effort for 
this.
        string const hr_url_escape_chars = "\\#%";
        if (contains(hr_url_escape_chars, c) && runparams.use_hyperref && 
il.latexname() == "url"
-           && il.required().find("url") != il.required().end()) {
+           && il.requiresPackage("url")) {
                os << "\\";
                os.put(c);
                return;
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index 69f5ac4113..3a97023097 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -998,4 +998,10 @@ int InsetLayout::requiredArgs() const
 }
 
 
+bool InsetLayout::requiresPackage(string const pkg) const
+{
+       return required_.find(pkg) != required_.end();
+}
+
+
 } //namespace lyx
diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h
index ce45214e7e..fc3cb28b5d 100644
--- a/src/insets/InsetLayout.h
+++ b/src/insets/InsetLayout.h
@@ -202,6 +202,8 @@ public:
        ///
        std::set<std::string> const & required() const { return required_; }
        ///
+       bool requiresPackage(std::string const pkg) const;
+       ///
        bool isMultiPar() const { return multipar_; }
        ///
        bool forcePlainLayout() const { return forceplain_; }
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to