haml 2.2.17 → 2.2.18
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/.yardopts +3 -0
- data/Rakefile +6 -6
- data/VERSION +1 -1
- data/extra/haml-mode.el +99 -13
- data/extra/sass-mode.el +2 -2
- data/lib/haml/engine.rb +1 -1
- data/lib/haml/exec.rb +13 -5
- data/lib/haml/filters.rb +1 -1
- data/lib/haml/helpers.rb +3 -2
- data/lib/haml/helpers/action_view_mods.rb +2 -1
- data/lib/haml/helpers/xss_mods.rb +43 -13
- data/lib/haml/html.rb +8 -0
- data/lib/haml/precompiler.rb +20 -1
- data/lib/haml/template.rb +2 -2
- data/lib/haml/util.rb +27 -0
- data/lib/sass/engine.rb +42 -2
- data/lib/sass/plugin.rb +5 -4
- data/lib/sass/plugin/rails.rb +2 -2
- data/lib/sass/script.rb +3 -0
- data/lib/sass/script/color.rb +4 -2
- data/lib/sass/script/lexer.rb +8 -5
- data/lib/sass/script/number.rb +2 -0
- data/lib/sass/script/parser.rb +1 -1
- data/lib/sass/tree/rule_node.rb +1 -0
- data/test/haml/engine_test.rb +21 -0
- data/test/haml/helper_test.rb +0 -0
- data/test/haml/html2haml_test.rb +0 -0
- data/test/haml/spec/lua_haml_spec.lua +1 -1
- data/test/haml/spec/tests.json +64 -18
- data/test/haml/template_test.rb +17 -3
- data/test/haml/util_test.rb +0 -0
- data/test/sass/css2sass_test.rb +1 -0
- data/test/sass/engine_test.rb +31 -0
- data/test/sass/functions_test.rb +1 -0
- data/test/sass/plugin_test.rb +28 -17
- data/test/sass/script_test.rb +7 -7
- data/test/sass/to_sass_test.rb +549 -0
- metadata +144 -142
data/.yardopts
CHANGED
data/Rakefile
CHANGED
@@ -72,14 +72,14 @@ task :install => [:package] do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
desc "Release a new Haml package to Rubyforge."
|
75
|
-
task :release => [:check_release, :
|
75
|
+
task :release => [:check_release, :package] do
|
76
76
|
name = File.read("VERSION_NAME").strip
|
77
77
|
version = File.read("VERSION").strip
|
78
78
|
#sh %{rubyforge login}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
sh %{rubyforge add_release haml haml "#{name} (v#{version})" pkg/haml-#{version}.gem}
|
80
|
+
sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.tar.gz}
|
81
|
+
sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.tar.bz2}
|
82
|
+
sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.zip}
|
83
83
|
sh %{gem push pkg/haml-#{version}.gem}
|
84
84
|
end
|
85
85
|
|
@@ -241,7 +241,7 @@ begin
|
|
241
241
|
list.exclude('lib/haml/template/*.rb')
|
242
242
|
list.exclude('lib/haml/helpers/action_view_mods.rb')
|
243
243
|
end.to_a
|
244
|
-
t.options << '--
|
244
|
+
t.options << '--incremental' if Rake.application.top_level_tasks.include?('redoc')
|
245
245
|
t.options += FileList.new('yard/*.rb').to_a.map {|f| ['-e', f]}.flatten
|
246
246
|
files = FileList.new('doc-src/*').to_a.sort_by {|s| s.size} + %w[MIT-LICENSE VERSION]
|
247
247
|
t.options << '--files' << files.join(',')
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.18
|
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: 2.2.
|
7
|
+
;; Version: 2.2.18
|
8
8
|
;; Created: 2007-03-08
|
9
9
|
;; By: Nathan Weizenbaum
|
10
10
|
;; Keywords: markup, language, html
|
@@ -25,6 +25,13 @@
|
|
25
25
|
(eval-when-compile (require 'cl))
|
26
26
|
(require 'ruby-mode)
|
27
27
|
|
28
|
+
;; Additional (optional) libraries for fontification
|
29
|
+
(require 'css-mode nil nil)
|
30
|
+
(require 'textile-mode nil nil)
|
31
|
+
(require 'markdown-mode nil nil)
|
32
|
+
(require 'javascript-mode "javascript" nil)
|
33
|
+
|
34
|
+
|
28
35
|
;; User definable variables
|
29
36
|
|
30
37
|
(defgroup haml nil
|
@@ -92,22 +99,33 @@ The line containing RE is matched, as well as all lines indented beneath it."
|
|
92
99
|
(defconst haml-font-lock-keywords
|
93
100
|
`((,(haml-nested-regexp "\\(?:-#\\|/\\).*") 0 font-lock-comment-face)
|
94
101
|
(,(haml-nested-regexp ":\\w+") 0 font-lock-string-face)
|
95
|
-
(haml-highlight-
|
96
|
-
(haml-highlight-
|
97
|
-
(haml-highlight-
|
98
|
-
(
|
99
|
-
(
|
100
|
-
(
|
102
|
+
(haml-highlight-ruby-filter-block 1 font-lock-preprocessor-face)
|
103
|
+
(haml-highlight-css-filter-block 1 font-lock-preprocessor-face)
|
104
|
+
(haml-highlight-textile-filter-block 1 font-lock-preprocessor-face)
|
105
|
+
(haml-highlight-markdown-filter-block 1 font-lock-preprocessor-face)
|
106
|
+
(haml-highlight-js-filter-block 1 font-lock-preprocessor-face)
|
107
|
+
(haml-highlight-interpolation 1 font-lock-variable-name-face prepend)
|
108
|
+
(haml-highlight-ruby-tag 1 font-lock-preprocessor-face)
|
109
|
+
(haml-highlight-ruby-script 1 font-lock-preprocessor-face)
|
110
|
+
("^ *\\(\t\\)" 1 'haml-tab-face)
|
111
|
+
("^!!!.*" 0 font-lock-constant-face)
|
112
|
+
("| *$" 0 font-lock-string-face)))
|
101
113
|
|
102
114
|
(defconst haml-filter-re "^ *:\\w+")
|
103
115
|
(defconst haml-comment-re "^ *\\(?:-\\#\\|/\\)")
|
104
116
|
|
105
|
-
(defun haml-fontify-region
|
106
|
-
"
|
117
|
+
(defun haml-fontify-region (beg end keywords syntax-table syntactic-keywords)
|
118
|
+
"Fontify a region between BEG and END using another mode's fontification.
|
119
|
+
|
120
|
+
KEYWORDS, SYNTAX-TABLE, and SYNTACTIC-KEYWORDS are the values of that mode's
|
121
|
+
`font-lock-keywords', `font-lock-syntax-table',
|
122
|
+
and `font-lock-syntactic-keywords', respectively."
|
107
123
|
(save-excursion
|
108
124
|
(save-match-data
|
109
|
-
(let ((font-lock-keywords
|
110
|
-
(font-lock-
|
125
|
+
(let ((font-lock-keywords keywords)
|
126
|
+
(font-lock-syntax-table syntax-table)
|
127
|
+
(font-lock-syntactic-keywords syntactic-keywords)
|
128
|
+
(font-lock-multiline 'undecided)
|
111
129
|
font-lock-keywords-only
|
112
130
|
font-lock-extend-region-functions
|
113
131
|
font-lock-keywords-case-fold-search)
|
@@ -115,6 +133,74 @@ The line containing RE is matched, as well as all lines indented beneath it."
|
|
115
133
|
;; so we have to move the beginning back one char
|
116
134
|
(font-lock-fontify-region (- beg 1) end)))))
|
117
135
|
|
136
|
+
(defun haml-fontify-region-as-ruby (beg end)
|
137
|
+
"Use Ruby's font-lock variables to fontify the region between BEG and END."
|
138
|
+
(haml-fontify-region beg end ruby-font-lock-keywords nil
|
139
|
+
ruby-font-lock-syntactic-keywords))
|
140
|
+
|
141
|
+
(defun haml-handle-filter (filter-name limit fn)
|
142
|
+
"If a FILTER-NAME filter is found within LIMIT, run FN on that filter.
|
143
|
+
|
144
|
+
FN is passed a pair of points representing the beginning and end
|
145
|
+
of the filtered text."
|
146
|
+
(when (re-search-forward (haml-nested-regexp (concat ":" filter-name)) limit t)
|
147
|
+
(funcall fn (+ 2 (match-beginning 2)) (match-end 2))))
|
148
|
+
|
149
|
+
(defun haml-fontify-filter-region (filter-name limit &rest fontify-region-args)
|
150
|
+
"If a FILTER-NAME filter is found within LIMIT, fontify it.
|
151
|
+
|
152
|
+
The fontification is done by passing FONTIFY-REGION-ARGS to
|
153
|
+
`haml-fontify-region'."
|
154
|
+
(haml-handle-filter filter-name limit
|
155
|
+
(lambda (beg end)
|
156
|
+
(apply 'haml-fontify-region
|
157
|
+
(append (list beg end)
|
158
|
+
fontify-region-args)))))
|
159
|
+
|
160
|
+
(defun haml-highlight-ruby-filter-block (limit)
|
161
|
+
"If a :ruby filter is found within LIMIT, highlight it."
|
162
|
+
(haml-handle-filter "ruby" limit 'haml-fontify-region-as-ruby))
|
163
|
+
|
164
|
+
(defun haml-highlight-css-filter-block (limit)
|
165
|
+
"If a :css filter is found within LIMIT, highlight it.
|
166
|
+
|
167
|
+
This requires that `css-mode' is available.
|
168
|
+
`css-mode' is included with Emacs 23."
|
169
|
+
(if (boundp 'css-font-lock-keywords)
|
170
|
+
(haml-fontify-filter-region "css" limit css-font-lock-keywords nil nil)))
|
171
|
+
|
172
|
+
(defun haml-highlight-js-filter-block (limit)
|
173
|
+
"If a :javascript filter is found within LIMIT, highlight it.
|
174
|
+
|
175
|
+
This requires that Karl Landström's \"javascript.el\" be available."
|
176
|
+
(if (boundp 'js-font-lock-keywords-3)
|
177
|
+
(haml-fontify-filter-region "javascript"
|
178
|
+
limit
|
179
|
+
js-font-lock-keywords-3
|
180
|
+
javascript-mode-syntax-table
|
181
|
+
nil)))
|
182
|
+
|
183
|
+
(defun haml-highlight-textile-filter-block (limit)
|
184
|
+
"If a :textile filter is found within LIMIT, highlight it.
|
185
|
+
|
186
|
+
This requires that `textile-mode' be available.
|
187
|
+
|
188
|
+
Note that the results are not perfect, since `textile-mode' expects
|
189
|
+
certain constructs such as \"h1.\" to be at the beginning of a line,
|
190
|
+
and indented Haml filters always have leading whitespace."
|
191
|
+
(if (boundp 'textile-font-lock-keywords)
|
192
|
+
(haml-fontify-filter-region "textile" limit textile-font-lock-keywords nil nil)))
|
193
|
+
|
194
|
+
(defun haml-highlight-markdown-filter-block (limit)
|
195
|
+
"If a :markdown filter is found within LIMIT, highlight it.
|
196
|
+
|
197
|
+
This requires that `markdown-mode' be available."
|
198
|
+
(if (boundp 'markdown-mode-font-lock-keywords)
|
199
|
+
(haml-fontify-filter-region "markdown" limit
|
200
|
+
markdown-mode-font-lock-keywords
|
201
|
+
markdown-mode-syntax-table
|
202
|
+
nil)))
|
203
|
+
|
118
204
|
(defun haml-highlight-ruby-script (limit)
|
119
205
|
"Highlight a Ruby script expression (-, =, or ~).
|
120
206
|
LIMIT works as it does in `re-search-forward'."
|
@@ -263,7 +349,7 @@ With ARG, do it that many times."
|
|
263
349
|
;; Move through multiline attrs
|
264
350
|
(when (eq (char-before) ?,)
|
265
351
|
(save-excursion
|
266
|
-
(while (progn (end-of-line) (eq (char-before) ?,) (not (eobp)))
|
352
|
+
(while (progn (end-of-line) (and (eq (char-before) ?,) (not (eobp))))
|
267
353
|
(forward-line))
|
268
354
|
|
269
355
|
(forward-line -1)
|
@@ -497,7 +583,7 @@ beginning the hash."
|
|
497
583
|
(save-excursion
|
498
584
|
(while t
|
499
585
|
(beginning-of-line)
|
500
|
-
(if (looking-at (
|
586
|
+
(if (looking-at (concat haml-tag-beg-re "\\([{(]\\)"))
|
501
587
|
(progn
|
502
588
|
(goto-char (- (match-end 0) 1))
|
503
589
|
(haml-limited-forward-sexp (save-excursion (end-of-line) (point)))
|
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: 2.2.
|
7
|
+
;; Version: 2.2.18
|
8
8
|
;; Created: 2007-03-15
|
9
9
|
;; By: Nathan Weizenbaum
|
10
10
|
;; Keywords: markup, language, css
|
11
|
-
;; Package-Requires: ((haml-mode "2.2.
|
11
|
+
;; Package-Requires: ((haml-mode "2.2.18"))
|
12
12
|
|
13
13
|
;;; Commentary:
|
14
14
|
|
data/lib/haml/engine.rb
CHANGED
@@ -134,7 +134,7 @@ module Haml
|
|
134
134
|
# Haml::Engine.new("%p= upcase").render(s) #=> "<p>FOOBAR</p>"
|
135
135
|
#
|
136
136
|
# # s now extends Haml::Helpers
|
137
|
-
# s.
|
137
|
+
# s.respond_to?(:html_attrs) #=> true
|
138
138
|
#
|
139
139
|
# `locals` is a hash of local variables to make available to the template.
|
140
140
|
# For example:
|
data/lib/haml/exec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'optparse'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'rbconfig'
|
3
4
|
|
4
5
|
module Haml
|
5
6
|
# This module handles the various Haml executables (`haml`, `sass`, `css2sass`, etc).
|
@@ -67,6 +68,12 @@ module Haml
|
|
67
68
|
@options[:trace] = true
|
68
69
|
end
|
69
70
|
|
71
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|windows/i
|
72
|
+
opts.on('--unix-newlines', 'Use Unix-style newlines in written files.') do
|
73
|
+
@options[:unix_newlines] = true
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
70
77
|
opts.on_tail("-?", "-h", "--help", "Show this message") do
|
71
78
|
puts opts
|
72
79
|
exit
|
@@ -105,6 +112,7 @@ module Haml
|
|
105
112
|
|
106
113
|
def open_file(filename, flag = 'r')
|
107
114
|
return if filename.nil?
|
115
|
+
flag = 'wb' if @options[:unix_newlines] && flag == 'w'
|
108
116
|
File.open(filename, flag)
|
109
117
|
end
|
110
118
|
end
|
@@ -214,9 +222,9 @@ END
|
|
214
222
|
'Output style. Can be nested (default), compact, compressed, or expanded.') do |name|
|
215
223
|
@options[:for_engine][:style] = name.to_sym
|
216
224
|
end
|
217
|
-
opts.on('-l', '--line-comments',
|
218
|
-
'
|
219
|
-
@options[:for_engine][:
|
225
|
+
opts.on('-l', '--line-numbers', '--line-comments',
|
226
|
+
'Emit comments in the generated CSS indicating the corresponding sass line.') do
|
227
|
+
@options[:for_engine][:line_numbers] = true
|
220
228
|
end
|
221
229
|
opts.on('-i', '--interactive',
|
222
230
|
'Run an interactive SassScript shell.') do
|
@@ -225,8 +233,8 @@ END
|
|
225
233
|
opts.on('-I', '--load-path PATH', 'Add a sass import path.') do |path|
|
226
234
|
@options[:for_engine][:load_paths] << path
|
227
235
|
end
|
228
|
-
opts.on('--cache-location', 'The path to put cached Sass files. Defaults to .sass-cache.') do |loc|
|
229
|
-
@options[:for_engine][:cache_location] =
|
236
|
+
opts.on('--cache-location PATH', 'The path to put cached Sass files. Defaults to .sass-cache.') do |loc|
|
237
|
+
@options[:for_engine][:cache_location] = loc
|
230
238
|
end
|
231
239
|
opts.on('-C', '--no-cache', "Don't cache to sassc files.") do
|
232
240
|
@options[:for_engine][:cache] = false
|
data/lib/haml/filters.rb
CHANGED
@@ -282,7 +282,7 @@ END
|
|
282
282
|
def compile(precompiler, text)
|
283
283
|
return if precompiler.options[:suppress_eval]
|
284
284
|
src = ::ERB.new(text).src.sub(/^#coding:.*?\n/, '').
|
285
|
-
sub(/^_erbout = '';/, "")
|
285
|
+
sub(/^_erbout = '';/, "")
|
286
286
|
precompiler.send(:push_silent, src)
|
287
287
|
end
|
288
288
|
end
|
data/lib/haml/helpers.rb
CHANGED
@@ -338,12 +338,12 @@ MESSAGE
|
|
338
338
|
haml_buffer.capture_position = nil
|
339
339
|
end
|
340
340
|
|
341
|
-
# @deprecated This will be removed in version
|
341
|
+
# @deprecated This will be removed in version 3.0.
|
342
342
|
# @see #haml_concat
|
343
343
|
def puts(*args)
|
344
344
|
warn <<END
|
345
345
|
DEPRECATION WARNING:
|
346
|
-
The Haml #puts helper is deprecated and will be removed in version
|
346
|
+
The Haml #puts helper is deprecated and will be removed in version 3.0.
|
347
347
|
Use the #haml_concat helper instead.
|
348
348
|
END
|
349
349
|
haml_concat(*args)
|
@@ -462,6 +462,7 @@ END
|
|
462
462
|
end
|
463
463
|
|
464
464
|
# Characters that need to be escaped to HTML entities from user input
|
465
|
+
# @private
|
465
466
|
HTML_ESCAPE = { '&'=>'&', '<'=>'<', '>'=>'>', '"'=>'"', "'"=>''', }
|
466
467
|
|
467
468
|
# Returns a copy of `text` with ampersands, angle brackets and quotes
|
@@ -26,7 +26,8 @@ module ActionView
|
|
26
26
|
|
27
27
|
def set_output_buffer_with_haml(new)
|
28
28
|
if is_haml?
|
29
|
-
new = String.new(new) if Haml::Util.rails_xss_safe? &&
|
29
|
+
new = String.new(new) if Haml::Util.rails_xss_safe? &&
|
30
|
+
new.is_a?(Haml::Util.rails_safe_buffer_class)
|
30
31
|
haml_buffer.buffer = new
|
31
32
|
else
|
32
33
|
set_output_buffer_without_haml new
|
@@ -19,45 +19,46 @@ module Haml
|
|
19
19
|
def html_escape_with_haml_xss(text)
|
20
20
|
str = text.to_s
|
21
21
|
return text if str.html_safe?
|
22
|
-
html_escape_without_haml_xss(str)
|
22
|
+
Haml::Util.html_safe(html_escape_without_haml_xss(str))
|
23
23
|
end
|
24
24
|
|
25
25
|
# Output is always HTML safe
|
26
26
|
def find_and_preserve_with_haml_xss(*args, &block)
|
27
|
-
find_and_preserve_without_haml_xss(*args, &block)
|
27
|
+
Haml::Util.html_safe(find_and_preserve_without_haml_xss(*args, &block))
|
28
28
|
end
|
29
29
|
|
30
30
|
# Output is always HTML safe
|
31
31
|
def preserve_with_haml_xss(*args, &block)
|
32
|
-
preserve_without_haml_xss(*args, &block)
|
32
|
+
Haml::Util.html_safe(preserve_without_haml_xss(*args, &block))
|
33
33
|
end
|
34
34
|
|
35
35
|
# Output is always HTML safe
|
36
36
|
def list_of_with_haml_xss(*args, &block)
|
37
|
-
list_of_without_haml_xss(*args, &block)
|
37
|
+
Haml::Util.html_safe(list_of_without_haml_xss(*args, &block))
|
38
38
|
end
|
39
39
|
|
40
40
|
# Input is escaped, output is always HTML safe
|
41
41
|
def surround_with_haml_xss(front, back = front, &block)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
Haml::Util.html_safe(
|
43
|
+
surround_without_haml_xss(
|
44
|
+
haml_xss_html_escape(front),
|
45
|
+
haml_xss_html_escape(back),
|
46
|
+
&block))
|
46
47
|
end
|
47
48
|
|
48
49
|
# Input is escaped, output is always HTML safe
|
49
50
|
def precede_with_haml_xss(str, &block)
|
50
|
-
precede_without_haml_xss(haml_xss_html_escape(str), &block)
|
51
|
+
Haml::Util.html_safe(precede_without_haml_xss(haml_xss_html_escape(str), &block))
|
51
52
|
end
|
52
53
|
|
53
54
|
# Input is escaped, output is always HTML safe
|
54
55
|
def succeed_with_haml_xss(str, &block)
|
55
|
-
succeed_without_haml_xss(haml_xss_html_escape(str), &block)
|
56
|
+
Haml::Util.html_safe(succeed_without_haml_xss(haml_xss_html_escape(str), &block))
|
56
57
|
end
|
57
58
|
|
58
59
|
# Output is always HTML safe
|
59
60
|
def capture_haml_with_haml_xss(*args, &block)
|
60
|
-
capture_haml_without_haml_xss(*args, &block)
|
61
|
+
Haml::Util.html_safe(capture_haml_without_haml_xss(*args, &block))
|
61
62
|
end
|
62
63
|
|
63
64
|
# Input is escaped
|
@@ -67,7 +68,7 @@ module Haml
|
|
67
68
|
|
68
69
|
# Output is always HTML safe
|
69
70
|
def haml_indent_with_haml_xss
|
70
|
-
|
71
|
+
Haml::Util.html_safe(haml_indent_without_haml_xss)
|
71
72
|
end
|
72
73
|
|
73
74
|
# Input is escaped, haml_concat'ed output is always HTML safe
|
@@ -79,7 +80,7 @@ module Haml
|
|
79
80
|
|
80
81
|
# Output is always HTML safe
|
81
82
|
def escape_once_with_haml_xss(*args)
|
82
|
-
escape_once_without_haml_xss(*args)
|
83
|
+
Haml::Util.html_safe(escape_once_without_haml_xss(*args))
|
83
84
|
end
|
84
85
|
|
85
86
|
private
|
@@ -93,3 +94,32 @@ module Haml
|
|
93
94
|
end
|
94
95
|
end
|
95
96
|
end
|
97
|
+
|
98
|
+
module ActionView
|
99
|
+
module Helpers
|
100
|
+
module TextHelper
|
101
|
+
def concat_with_haml(string)
|
102
|
+
if is_haml?
|
103
|
+
haml_buffer.buffer.concat(haml_xss_html_escape(string))
|
104
|
+
else
|
105
|
+
concat_without_haml(string)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
alias_method :concat_without_haml, :concat
|
109
|
+
alias_method :concat, :concat_with_haml
|
110
|
+
|
111
|
+
# safe_concat was introduced in Rails 3.0
|
112
|
+
if Haml::Util.has?(:instance_method, self, :safe_concat)
|
113
|
+
def safe_concat_with_haml(string)
|
114
|
+
if is_haml?
|
115
|
+
haml_buffer.buffer.concat(string)
|
116
|
+
else
|
117
|
+
concat_without_haml(string)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
alias_method :safe_concat_without_haml, :safe_concat
|
121
|
+
alias_method :safe_concat, :safe_concat_with_haml
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/lib/haml/html.rb
CHANGED
@@ -47,6 +47,7 @@ end
|
|
47
47
|
|
48
48
|
# Haml monkeypatches various Hpricot classes
|
49
49
|
# to add methods for conversion to Haml.
|
50
|
+
# @private
|
50
51
|
module Hpricot
|
51
52
|
# @see Hpricot
|
52
53
|
module Node
|
@@ -102,9 +103,11 @@ module Haml
|
|
102
103
|
end
|
103
104
|
alias_method :to_haml, :render
|
104
105
|
|
106
|
+
# @private
|
105
107
|
TEXT_REGEXP = /^(\s*).*$/
|
106
108
|
|
107
109
|
# @see Hpricot
|
110
|
+
# @private
|
108
111
|
class ::Hpricot::Doc
|
109
112
|
# @see Haml::HTML::Node#to_haml
|
110
113
|
def to_haml(tabs, options)
|
@@ -113,6 +116,7 @@ module Haml
|
|
113
116
|
end
|
114
117
|
|
115
118
|
# @see Hpricot
|
119
|
+
# @private
|
116
120
|
class ::Hpricot::XMLDecl
|
117
121
|
# @see Haml::HTML::Node#to_haml
|
118
122
|
def to_haml(tabs, options)
|
@@ -121,6 +125,7 @@ module Haml
|
|
121
125
|
end
|
122
126
|
|
123
127
|
# @see Hpricot
|
128
|
+
# @private
|
124
129
|
class ::Hpricot::CData
|
125
130
|
# @see Haml::HTML::Node#to_haml
|
126
131
|
def to_haml(tabs, options)
|
@@ -129,6 +134,7 @@ module Haml
|
|
129
134
|
end
|
130
135
|
|
131
136
|
# @see Hpricot
|
137
|
+
# @private
|
132
138
|
class ::Hpricot::DocType
|
133
139
|
# @see Haml::HTML::Node#to_haml
|
134
140
|
def to_haml(tabs, options)
|
@@ -160,6 +166,7 @@ module Haml
|
|
160
166
|
end
|
161
167
|
|
162
168
|
# @see Hpricot
|
169
|
+
# @private
|
163
170
|
class ::Hpricot::Comment
|
164
171
|
# @see Haml::HTML::Node#to_haml
|
165
172
|
def to_haml(tabs, options)
|
@@ -168,6 +175,7 @@ module Haml
|
|
168
175
|
end
|
169
176
|
|
170
177
|
# @see Hpricot
|
178
|
+
# @private
|
171
179
|
class ::Hpricot::Elem
|
172
180
|
# @see Haml::HTML::Node#to_haml
|
173
181
|
def to_haml(tabs, options)
|