Implement InsetLayout::requiresPackage()

This commit is contained in:
Juergen Spitzmueller 2024-06-08 13:02:26 +02:00
parent a185642746
commit f1742ee269
3 changed files with 9 additions and 1 deletions

View File

@ -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;

View File

@ -998,4 +998,10 @@ int InsetLayout::requiredArgs() const
}
bool InsetLayout::requiresPackage(string const pkg) const
{
return required_.find(pkg) != required_.end();
}
} //namespace lyx

View File

@ -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_; }