aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-14 00:23:10 -0400
committerPaul Duncan <pabs@pablotron.org>2016-03-14 00:23:10 -0400
commitbe94d5fa266e1917375a1f09a012bac923b889d6 (patch)
tree63d302723ad718b4049bdd90f9b53b95721148f1 /src
parent3e1697e737cae24ba398f7062c27ce4ced2b8626 (diff)
downloadold-guff-be94d5fa266e1917375a1f09a012bac923b889d6.tar.bz2
old-guff-be94d5fa266e1917375a1f09a012bac923b889d6.zip
strip extra body attr whitespace
Diffstat (limited to 'src')
-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