[vcpkg-export-ifw] Safe description

QtIFW support rich text for component description,
bu some port has not safe ampersand symbol
in description text (for example 'openexr' package),
that should be replaced to '&' symbol name
This commit is contained in:
Konstantin Podsvirov 2017-10-13 05:33:32 +03:00
parent 9e19c24d29
commit 37fba399ef
1 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,14 @@ namespace vcpkg::Commands::Export::IFW
return date_time_as_string;
}
std::string safe_rich_from_plain_text(const std::string& text)
{
// match standalone ampersand, no HTML number or name
std::regex standalone_ampersand(R"###(&(?!(#[0-9]+|\w+);))###");
return std::regex_replace(text, standalone_ampersand, "&");
}
fs::path get_packages_dir_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
{
return ifw_options.maybe_packages_dir_path.has_value()
@ -156,7 +164,7 @@ namespace vcpkg::Commands::Export::IFW
</Package>
)###",
action.spec.name(),
binary_paragraph.description,
safe_rich_from_plain_text(binary_paragraph.description),
binary_paragraph.version,
create_release_date()));
}