Skip to content

Commit

Permalink
Empty tags should be written as <br> when using a HTML doctype and <b…
Browse files Browse the repository at this point in the history
…r /> when using XHTML
  • Loading branch information
James Garlick committed Jun 26, 2008
1 parent 0467688 commit fa4ec83
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
11 changes: 0 additions & 11 deletions hobo/lib/hobo/static_tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@ abbr
acronym
address
applet
area
b
base
basefont
bdo
big
blockquote
body
br
button
caption
center
cite
code
col
colgroup
dd
del
Expand All @@ -29,7 +25,6 @@ em
embed
fieldset
font
frame
frameset
h1
h2
Expand All @@ -38,29 +33,23 @@ h4
h5
h6
head
hr
html
i
iframe
img
ins
isindex
kbd
label
legend
li
link
map
menu
meta
noframes
noscript
object
ol
optgroup
option
p
param
pre
q
s
Expand Down
35 changes: 29 additions & 6 deletions hobo/taglibs/rapid_pages.dryml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<def tag="base-page" attrs="title, full-title, doctype, nicedit">
<def tag="base-page" attrs="title, full-title, nicedit">
<% full_title ||= "#{title} : #{app_name}" %>
<doctype param version="&doctype || 'HTML 4.01 STRICT'"/>
<html>
<html merge-attrs>
<head param>
<title param><%= full_title.gsub(/<.*?>/, '') %></title>
<do param="stylesheets">
Expand All @@ -12,7 +11,7 @@

<do param="scripts">
<javascript param name="#{'nicedit, ' if nicedit} prototype, effects, dragdrop, controls, lowpro, hobo-rapid, application"/>
<do param="fix-ie6"><%= "<!--[if lt IE 7]>" %><javascript name="IE7"/><%= "<![endif]-->" %></do>
<if-ie version="lt IE 7" param="fix-ie6"><javascript name="IE7"/></if-ie>
<hobo-rapid-javascripts param/>
</do>
</head>
Expand All @@ -21,7 +20,6 @@
</html>
</def>


<def tag="simple-layout">
<base-page merge>
<body: param>
Expand Down Expand Up @@ -290,7 +288,7 @@
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ' +
'"http://www.w3.org/TR/html4/loose.dtd">'
when "XHTML 1.0 STRICT"
'!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' +
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' +
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
when "XHTML 1.0 TRANSITIONAL"
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' +
Expand All @@ -301,6 +299,31 @@
end
%></def>

<def tag="html" attrs="doctype">
<% doctype ||= 'HTML 4.01 STRICT' -%>
<doctype version="&doctype"/>
<% attributes.reverse_merge!(:xmlns => "http://www.w3.org/1999/xhtml") if doctype =~ /^XHTML/ -%>
<%= "<html#{tag_options(attributes)}>" %>
<set-scoped xmldoctype="&doctype =~ /^XHTML/"><do param="default"/></set-scoped>
<%= "</html>" %>
</def>

<!-- empty tags should be written as <br> in HTML and <br /> in XHTML -->
<def tag="empty-tag" attrs="tag-name"><%= "<#{tag_name}#{tag_options(attributes)}#{scope.xmldoctype ? ' /' : ''}>" %></def>
<def tag="base"><empty-tag tag-name="base" merge/></def>
<def tag="meta"><empty-tag tag-name="meta" merge/></def>
<def tag="link"><empty-tag tag-name="link" merge/></def>
<def tag="img"><empty-tag tag-name="img" merge/></def>
<def tag="br"><empty-tag tag-name="br" merge/></def>
<def tag="hr"><empty-tag tag-name="hr" merge/></def>
<def tag="frame"><empty-tag tag-name="frame" merge/></def>
<def tag="area"><empty-tag tag-name="area" merge/></def>
<def tag="param"><empty-tag tag-name="param" merge/></def>
<def tag="col"><empty-tag tag-name="col" merge/></def>

<def tag="if-ie" attrs="version">
<%= "<!--[if #{version || 'IE'}]>" %><do param="default"/><%= "<![endif]-->" %>
</def>

<def tag="stylesheet" attrs="name, media">
<repeat with="&comma_split(name)">
Expand Down

0 comments on commit fa4ec83

Please sign in to comment.