aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/guff/views/ecrs/page.ecr2
-rw-r--r--src/guff/views/html/page.cr7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/guff/views/ecrs/page.ecr b/src/guff/views/ecrs/page.ecr
index e009ac1..aaccb30 100644
--- a/src/guff/views/ecrs/page.ecr
+++ b/src/guff/views/ecrs/page.ecr
@@ -6,7 +6,7 @@
<%= page_headers %>
</head>
- <body <%= body_attrs %>><%=
+ <body<%= body_attrs %>><%=
@body
%></body>
diff --git a/src/guff/views/html/page.cr b/src/guff/views/html/page.cr
index a902e0b..6ea9502 100644
--- a/src/guff/views/html/page.cr
+++ b/src/guff/views/html/page.cr
@@ -31,10 +31,13 @@ module Guff
end
def body_attrs
- {
+ r = {
"id": @body_id,
"class": @body_class,
- }.map { |k, v| attr(k, v) }.join(" ")
+ }.map { |k, v| attr(k, v) }.join(" ").strip
+
+ # prefix with space if content
+ " " + r if r.size > 0
end
def page_headers : String