diff --git a/src/api/metadata/yaml/message.h b/src/api/metadata/yaml/message.h index 8b4a68bf..cb82cae1 100644 --- a/src/api/metadata/yaml/message.h +++ b/src/api/metadata/yaml/message.h @@ -109,37 +109,9 @@ struct convert { formatArgStore.push_back(sub); } - static const std::regex boostSyntax( - "%(\\d+)%", std::regex::ECMAScript | std::regex::icase); - for (auto& mc : content) { - // Replace the old Boost.Format placeholder syntax for backward - // compatibility. To be removed after at least one major release of - // libloot to allow migration to the new syntax. - auto text = mc.GetText(); - std::smatch match; - while ( - std::regex_search(text.cbegin(), text.cend(), match, boostSyntax)) { - if (match.size() > 1) { - const auto n = std::stoul(match[1]); - if (n > 0) { - const auto newPlaceholder = "{" + std::to_string(n - 1) + "}"; - text.replace(match[0].first, match[0].second, newPlaceholder); - } else { - throw RepresentationException( - node.Mark(), - "bad conversion: found zero-indexed placeholder using old " - "syntax"); - } - } else { - throw RepresentationException(node.Mark(), - "bad conversion: only partially " - "matched old placeholder syntax"); - } - } - try { - const auto formattedText = fmt::vformat(text, formatArgStore); + const auto formattedText = fmt::vformat(mc.GetText(), formatArgStore); mc = loot::MessageContent(formattedText, mc.GetLanguage()); } catch (const fmt::format_error& e) { throw RepresentationException( diff --git a/src/tests/api/internals/metadata/yaml/message_test.h b/src/tests/api/internals/metadata/yaml/message_test.h index bea735fe..3afc4997 100644 --- a/src/tests/api/internals/metadata/yaml/message_test.h +++ b/src/tests/api/internals/metadata/yaml/message_test.h @@ -324,28 +324,6 @@ TEST_F(MessageTest, message.GetContent()); } -TEST_F(MessageTest, decodingFromYamlShouldAcceptPercentagePlaceholderSyntax) { - YAML::Node node = YAML::Load( - "type: say\n" - "content: content %1% %2% %3% %4% %5% %6% %7% %8% %9% %10% %11%\n" - "subs:\n" - " - a\n" - " - b\n" - " - c\n" - " - d\n" - " - e\n" - " - f\n" - " - g\n" - " - h\n" - " - i\n" - " - j\n" - " - k"); - Message message = node.as(); - - ASSERT_EQ(1, message.GetContent().size()); - EXPECT_EQ("content a b c d e f g h i j k", message.GetContent()[0].GetText()); -} - TEST_F(MessageTest, decodingFromYamlShouldThrowIfAnInvalidConditionIsGiven) { YAML::Node node = YAML::Load( "type: say\n"