mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Merge branch 'master' into html2haml
Conflicts: doc-src/HAML_CHANGELOG.md
This commit is contained in:
commit
54cf0e0371
9 changed files with 120 additions and 22 deletions
14
Rakefile
14
Rakefile
|
@ -248,8 +248,18 @@ task :pages do
|
|||
sh %{git checkout #{proj}-pages}
|
||||
sh %{git reset --hard origin/#{proj}-pages}
|
||||
|
||||
sh %{rake build --trace}
|
||||
sh %{rsync -av --delete site/ /var/www/#{proj}-pages}
|
||||
Dir.chdir("/var/www/#{proj}-pages") do
|
||||
sh %{git fetch origin}
|
||||
|
||||
sh %{git checkout stable}
|
||||
sh %{git reset --hard origin/stable}
|
||||
|
||||
sh %{git checkout #{proj}-pages}
|
||||
sh %{git reset --hard origin/#{proj}-pages}
|
||||
sh %{rake build --trace}
|
||||
sh %{mkdir -p tmp}
|
||||
sh %{touch tmp/restart.txt}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
4
TODO
4
TODO
|
@ -3,10 +3,6 @@
|
|||
|
||||
* Documentation
|
||||
Redo tutorial?
|
||||
Contribution information
|
||||
Will be code reviewed
|
||||
[Haml]/[Sass], punctuation
|
||||
Don't forget docs
|
||||
Using helpers
|
||||
haml_concat and haml_tag in particular
|
||||
Syntax highlighting?
|
||||
|
|
|
@ -98,7 +98,7 @@ including the line number and the offending character.
|
|||
|
||||
* Attributes are now sorted, to maintain a deterministic order.
|
||||
|
||||
## 2.2.7 (Unreleased)
|
||||
## [2.2.7](http://github.com/nex3/haml/commit/2.2.7)
|
||||
|
||||
* Fixed an `html2haml` issue where ERB attribute values
|
||||
weren't HTML-unescaped before being transformed into Haml.
|
||||
|
@ -106,6 +106,16 @@ including the line number and the offending character.
|
|||
* Fixed an `html2haml` issue where `#{}` wasn't escaped
|
||||
before being transformed into Haml.
|
||||
|
||||
* Add `<code>` to the list of tags that's
|
||||
{file:HAML_REFERENCE.md#preserve-option automatically whitespace-preserved}.
|
||||
|
||||
* Fixed a bug with `end` being followed by code in silent scripts -
|
||||
it no longer throws an error when it's nested beneath tags.
|
||||
|
||||
* Fixed a bug with inner whitespace-nuking and conditionals.
|
||||
The `else` et al. clauses of conditionals are now properly
|
||||
whitespace-nuked.
|
||||
|
||||
## [2.2.6](http://github.com/nex3/haml/commit/2.2.6)
|
||||
|
||||
* Made the error message when unable to load a dependency for html2haml
|
||||
|
|
|
@ -34,6 +34,10 @@ Several bug fixes and minor improvements have been made, including:
|
|||
* Displaying the expected strings as strings rather than regular expressions
|
||||
whenever possible.
|
||||
|
||||
## [2.2.7](http://github.com/nex3/haml/commit/2.2.7)
|
||||
|
||||
There were no changes made to Sass between versions 2.2.6 and 2.2.7.
|
||||
|
||||
## [2.2.6](http://github.com/nex3/haml/commit/2.2.6)
|
||||
|
||||
* Don't crash when the `__FILE__` constant of a Ruby file is a relative path,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Nathan Weizenbaum
|
||||
;; URL: http://github.com/nex3/haml/tree/master
|
||||
;; Version: 2.2.6
|
||||
;; Version: 2.2.7
|
||||
;; Created: 2007-03-08
|
||||
;; By: Nathan Weizenbaum
|
||||
;; Keywords: markup, language, html
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
;; Author: Nathan Weizenbaum
|
||||
;; URL: http://github.com/nex3/haml/tree/master
|
||||
;; Version: 2.2.6
|
||||
;; Version: 2.2.7
|
||||
;; Created: 2007-03-15
|
||||
;; By: Nathan Weizenbaum
|
||||
;; Keywords: markup, language, css
|
||||
;; Package-Requires: ((haml-mode "2.2.5"))
|
||||
;; Package-Requires: ((haml-mode "2.2.7"))
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
|
|
|
@ -72,9 +72,10 @@ module Haml
|
|||
:suppress_eval => false,
|
||||
:attr_wrapper => "'",
|
||||
|
||||
# Don't forget to update the docs in lib/haml.rb if you update these
|
||||
# Don't forget to update the docs in doc-src/HAML_REFERENCE.md
|
||||
# if you update these
|
||||
:autoclose => %w[meta img link br hr input area param col base],
|
||||
:preserve => %w[textarea pre],
|
||||
:preserve => %w[textarea pre code],
|
||||
|
||||
:filename => '(haml)',
|
||||
:line => 1,
|
||||
|
|
|
@ -186,7 +186,7 @@ END
|
|||
return unless line.tabs <= @template_tabs && @template_tabs > 0
|
||||
|
||||
to_close = @template_tabs - line.tabs
|
||||
to_close.times { |i| close unless to_close - 1 - i == 0 && mid_block_keyword?(line.text) }
|
||||
to_close.times {|i| close unless to_close - 1 - i == 0 && mid_block_keyword?(line.text)}
|
||||
end
|
||||
|
||||
# Processes a single line of Haml.
|
||||
|
@ -228,12 +228,27 @@ END
|
|||
newline_now
|
||||
|
||||
# Handle stuff like - end.join("|")
|
||||
@to_close_stack.first << false if text =~ /^-\s*end\b/ && !block_opened?
|
||||
@to_close_stack.last << false if text =~ /^-\s*end\b/ && !block_opened?
|
||||
|
||||
case_stmt = text =~ /^-\s*case\b/
|
||||
block = block_opened? && !mid_block_keyword?(text)
|
||||
push_and_tabulate([:script]) if block || case_stmt
|
||||
push_and_tabulate(:nil) if block && case_stmt
|
||||
keyword = mid_block_keyword?(text)
|
||||
block = block_opened? && !keyword
|
||||
|
||||
# It's important to preserve tabulation modification for keywords
|
||||
# that involve choosing between posible blocks of code.
|
||||
if %w[else elsif when].include?(keyword)
|
||||
@dont_indent_next_line, @dont_tab_up_next_text = @to_close_stack.last[1..2]
|
||||
|
||||
# when is unusual in that either it will be indented twice,
|
||||
# or the case won't have created its own indentation
|
||||
if keyword == "when"
|
||||
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text, false])
|
||||
end
|
||||
elsif block || case_stmt
|
||||
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])
|
||||
elsif block && case_stmt
|
||||
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])
|
||||
end
|
||||
when FILTER; start_filtered(text[1..-1].downcase)
|
||||
when DOCTYPE
|
||||
return render_doctype(text) if text[0...3] == '!!!'
|
||||
|
@ -247,10 +262,11 @@ END
|
|||
end
|
||||
end
|
||||
|
||||
# Returns whether or not the text is a silent script text with one
|
||||
# of Ruby's mid-block keywords.
|
||||
# If the text is a silent script text with one of Ruby's mid-block keywords,
|
||||
# returns the name of that keyword.
|
||||
# Otherwise, returns nil.
|
||||
def mid_block_keyword?(text)
|
||||
MID_BLOCK_KEYWORD_REGEX =~ text
|
||||
text[MID_BLOCK_KEYWORD_REGEX, 1]
|
||||
end
|
||||
|
||||
# Evaluates <tt>text</tt> in the context of the scope object, but
|
||||
|
@ -398,7 +414,7 @@ END
|
|||
end
|
||||
|
||||
# Closes a Ruby block.
|
||||
def close_script(push_end = true)
|
||||
def close_script(_1, _2, push_end = true)
|
||||
push_silent("end", true) if push_end
|
||||
@template_tabs -= 1
|
||||
end
|
||||
|
@ -433,7 +449,7 @@ END
|
|||
@template_tabs -= 1
|
||||
end
|
||||
|
||||
def close_nil
|
||||
def close_nil(*args)
|
||||
@template_tabs -= 1
|
||||
end
|
||||
|
||||
|
|
|
@ -232,6 +232,19 @@ HAML
|
|||
SOURCE
|
||||
end
|
||||
|
||||
def test_pre_code
|
||||
assert_equal(<<HTML, render(<<HAML))
|
||||
<pre><code>Foo
 bar
 baz</code></pre>
