sunflower 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/sunflower/core.rb +4 -17
- metadata +2 -2
data/README
CHANGED
data/lib/sunflower/core.rb
CHANGED
@@ -17,7 +17,7 @@ require 'cgi'
|
|
17
17
|
#
|
18
18
|
# You can use multiple Sunflowers at once, to work on multiple wikis.
|
19
19
|
class Sunflower
|
20
|
-
VERSION = '0.5.
|
20
|
+
VERSION = '0.5.2'
|
21
21
|
|
22
22
|
INVALID_CHARS = %w(# < > [ ] | { })
|
23
23
|
INVALID_CHARS_REGEX = Regexp.union *INVALID_CHARS
|
@@ -303,7 +303,7 @@ class Sunflower
|
|
303
303
|
name, anchor = title.split '#', 2
|
304
304
|
|
305
305
|
# CGI.unescape also changes pluses to spaces; code borrowed from there
|
306
|
-
unescape = lambda{|a| a.gsub(/((?:%[0-9a-fA-F]{2})+)/){ [$1.delete('%')].pack('H*') } }
|
306
|
+
unescape = lambda{|a| a.gsub(/((?:%[0-9a-fA-F]{2})+)/){ [$1.delete('%')].pack('H*').force_encoding($1.encoding) } }
|
307
307
|
|
308
308
|
ns = nil
|
309
309
|
name = unescape.call(name).gsub(/[ _]+/, ' ').strip
|
@@ -422,9 +422,6 @@ class Sunflower::Page
|
|
422
422
|
def initialize title='', url=''
|
423
423
|
raise Sunflower::Error, 'title invalid: '+title if title =~ INVALID_CHARS_REGEX
|
424
424
|
|
425
|
-
@modulesExecd=[] #used by sunflower-commontasks.rb
|
426
|
-
@summaryAppend=[] #used by sunflower-commontasks.rb
|
427
|
-
|
428
425
|
case url
|
429
426
|
when Sunflower
|
430
427
|
@sunflower = url
|
@@ -498,21 +495,11 @@ class Sunflower::Page
|
|
498
495
|
# Will call #code_cleanup if Sunflower#always_do_code_cleanup is set.
|
499
496
|
#
|
500
497
|
# Returns the JSON result of API call or nil when API call was not made.
|
501
|
-
def save title=@title, summary
|
498
|
+
def save title=@title, summary=@sunflower.summary
|
502
499
|
preload_attrs unless @preloaded_attrs
|
503
500
|
|
504
|
-
summary = @sunflower.summary if !summary
|
505
|
-
|
506
501
|
raise Sunflower::Error, 'title invalid: '+title if title =~ INVALID_CHARS_REGEX
|
507
|
-
raise Sunflower::Error, 'no summary!' if
|
508
|
-
|
509
|
-
unless @summaryAppend.empty?
|
510
|
-
if !summary or summary==''
|
511
|
-
summary = @summaryAppend.uniq.join(', ')
|
512
|
-
else
|
513
|
-
summary = summary.sub(/,\s*\Z/, '') + ', ' + @summaryAppend.uniq.join(', ')
|
514
|
-
end
|
515
|
-
end
|
502
|
+
raise Sunflower::Error, 'empty or no summary!' if !summary or summary==''
|
516
503
|
|
517
504
|
if @orig_text==@text && title==@title
|
518
505
|
@sunflower.log('Page '+title+' not saved - no changes.')
|
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.
|
4
|
+
version: 0.5.2
|
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-
|
12
|
+
date: 2012-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|