From c29d29d592ae88f567ef2723c047bdd392a17d39 Mon Sep 17 00:00:00 2001 From: speedie Date: Mon, 17 Jun 2024 22:44:09 +0200 Subject: [PATCH] Some minor changes to constructors, fix Tag::Style --- include/docpp.hpp | 16 ++++++++++++++-- src/docpp.cpp | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/docpp.hpp b/include/docpp.hpp index d389a2e..91fa1a7 100644 --- a/include/docpp.hpp +++ b/include/docpp.hpp @@ -880,13 +880,25 @@ namespace docpp { */ bool empty() const; + /** + * @brief Construct a new Section object + * @param tag The tag of the section + * @param properties The properties of the section + */ + Section(const std::string& tag, const Properties& properties = {}) : tag(tag), properties(properties) {}; + /** + * @brief Construct a new Section object + * @param tag The tag of the section + * @param properties The properties of the section + */ + Section(const Tag tag, const Properties& properties = {}) : tag(resolve_tag(tag).first), properties(properties) {}; /** * @brief Construct a new Section object * @param tag The tag of the section * @param properties The properties of the section * @param elements The elements of the section */ - Section(const std::string& tag, const Properties& properties = {}, const std::vector& elements = {}) : tag(tag), properties(properties) { + Section(const std::string& tag, const Properties& properties, const std::vector& elements) : tag(tag), properties(properties) { for (const auto& element : elements) this->push_back(element); }; /** @@ -895,7 +907,7 @@ namespace docpp { * @param properties The properties of the section * @param elements The elements of the section */ - Section(const Tag tag, const Properties& properties = {}, const std::vector& elements = {}) : tag(resolve_tag(tag).first), properties(properties) { + Section(const Tag tag, const Properties& properties, const std::vector& elements) : tag(resolve_tag(tag).first), properties(properties) { for (const auto& element : elements) this->push_back(element); }; /** diff --git a/src/docpp.cpp b/src/docpp.cpp index 0a0adf1..09826b3 100644 --- a/src/docpp.cpp +++ b/src/docpp.cpp @@ -564,7 +564,7 @@ std::unordered_map> {Tag::Span, {"span", Type::Non_Self_Closing}}, {Tag::Strike, {"strike", Type::Non_Self_Closing}}, {Tag::Strong, {"strong", Type::Non_Self_Closing}}, - {Tag::Style, {"style", Type::Non_Closed}}, + {Tag::Style, {"style", Type::Non_Self_Closing}}, {Tag::Sub, {"sub", Type::Non_Self_Closing}}, {Tag::Subscript, {"sub", Type::Non_Self_Closing}}, {Tag::Sup, {"sup", Type::Non_Self_Closing}},