sunflower 0.5.5 → 0.5.6

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.
data/README CHANGED
@@ -1,4 +1,4 @@
1
- Version: 0.5.5 alpha
1
+ Version: 0.5.6 alpha
2
2
 
3
3
  >>> English:
4
4
 
@@ -40,7 +40,7 @@ end
40
40
  #
41
41
  # You can use multiple Sunflowers at once, to work on multiple wikis.
42
42
  class Sunflower
43
- VERSION = '0.5.5'
43
+ VERSION = '0.5.6'
44
44
 
45
45
  INVALID_CHARS = %w(# < > [ ] | { })
46
46
  INVALID_CHARS_REGEX = Regexp.union *INVALID_CHARS
@@ -46,7 +46,7 @@ class Sunflower::List < Array
46
46
  # it will not blow up or return incorrect results; however, text of some other
47
47
  # pages may be missing (it will be lazy-loaded when requested, as usual).
48
48
  def pages_preloaded
49
- pgs = self.pages
49
+ pgs = self.pages.sort_by{|a| a.title}
50
50
  at_once = @sunflower.is_bot? ? 500 : 50
51
51
 
52
52
  # this is different from self; page titles are guaranteed to be canonicalized
@@ -54,10 +54,12 @@ class Sunflower::List < Array
54
54
 
55
55
  titles.each_slice(at_once).with_index do |slice, slice_no|
56
56
  res = @sunflower.API('action=query&prop=revisions&rvprop=content&titles='+CGI.escape(slice.join '|'))
57
- res['query']['pages'].values.each_with_index do |h, i|
57
+ res['query']['pages'].values.sort_by{|h| h['title'] || '' }.each_with_index do |h, i|
58
58
  page = pgs[slice_no*at_once + i]
59
59
 
60
60
  if h['title'] and h['title'] == page.title
61
+ page.preloaded_text = true
62
+
61
63
  if h['missing']
62
64
  page.text = ''
63
65
  elsif h['invalid']
@@ -65,8 +67,6 @@ class Sunflower::List < Array
65
67
  else
66
68
  page.text = h['revisions'][0]['*']
67
69
  end
68
-
69
- page.preloaded_text = true
70
70
  end
71
71
  end
72
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunflower
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-27 00:00:00.000000000 Z
12
+ date: 2012-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json