commit d6a6da986f4309d71e397b6b8f498d9c203cf773
parent 2134cbce8d3b470100b503058bd3894b346892f9
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Wed, 26 Jun 2024 00:11:54 +0200
Fix bug with attributeList.empty()
Diffstat:
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -4,7 +4,7 @@ include(cmake/prelude.cmake)
project(
hemplate
- VERSION 0.1.8
+ VERSION 0.1.9
DESCRIPTION "Simple HTML template engine"
HOMEPAGE_URL "https://git.dimitrijedobrota.com/hemplate.git"
LANGUAGES CXX
diff --git a/include/hemplate/attribute.hpp b/include/hemplate/attribute.hpp
@@ -62,7 +62,7 @@ public:
attributeList& set(const std::string& name);
attributeList& set(const std::string& name, const std::string& value);
- bool empty() const { return m_attributes.empty(); }
+ bool empty() const;
void render(std::ostream& out) const override;
diff --git a/source/attribute.cpp b/source/attribute.cpp
@@ -24,6 +24,12 @@ bool attribute::operator==(const attribute& rhs) const
return m_name == rhs.m_name && m_value == rhs.m_value;
}
+bool attributeList::empty() const
+{
+ return m_attributes.empty() && m_class.get_value().empty()
+ && m_style.get_value().empty();
+}
+
void attribute::render(std::ostream& out) const
{
out << get_name() << "=\"" << get_value() << "\"";
@@ -34,7 +40,6 @@ attributeList& attributeList::set(const std::string& name)
if (name != "class" && name != "style") m_attributes.emplace_back(name);
return *this;
}
-
attributeList& attributeList::set(const std::string& name,
const std::string& value)
{