serbea 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/serbea/template_engine.rb +13 -1
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2403adca3b4cbb2e82ad7bb758df50c04257d45f1b303a1a9b03a15453d66953
|
4
|
+
data.tar.gz: 1ccfc568da131dd13d9cc627b05fb13577854d4edfbf2ea0a3353b69b097a5f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22633765cd7a2ce0020cdd27708e2bc349cc9ccd168d1d15f7f135926d4a0333098fa05ebd34b7f77811371620f01860d7876935e0be47160e03714f8efc01d6
|
7
|
+
data.tar.gz: 9c5a097fe9fdb43738e3d61f3d61d973d15bff640ad3ae85cc9fb670e61c4a31154f67522bf9651f65ec6a1e67bf755d1b50ea6bc2508b42dfe9dd6f24c627d3
|
@@ -76,6 +76,7 @@ module Serbea
|
|
76
76
|
|
77
77
|
buff << text
|
78
78
|
if code.length > 0
|
79
|
+
original_line_length = code.lines.size
|
79
80
|
processed_filters = false
|
80
81
|
|
81
82
|
code = code.gsub('\|', "__PIPE_C__")
|
@@ -90,7 +91,13 @@ module Serbea
|
|
90
91
|
|
91
92
|
pipeline_suffix = processed_filters ? ") %}" : ")) %}"
|
92
93
|
|
93
|
-
|
94
|
+
subs = subs.sub("{{", "{%= pipeline(self, (").sub("}}", pipeline_suffix).gsub("__PIPE_C__", '\|')
|
95
|
+
|
96
|
+
buff << subs
|
97
|
+
|
98
|
+
(original_line_length - subs.lines.size).times do
|
99
|
+
buff << "\n{% %}" # preserve original line length
|
100
|
+
end
|
94
101
|
end
|
95
102
|
end
|
96
103
|
|
@@ -113,6 +120,8 @@ module Serbea
|
|
113
120
|
code.sub! /^\{%@/, ""
|
114
121
|
code.sub! /%}$/, ""
|
115
122
|
unless ["end", ""].include? code.strip
|
123
|
+
original_line_length = code.lines.size
|
124
|
+
|
116
125
|
pieces = code.split(" ")
|
117
126
|
if pieces[0].start_with?(/[A-Z]/) # Ruby class name
|
118
127
|
pieces[0].prepend " "
|
@@ -136,6 +145,9 @@ module Serbea
|
|
136
145
|
pieces.last << ")"
|
137
146
|
buff << "{%= #{self.class.render_directive}#{pieces.join(" ")} %}"
|
138
147
|
end
|
148
|
+
(original_line_length - 1).times do
|
149
|
+
buff << "\n{% %}" # preserve original directive line length
|
150
|
+
end
|
139
151
|
else
|
140
152
|
buff << "{%: end %}"
|
141
153
|
end
|
data/lib/version.rb
CHANGED