utopia 0.9.20 → 0.9.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,11 +162,11 @@ module Utopia
162
162
 
163
163
  def tag(name, attributes, &block)
164
164
  tag = Tag.new(name, attributes)
165
-
165
+
166
166
  node = tag_begin(tag)
167
-
167
+
168
168
  yield node if block_given?
169
-
169
+
170
170
  tag_end(tag)
171
171
  end
172
172
 
@@ -186,7 +186,6 @@ module Utopia
186
186
  end
187
187
 
188
188
  def tag_begin(tag, node = nil)
189
- # LOG.debug("tag_begin: #{tag}")
190
189
  node ||= lookup(tag)
191
190
 
192
191
  if node
@@ -206,7 +205,6 @@ module Utopia
206
205
  end
207
206
 
208
207
  def cdata(text)
209
- # LOG.debug("cdata: #{text}")
210
208
  current.cdata(text)
211
209
  end
212
210
 
@@ -214,8 +212,6 @@ module Utopia
214
212
  top = current
215
213
 
216
214
  if top.tags.empty?
217
- # LOG.debug("tag_end: #{top.inspect}")
218
-
219
215
  if top.node.respond_to? :tag_end
220
216
  top.node.tag_end(self, top)
221
217
  end
@@ -232,7 +228,6 @@ module Utopia
232
228
 
233
229
  return buffer
234
230
  else
235
- # LOG.debug("tag_end: #{tag}")
236
231
  current.tag_end(tag)
237
232
  end
238
233
 
@@ -51,6 +51,10 @@ class Utopia::Tags::Gallery
51
51
  @original_path
52
52
  end
53
53
 
54
+ # def basename
55
+ # @original_path.basename
56
+ # end
57
+
54
58
  def self.append_suffix(name, suffix)
55
59
  name.split(".").insert(-2, suffix).join(".")
56
60
  end
@@ -161,9 +165,12 @@ class Utopia::Tags::Gallery
161
165
  filter = Regexp.new(state["filter"]) if state["filter"]
162
166
 
163
167
  transaction.tag("div", "class" => "gallery") do |node|
164
- images = gallery.images(options).sort_by do |path|
165
- name = path.original.basename
166
- metadata[name]["order"] || name
168
+ images = gallery.images(options).sort do |a, b|
169
+ if (metadata[a.original.basename]["order"] && metadata[b.original.basename]["order"])
170
+ metadata[a.original.basename]["order"] <=> metadata[b.original.basename]["order"]
171
+ else
172
+ a.original.basename <=> b.original.basename
173
+ end
167
174
  end
168
175
 
169
176
  images.each do |path|
@@ -17,7 +17,7 @@ module Utopia
17
17
  module VERSION #:nodoc:
18
18
  MAJOR = 0
19
19
  MINOR = 9
20
- TINY = 20
20
+ TINY = 21
21
21
 
22
22
  STRING = [MAJOR, MINOR, TINY].join('.')
23
23
  end
@@ -49,7 +49,6 @@ module Utopia
49
49
  end
50
50
 
51
51
  def cdata(text)
52
- # $stderr.puts "\tcdata: #{text}"
53
52
  @delegate.cdata(text)
54
53
  end
55
54
 
@@ -58,7 +57,6 @@ module Utopia
58
57
  end
59
58
 
60
59
  def begin_tag(tag_name, begin_tag_type)
61
- # $stderr.puts "begin_tag: #{tag_name}, #{begin_tag_type}"
62
60
  if begin_tag_type == OPENED_TAG
63
61
  @stack << [Tag.new(tag_name, {}), @scanner.pos]
64
62
  else
@@ -73,12 +71,11 @@ module Utopia
73
71
  end
74
72
 
75
73
  def finish_tag(begin_tag_type, end_tag_type)
76
- # $stderr.puts "finish_tag: #{begin_tag_type} #{end_tag_type}"
77
74
  if begin_tag_type == OPENED_TAG # <...
78
75
  if end_tag_type == CLOSED_TAG # <.../>
79
76
  cur, pos = @stack.pop
80
77
  cur.closed = true
81
-
78
+
82
79
  @delegate.tag_complete(cur)
83
80
  elsif end_tag_type == OPENED_TAG # <...>
84
81
  cur, pos = @stack.last
@@ -89,9 +86,12 @@ module Utopia
89
86
  end
90
87
 
91
88
  def attribute(name, value)
92
- # $stderr.puts "\tattribute: #{name} = #{value}"
93
89
  @stack.last[0].attributes[name] = value
94
90
  end
91
+
92
+ def instruction(content)
93
+ cdata("<?#{content}?>")
94
+ end
95
95
  end
96
96
  end
97
97
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 20
9
- version: 0.9.20
8
+ - 21
9
+ version: 0.9.21
10
10
  platform: ruby
11
11
  authors:
12
12
  - Samuel Williams
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-24 00:00:00 +13:00
17
+ date: 2010-03-26 00:00:00 +13:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency