Permalink
Browse files

html pretty improved: do not remove empty static lines, newlines befo…

…re doctype
  • Loading branch information...
1 parent 28ea228 commit f85c7d357b3049ebad983381d2918bdb15ecc80a @minad minad committed Oct 2, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/temple/html/pretty.rb
@@ -8,7 +8,7 @@ class Pretty < Fast
fieldset figure footer form head h1 h2 h3 h4 h5 h6
header hgroup hr html li link meta nav ol p
rp rt ruby section script style table tbody td tfoot
- th thead title tr ul video).freeze,
+ th thead title tr ul video doctype).freeze,
:pre_tags => %w(code pre textarea).freeze
def initialize(opts = {})
@@ -26,7 +26,7 @@ def call(exp)
def on_static(content)
if @pretty
content = content.gsub("\n", indent) if @pre_tags !~ content
- @last = content.sub!(/\r?\n\s*$/, ' ') ? nil : :noindent
+ @last = :noindent
end
[:static, content]
end
@@ -50,8 +50,8 @@ def on_dynamic(code)
end
def on_html_doctype(type)
- @last = nil
- super
+ return super unless @pretty
+ [:multi, [:static, tag_indent('doctype')], super]
end
def on_html_comment(content)
@@ -90,7 +90,6 @@ def preamble
[:code, "#{@pre_tags_name} = /#{@pre_tags.source}/"]
end
- # Return indentation if not in pre tag
def indent
"\n" + (options[:indent] || '') * @indent
end

0 comments on commit f85c7d3

Please sign in to comment.