|
||||
HTML
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
Foo
|
||||
bar
|
||||
baz
|
||||
HAML
|
||||
end
|
||||
|
||||
def test_boolean_attributes
|
||||
assert_equal("<p bar baz='true' foo='bar'></p>\n",
|
||||
render("%p{:foo => 'bar', :bar => true, :baz => 'true'}", :format => :html4))
|
||||
|
@ -268,6 +281,36 @@ HTML
|
|||
HAML
|
||||
end
|
||||
|
||||
def test_whitespace_nuke_with_tags_and_else
|
||||
assert_equal(<<HTML, render(<<HAML))
|
||||
<a>
|
||||
<b>foo</b>
|
||||
</a>
|
||||
HTML
|
||||
%a
|
||||
%b<
|
||||
- if false
|
||||
= "foo"
|
||||
- else
|
||||
foo
|
||||
HAML
|
||||
|
||||
assert_equal(<<HTML, render(<<HAML))
|
||||
<a>
|
||||
<b>
|
||||
foo
|
||||
</b>
|
||||
</a>
|
||||
HTML
|
||||
%a
|
||||
%b
|
||||
- if false
|
||||
= "foo"
|
||||
- else
|
||||
foo
|
||||
HAML
|
||||
end
|
||||
|
||||
def test_both_case_indentation_work_with_deeply_nested_code
|
||||
result = <<RESULT
|
||||
<h2>
|
||||
|
@ -334,6 +377,24 @@ HTML
|
|||
HAML
|
||||
end
|
||||
|
||||
def test_nested_end_with_method_call
|
||||
assert_equal(<<HTML, render(<<HAML))
|
||||
<p>
|
||||
2|3|4
|
||||
b-a-r
|
||||
</p>
|
||||
HTML
|
||||
%p
|
||||
= [1, 2, 3].map do |i|
|
||||
- i + 1
|
||||
- end.join("|")
|
||||
= "bar".gsub(/./) do |s|
|
||||
- s + "-"
|
||||
- end.gsub(/-$/) do |s|
|
||||
- ''
|
||||
HAML
|
||||
end
|
||||
|
||||
def test_silent_end_with_stuff
|
||||
assert_equal(<<HTML, render(<<HAML))
|
||||
e
|
||||
|
|
Loading…
Add table
Reference in a new issue