haml 3.0.13 → 3.0.14
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/extra/haml-mode.el +31 -31
- data/extra/sass-mode.el +2 -2
- data/lib/haml/exec.rb +24 -6
- data/lib/haml/helpers/action_view_mods.rb +3 -3
- data/lib/haml/precompiler.rb +4 -13
- data/lib/haml/util.rb +11 -0
- data/lib/sass/plugin.rb +2 -3
- data/lib/sass/scss/parser.rb +17 -3
- data/test/haml/engine_test.rb +17 -0
- data/test/haml/helper_test.rb +8 -0
- data/test/sass/scss/scss_test.rb +26 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.14
|
data/extra/haml-mode.el
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
;; Author: Nathan Weizenbaum
|
6
6
|
;; URL: http://github.com/nex3/haml/tree/master
|
7
|
-
;; Version: 3.0.
|
7
|
+
;; Version: 3.0.14
|
8
8
|
;; Created: 2007-03-08
|
9
9
|
;; By: Nathan Weizenbaum
|
10
10
|
;; Keywords: markup, language, html
|
@@ -57,13 +57,6 @@ re-indented along with the line itself."
|
|
57
57
|
:type 'boolean
|
58
58
|
:group 'haml)
|
59
59
|
|
60
|
-
(defface haml-tab-face
|
61
|
-
'((((class color)) (:background "hotpink"))
|
62
|
-
(t (:reverse-video t)))
|
63
|
-
"Face to use for highlighting tabs in Haml files."
|
64
|
-
:group 'faces
|
65
|
-
:group 'haml)
|
66
|
-
|
67
60
|
(defvar haml-indent-function 'haml-indent-p
|
68
61
|
"A function for checking if nesting is allowed.
|
69
62
|
This function should look at the current line and return t
|
@@ -73,19 +66,19 @@ The function can also return a positive integer to indicate
|
|
73
66
|
a specific level to which the current line could be indented.")
|
74
67
|
|
75
68
|
(defconst haml-tag-beg-re
|
76
|
-
"^ *\\(?:[%\\.#][a-z0-9_:\\-]*\\)+\\(?:(.*)\\|{.*}\\|\\[.*\\]\\)*"
|
69
|
+
"^[ \t]*\\(?:[%\\.#][a-z0-9_:\\-]*\\)+\\(?:(.*)\\|{.*}\\|\\[.*\\]\\)*"
|
77
70
|
"A regexp matching the beginning of a Haml tag, through (), {}, and [].")
|
78
71
|
|
79
72
|
(defvar haml-block-openers
|
80
73
|
`(,(concat haml-tag-beg-re "[><]*[ \t]*$")
|
81
|
-
"^ *[&!]?[-=~].*do[ \t]*\\(|.*|[ \t]*\\)?$"
|
82
|
-
,(concat "^ *[&!]?[-=~][ \t]*\\("
|
74
|
+
"^[ \t]*[&!]?[-=~].*do[ \t]*\\(|.*|[ \t]*\\)?$"
|
75
|
+
,(concat "^[ \t]*[&!]?[-=~][ \t]*\\("
|
83
76
|
(regexp-opt '("if" "unless" "while" "until" "else"
|
84
77
|
"begin" "elsif" "rescue" "ensure" "when"))
|
85
78
|
"\\)")
|
86
|
-
"^ */\\(\\[.*\\]\\)?[ \t]*$"
|
87
|
-
"^ *-#"
|
88
|
-
"^ *:")
|
79
|
+
"^[ \t]*/\\(\\[.*\\]\\)?[ \t]*$"
|
80
|
+
"^[ \t]*-#"
|
81
|
+
"^[ \t]*:")
|
89
82
|
"A list of regexps that match lines of Haml that open blocks.
|
90
83
|
That is, a Haml line that can have text nested beneath it should
|
91
84
|
be matched by a regexp in this list.")
|
@@ -95,7 +88,7 @@ be matched by a regexp in this list.")
|
|
95
88
|
(defun haml-nested-regexp (re)
|
96
89
|
"Create a regexp to match a block starting with RE.
|
97
90
|
The line containing RE is matched, as well as all lines indented beneath it."
|
98
|
-
(concat "^\\( *\\)" re "\\(\n\\(?:\\(?:\\1 .*\\| *\\)\n\\)*\\(?:\\1 .*\\| *\\)?\\)?"))
|
91
|
+
(concat "^\\([ \t]*\\)" re "\\(\n\\(?:\\(?:\\1 .*\\| *\\)\n\\)*\\(?:\\1 .*\\| *\\)?\\)?"))
|
99
92
|
|
100
93
|
(defconst haml-font-lock-keywords
|
101
94
|
`((,(haml-nested-regexp "\\(?:-#\\|/\\).*") 0 font-lock-comment-face)
|
@@ -108,12 +101,11 @@ The line containing RE is matched, as well as all lines indented beneath it."
|
|
108
101
|
(haml-highlight-interpolation 1 font-lock-variable-name-face prepend)
|
109
102
|
(haml-highlight-ruby-tag 1 font-lock-preprocessor-face)
|
110
103
|
(haml-highlight-ruby-script 1 font-lock-preprocessor-face)
|
111
|
-
("^ *\\(\t\\)" 1 'haml-tab-face)
|
112
104
|
("^!!!.*" 0 font-lock-constant-face)
|
113
105
|
("| *$" 0 font-lock-string-face)))
|
114
106
|
|
115
|
-
(defconst haml-filter-re "^ *:\\w+")
|
116
|
-
(defconst haml-comment-re "^ *\\(?:-\\#\\|/\\)")
|
107
|
+
(defconst haml-filter-re "^[ \t]*:\\w+")
|
108
|
+
(defconst haml-comment-re "^[ \t]*\\(?:-\\#\\|/\\)")
|
117
109
|
|
118
110
|
(defun haml-fontify-region (beg end keywords syntax-table syntactic-keywords)
|
119
111
|
"Fontify a region between BEG and END using another mode's fontification.
|
@@ -208,7 +200,7 @@ This requires that `markdown-mode' be available."
|
|
208
200
|
(defun haml-highlight-ruby-script (limit)
|
209
201
|
"Highlight a Ruby script expression (-, =, or ~).
|
210
202
|
LIMIT works as it does in `re-search-forward'."
|
211
|
-
(when (re-search-forward "^ *\\(-\\|[&!]?[=~]\\) \\(.*\\)$" limit t)
|
203
|
+
(when (re-search-forward "^[ \t]*\\(-\\|[&!]?[=~]\\) \\(.*\\)$" limit t)
|
212
204
|
(haml-fontify-region-as-ruby (match-beginning 2) (match-end 2))))
|
213
205
|
|
214
206
|
(defun haml-highlight-ruby-tag (limit)
|
@@ -223,7 +215,7 @@ For example, this will highlight all of the following:
|
|
223
215
|
%p[@bar]
|
224
216
|
%p= 'baz'
|
225
217
|
%p{:foo => 'bar'}[@bar]= 'baz'"
|
226
|
-
(when (re-search-forward "^ *[%.#]" limit t)
|
218
|
+
(when (re-search-forward "^[ \t]*[%.#]" limit t)
|
227
219
|
(forward-char -1)
|
228
220
|
|
229
221
|
;; Highlight tag, classes, and ids
|
@@ -407,7 +399,6 @@ With ARG, do it that many times."
|
|
407
399
|
(set (make-local-variable 'indent-region-function) 'haml-indent-region)
|
408
400
|
(set (make-local-variable 'parse-sexp-lookup-properties) t)
|
409
401
|
(setq comment-start "-#")
|
410
|
-
(setq indent-tabs-mode nil)
|
411
402
|
(setq font-lock-defaults '((haml-font-lock-keywords) t t)))
|
412
403
|
|
413
404
|
;; Useful functions
|
@@ -620,18 +611,18 @@ TYPE is the type of text parsed ('name or 'value)
|
|
620
611
|
and BEG and END delimit that text in the buffer."
|
621
612
|
(let ((eol (save-excursion (end-of-line) (point))))
|
622
613
|
(while (not (haml-move ")"))
|
623
|
-
(haml-move " *")
|
614
|
+
(haml-move "[ \t]*")
|
624
615
|
(unless (haml-move "[a-z0-9_:\\-]+")
|
625
|
-
(return-from haml-parse-new-attr-hash (haml-move " *$")))
|
616
|
+
(return-from haml-parse-new-attr-hash (haml-move "[ \t]*$")))
|
626
617
|
(funcall fn 'name (match-beginning 0) (match-end 0))
|
627
|
-
(haml-move " *")
|
618
|
+
(haml-move "[ \t]*")
|
628
619
|
(when (haml-move "=")
|
629
|
-
(haml-move " *")
|
620
|
+
(haml-move "[ \t]*")
|
630
621
|
(unless (looking-at "[\"'@a-z]") (return-from haml-parse-new-attr-hash))
|
631
622
|
(let ((beg (point)))
|
632
623
|
(haml-limited-forward-sexp eol)
|
633
624
|
(funcall fn 'value beg (point)))
|
634
|
-
(haml-move " *")))
|
625
|
+
(haml-move "[ \t]*")))
|
635
626
|
nil))
|
636
627
|
|
637
628
|
(defun haml-compute-indentation ()
|
@@ -704,10 +695,19 @@ back-dent the line by `haml-indent-offset' spaces. On reaching column
|
|
704
695
|
"Add N spaces to the beginning of each line in the region.
|
705
696
|
If N is negative, will remove the spaces instead. Assumes all
|
706
697
|
lines in the region have indentation >= that of the first line."
|
707
|
-
(let ((ci (current-indentation))
|
698
|
+
(let* ((ci (current-indentation))
|
699
|
+
(indent-rx
|
700
|
+
(concat "^"
|
701
|
+
(if indent-tabs-mode
|
702
|
+
(concat (make-string (/ ci tab-width) ?\t)
|
703
|
+
(make-string (mod ci tab-width) ?\t))
|
704
|
+
(make-string ci ?\s)))))
|
708
705
|
(save-excursion
|
709
|
-
(while (re-search-forward
|
710
|
-
(
|
706
|
+
(while (re-search-forward indent-rx (mark) t)
|
707
|
+
(let ((ci (current-indentation)))
|
708
|
+
(delete-horizontal-space)
|
709
|
+
(beginning-of-line)
|
710
|
+
(indent-to (max 0 (+ ci n))))))))
|
711
711
|
|
712
712
|
(defun haml-electric-backspace (arg)
|
713
713
|
"Delete characters or back-dent the current line.
|
@@ -730,8 +730,8 @@ the current line."
|
|
730
730
|
(haml-mark-sexp-but-not-next-line)
|
731
731
|
(set-mark (save-excursion (end-of-line) (point))))
|
732
732
|
(haml-reindent-region-by (* (- arg) haml-indent-offset))
|
733
|
-
(
|
734
|
-
|
733
|
+
(pop-mark)))
|
734
|
+
(back-to-indentation)))
|
735
735
|
|
736
736
|
(defun haml-kill-line-and-indent ()
|
737
737
|
"Kill the current line, and re-indent all lines nested beneath it."
|
data/extra/sass-mode.el
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
;; Author: Nathan Weizenbaum
|
6
6
|
;; URL: http://github.com/nex3/haml/tree/master
|
7
|
-
;; Version: 3.0.
|
7
|
+
;; Version: 3.0.14
|
8
8
|
;; Created: 2007-03-15
|
9
9
|
;; By: Nathan Weizenbaum
|
10
10
|
;; Keywords: markup, language, css
|
11
|
-
;; Package-Requires: ((haml-mode "3.0.
|
11
|
+
;; Package-Requires: ((haml-mode "3.0.14"))
|
12
12
|
|
13
13
|
;;; Commentary:
|
14
14
|
|
data/lib/haml/exec.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'optparse'
|
2
2
|
require 'fileutils'
|
3
|
-
require 'rbconfig'
|
4
3
|
|
5
4
|
module Haml
|
6
5
|
# This module handles the various Haml executables (`haml`, `sass`, `sass-convert`, etc).
|
@@ -80,7 +79,7 @@ module Haml
|
|
80
79
|
@options[:trace] = true
|
81
80
|
end
|
82
81
|
|
83
|
-
if
|
82
|
+
if ::Haml::Util.windows?
|
84
83
|
opts.on('--unix-newlines', 'Use Unix-style newlines in written files.') do
|
85
84
|
@options[:unix_newlines] = true
|
86
85
|
end
|
@@ -338,9 +337,9 @@ END
|
|
338
337
|
# and runs the Sass compiler appropriately.
|
339
338
|
def process_result
|
340
339
|
if !@options[:update] && !@options[:watch] &&
|
341
|
-
@args.first && @args.first
|
340
|
+
@args.first && colon_path?(@args.first)
|
342
341
|
if @args.size == 1
|
343
|
-
@args = @args.first
|
342
|
+
@args = split_colon_path(@args.first)
|
344
343
|
else
|
345
344
|
@options[:update] = true
|
346
345
|
end
|
@@ -389,7 +388,10 @@ END
|
|
389
388
|
::Sass::Plugin.options.merge! @options[:for_engine]
|
390
389
|
::Sass::Plugin.options[:unix_newlines] = @options[:unix_newlines]
|
391
390
|
|
392
|
-
|
391
|
+
p [colon_path?(@args[0]), split_colon_path(@args[0])]
|
392
|
+
exit
|
393
|
+
|
394
|
+
if @args[1] && !colon_path?(@args[0])
|
393
395
|
flag = @options[:update] ? "--update" : "--watch"
|
394
396
|
err =
|
395
397
|
if !File.exist?(@args[1])
|
@@ -403,7 +405,7 @@ File #{@args[1]} #{err}.
|
|
403
405
|
MSG
|
404
406
|
end
|
405
407
|
|
406
|
-
dirs, files = @args.map {|name| name
|
408
|
+
dirs, files = @args.map {|name| split_colon_path(name)}.
|
407
409
|
partition {|i, _| File.directory? i}
|
408
410
|
files.map! {|from, to| [from, to || from.gsub(/\..*?$/, '.css')]}
|
409
411
|
dirs.map! {|from, to| [from, to || from]}
|
@@ -437,6 +439,22 @@ MSG
|
|
437
439
|
|
438
440
|
::Sass::Plugin.watch(files)
|
439
441
|
end
|
442
|
+
|
443
|
+
def colon_path?(path)
|
444
|
+
!split_colon_path(path)[1].nil?
|
445
|
+
end
|
446
|
+
|
447
|
+
def split_colon_path(path)
|
448
|
+
one, two = path.split(':', 2)
|
449
|
+
if one && two && #::Haml::Util.windows? &&
|
450
|
+
one =~ /\A[A-Za-z]\Z/ && two =~ /\A[\/\\]/
|
451
|
+
# If we're on Windows and we were passed a drive letter path,
|
452
|
+
# don't split on that colon.
|
453
|
+
one2, two = two.split(':', 2)
|
454
|
+
one = one + ':' + one2
|
455
|
+
end
|
456
|
+
return one, two
|
457
|
+
end
|
440
458
|
end
|
441
459
|
|
442
460
|
# The `haml` executable.
|
@@ -107,9 +107,9 @@ module ActionView
|
|
107
107
|
return content_tag_without_haml(name, *args) {preserve(&block)}
|
108
108
|
end
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
content = content_tag_without_haml(name, *args, &block)
|
111
|
+
content = Haml::Helpers.preserve(content) if preserve && content
|
112
|
+
content
|
113
113
|
end
|
114
114
|
|
115
115
|
alias_method :content_tag_without_haml, :content_tag
|
data/lib/haml/precompiler.rb
CHANGED
@@ -242,29 +242,20 @@ END
|
|
242
242
|
# Handle stuff like - end.join("|")
|
243
243
|
@to_close_stack.last << false if text =~ /^-\s*end\b/ && !block_opened?
|
244
244
|
|
245
|
-
case_stmt = text =~ /^-\s*case\b/
|
246
245
|
keyword = mid_block_keyword?(text)
|
247
246
|
block = block_opened? && !keyword
|
248
247
|
|
249
248
|
# It's important to preserve tabulation modification for keywords
|
250
249
|
# that involve choosing between posible blocks of code.
|
251
250
|
if %w[else elsif when].include?(keyword)
|
252
|
-
|
253
|
-
# when the preceding "- if" has nothing nested
|
254
|
-
if @to_close_stack.last && @to_close_stack.last.first == :script
|
255
|
-
@dont_indent_next_line, @dont_tab_up_next_text = @to_close_stack.last[1..2]
|
256
|
-
else
|
257
|
-
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])
|
258
|
-
end
|
251
|
+
@dont_indent_next_line, @dont_tab_up_next_text = @to_close_stack.last[1..2]
|
259
252
|
|
260
253
|
# when is unusual in that either it will be indented twice,
|
261
254
|
# or the case won't have created its own indentation
|
262
255
|
if keyword == "when"
|
263
256
|
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text, false])
|
264
257
|
end
|
265
|
-
elsif block ||
|
266
|
-
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])
|
267
|
-
elsif block && case_stmt
|
258
|
+
elsif block || text =~ /^-\s*(case|if)\b/
|
268
259
|
push_and_tabulate([:script, @dont_indent_next_line, @dont_tab_up_next_text])
|
269
260
|
end
|
270
261
|
when FILTER; start_filtered(text[1..-1].downcase)
|
@@ -491,7 +482,7 @@ END
|
|
491
482
|
# that can then be merged with another attributes hash.
|
492
483
|
def self.parse_class_and_id(list)
|
493
484
|
attributes = {}
|
494
|
-
list.scan(/([#.])([
|
485
|
+
list.scan(/([#.])([-:_a-zA-Z0-9]+)/) do |type, property|
|
495
486
|
case type
|
496
487
|
when '.'
|
497
488
|
if attributes['class']
|
@@ -573,7 +564,7 @@ END
|
|
573
564
|
|
574
565
|
# Parses a line into tag_name, attributes, attributes_hash, object_ref, action, value
|
575
566
|
def parse_tag(line)
|
576
|
-
raise SyntaxError.new("Invalid tag: \"#{line}\".") unless match = line.scan(/%([-:\w]+)([
|
567
|
+
raise SyntaxError.new("Invalid tag: \"#{line}\".") unless match = line.scan(/%([-:\w]+)([-:\w\.\#]*)(.*)/)[0]
|
577
568
|
tag_name, attributes, rest = match
|
578
569
|
new_attributes_hash = old_attributes_hash = last_line = object_ref = nil
|
579
570
|
attributes_hashes = []
|
data/lib/haml/util.rb
CHANGED
@@ -3,6 +3,8 @@ require 'set'
|
|
3
3
|
require 'enumerator'
|
4
4
|
require 'stringio'
|
5
5
|
require 'strscan'
|
6
|
+
require 'rbconfig'
|
7
|
+
|
6
8
|
require 'haml/root'
|
7
9
|
require 'haml/util/subset_map'
|
8
10
|
|
@@ -366,6 +368,15 @@ module Haml
|
|
366
368
|
return ActionView::SafeBuffer
|
367
369
|
end
|
368
370
|
|
371
|
+
## Cross-OS Compatibility
|
372
|
+
|
373
|
+
# Whether or not this is running on Windows.
|
374
|
+
#
|
375
|
+
# @return [Boolean]
|
376
|
+
def windows?
|
377
|
+
RbConfig::CONFIG['host_os'] =~ /mswin|windows/i
|
378
|
+
end
|
379
|
+
|
369
380
|
## Cross-Ruby-Version Compatibility
|
370
381
|
|
371
382
|
# Whether or not this is running under Ruby 1.8 or lower.
|
data/lib/sass/plugin.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'fileutils'
|
2
|
-
require 'rbconfig'
|
3
2
|
|
4
3
|
require 'sass'
|
5
4
|
require 'sass/plugin/configuration'
|
@@ -76,7 +75,7 @@ module Sass
|
|
76
75
|
|
77
76
|
template_location_array.each do |template_location, css_location|
|
78
77
|
|
79
|
-
Dir.glob(File.join(template_location, "**", "*.s[ca]ss")).each do |file|
|
78
|
+
Dir.glob(File.join(template_location, "**", "*.s[ca]ss")).sort.each do |file|
|
80
79
|
# Get the relative path to the file
|
81
80
|
name = file.sub(template_location.sub(/\/*$/, '/'), "")
|
82
81
|
css = css_filename(name, css_location)
|
@@ -228,7 +227,7 @@ module Sass
|
|
228
227
|
|
229
228
|
# Finally, write the file
|
230
229
|
flag = 'w'
|
231
|
-
flag = 'wb' if
|
230
|
+
flag = 'wb' if Haml::Util.windows? && options[:unix_newlines]
|
232
231
|
File.open(css, flag) {|file| file.print(result)}
|
233
232
|
end
|
234
233
|
|
data/lib/sass/scss/parser.rb
CHANGED
@@ -179,19 +179,33 @@ module Sass
|
|
179
179
|
expr = sass_script(:parse)
|
180
180
|
ss
|
181
181
|
node = block(node(Sass::Tree::IfNode.new(expr)), :directive)
|
182
|
+
pos = @scanner.pos
|
182
183
|
ss
|
183
|
-
|
184
|
+
|
185
|
+
else_block(node) ||
|
186
|
+
begin
|
187
|
+
# Backtrack in case there are any comments we want to parse
|
188
|
+
@scanner.pos = pos
|
189
|
+
node
|
190
|
+
end
|
184
191
|
end
|
185
192
|
|
186
193
|
def else_block(node)
|
187
|
-
return
|
194
|
+
return unless tok(/@else/)
|
188
195
|
ss
|
189
196
|
else_node = block(
|
190
197
|
Sass::Tree::IfNode.new((sass_script(:parse) if tok(/if/))),
|
191
198
|
:directive)
|
192
199
|
node.add_else(else_node)
|
200
|
+
pos = @scanner.pos
|
193
201
|
ss
|
194
|
-
|
202
|
+
|
203
|
+
else_block(node) ||
|
204
|
+
begin
|
205
|
+
# Backtrack in case there are any comments we want to parse
|
206
|
+
@scanner.pos = pos
|
207
|
+
node
|
208
|
+
end
|
195
209
|
end
|
196
210
|
|
197
211
|
def extend_directive
|
data/test/haml/engine_test.rb
CHANGED
@@ -165,6 +165,14 @@ MESSAGE
|
|
165
165
|
assert_equal("<p id='html_a_b'>foo</p>\n", render("%p(id='html'){:id => %w[a b]} foo")) # html attrs
|
166
166
|
end
|
167
167
|
|
168
|
+
def test_colon_in_class_attr
|
169
|
+
assert_equal("<p class='foo:bar' />\n", render("%p.foo:bar/"))
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_colon_in_id_attr
|
173
|
+
assert_equal("<p id='foo:bar' />\n", render("%p#foo:bar/"))
|
174
|
+
end
|
175
|
+
|
168
176
|
def test_dynamic_attributes_with_no_content
|
169
177
|
assert_equal(<<HTML, render(<<HAML))
|
170
178
|
<p>
|
@@ -660,6 +668,15 @@ HTML
|
|
660
668
|
- else
|
661
669
|
foo
|
662
670
|
HAML
|
671
|
+
|
672
|
+
assert_equal(<<HTML, render(<<HAML))
|
673
|
+
foo
|
674
|
+
HTML
|
675
|
+
- if true
|
676
|
+
- if false
|
677
|
+
- else
|
678
|
+
foo
|
679
|
+
HAML
|
663
680
|
end
|
664
681
|
|
665
682
|
def test_html_attributes_with_hash
|
data/test/haml/helper_test.rb
CHANGED
@@ -180,6 +180,10 @@ HAML
|
|
180
180
|
assert_equal("<p id='some_id'></p>\n", render("- haml_tag 'p#some_id'"))
|
181
181
|
end
|
182
182
|
|
183
|
+
def test_haml_tag_name_attribute_with_colon_id
|
184
|
+
assert_equal("<p id='some:id'></p>\n", render("- haml_tag 'p#some:id'"))
|
185
|
+
end
|
186
|
+
|
183
187
|
def test_haml_tag_without_name_but_with_id
|
184
188
|
assert_equal("<div id='some_id'></div>\n", render("- haml_tag '#some_id'"))
|
185
189
|
end
|
@@ -188,6 +192,10 @@ HAML
|
|
188
192
|
assert_equal("<div class='foo'></div>\n", render("- haml_tag '.foo'"))
|
189
193
|
end
|
190
194
|
|
195
|
+
def test_haml_tag_without_name_but_with_colon_class
|
196
|
+
assert_equal("<div class='foo:bar'></div>\n", render("- haml_tag '.foo:bar'"))
|
197
|
+
end
|
198
|
+
|
191
199
|
def test_haml_tag_name_with_id_and_class
|
192
200
|
assert_equal("<p class='foo' id='some_id'></p>\n", render("- haml_tag 'p#some_id.foo'"))
|
193
201
|
end
|
data/test/sass/scss/scss_test.rb
CHANGED
@@ -190,6 +190,32 @@ CSS
|
|
190
190
|
SCSS
|
191
191
|
end
|
192
192
|
|
193
|
+
def test_comment_after_if_directive
|
194
|
+
assert_equal <<CSS, render(<<SCSS)
|
195
|
+
foo {
|
196
|
+
a: b;
|
197
|
+
/* This is a comment */
|
198
|
+
c: d; }
|
199
|
+
CSS
|
200
|
+
foo {
|
201
|
+
@if true {a: b}
|
202
|
+
/* This is a comment */
|
203
|
+
c: d }
|
204
|
+
SCSS
|
205
|
+
assert_equal <<CSS, render(<<SCSS)
|
206
|
+
foo {
|
207
|
+
a: b;
|
208
|
+
/* This is a comment */
|
209
|
+
c: d; }
|
210
|
+
CSS
|
211
|
+
foo {
|
212
|
+
@if true {a: b}
|
213
|
+
@else {x: y}
|
214
|
+
/* This is a comment */
|
215
|
+
c: d }
|
216
|
+
SCSS
|
217
|
+
end
|
218
|
+
|
193
219
|
def test_while_directive
|
194
220
|
assert_equal <<CSS, render(<<SCSS)
|
195
221
|
.foo {
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 3
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 3.0.
|
8
|
+
- 14
|
9
|
+
version: 3.0.14
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Nathan Weizenbaum
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-07-26 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|