soywiki 0.3.0 → 0.3.1

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/bin/soywiki-rename CHANGED
@@ -13,12 +13,12 @@ end
13
13
  def change_all_absolute_links(oldname, newname)
14
14
  MEMO << "- Updating all absolute links"
15
15
  target_files = `grep -rlF '#{oldname.to_page_title}' *`.strip.split(/\n/)
16
- target_files.each do |file|
16
+ target_files.select {|f| f !~ /(\.swp|\.swo)$/}.each do |file|
17
17
  text = File.read(file)
18
18
  begin
19
19
  regex = /\b#{oldname.to_page_title}\b/
20
20
  matches = text.scan(regex)
21
- text.gsub!(regex, newname.to_page_title)
21
+ text = text.gsub(regex, newname.to_page_title)
22
22
  File.open(file, 'w') {|f| f.puts text}
23
23
  report file, oldname.to_page_title, newname.to_page_title
24
24
  rescue
@@ -30,10 +30,10 @@ end
30
30
  def change_unqualified_inbound_links_in_same_namespace(oldname, newname)
31
31
  MEMO << "- Updating unqualified inbound links"
32
32
  target_files = `grep -rlF '[^.]#{oldname.short_page_title}' #{oldname.namespace}/*`.strip.split(/\n/)
33
- target_files.each do |file|
33
+ target_files.select {|f| f !~ /(\.swp|\.swo)$/}.each do |file|
34
34
  text = File.read(file)
35
35
  begin
36
- text.gsub!(/(\A|\s)#{oldname.short_page_title}\b/, "." + newname)
36
+ text = text.gsub(/(\A|\s)#{oldname.short_page_title}\b/, "." + newname)
37
37
  File.open(file, 'w') {|f| f.puts text}
38
38
  report file, oldname.short_page_title, newname
39
39
  rescue
@@ -42,7 +42,7 @@ def change_unqualified_inbound_links_in_same_namespace(oldname, newname)
42
42
  end
43
43
  end
44
44
 
45
- RELATIVE_LINK_REGEX =/(\A\s)([A-Z][a-z]+[A-Z]\w*)/
45
+ RELATIVE_LINK_REGEX =/(\A|\s)([A-Z][a-z]+[A-Z]\w*)/
46
46
 
47
47
  def absolutize_unqualified_outbound_links(oldname, newname)
48
48
  MEMO << "Absolutizing unqualified inbound links"
@@ -51,7 +51,7 @@ def absolutize_unqualified_outbound_links(oldname, newname)
51
51
  text = File.read(target_file)
52
52
  begin
53
53
  matches = text.scan(RELATIVE_LINK_REGEX)
54
- text.gsub!(RELATIVE_LINK_REGEX, oldname.namespace + '.\1')
54
+ text = text.gsub(RELATIVE_LINK_REGEX, oldname.namespace + '.\1')
55
55
  File.open(target_file, 'w') {|f| f.puts text}
56
56
  MEMO << " - In file #{target_file}: Absolutized these unqualified links: #{matches.inspect}"
57
57
  rescue
@@ -71,10 +71,10 @@ end
71
71
  if oldname.namespace == newname.namespace
72
72
  MEMO << "- Updating unqualified links in same namespace"
73
73
  target_files = `grep -rlF '#{oldname.short_page_title}' #{oldname.namespace}/*`.strip.split(/\n/)
74
- target_files.each do |file|
74
+ target_files.select {|f| f !~ /(\.swp|\.swo)$/}.each do |file|
75
75
  text = File.read(file)
76
76
  begin
77
- text.gsub!(/(\A\s)(#{oldname.short_page_title})\b/, newname.short_page_title)
77
+ text = text.gsub(/(\A|\s)(#{oldname.short_page_title})\b/, newname.short_page_title)
78
78
  File.open(file, 'w') {|f| f.puts text}
79
79
  report file, oldname.short_page_title, newname.short_page_title
80
80
  rescue
data/lib/soywiki.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'string_ext'
2
2
 
3
3
  module Soywiki
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  WIKI_WORD = /\b([a-z][\w_]+\.)?[A-Z][a-z]+[A-Z]\w*\b/
6
6
  HYPERLINK = %r|\bhttps?://[^ >)\n\]]+|
7
7
 
data/lib/soywiki.vim CHANGED
@@ -239,8 +239,9 @@ func! s:rename_page(page_path_or_title)
239
239
  write!
240
240
  let original_file = bufname('')
241
241
  echo system("git mv " . original_file . " " . newfile)
242
+ call system("git commit -am 'rename wiki page'")
242
243
  exec "!" . s:rename_links_command . original_file . " " . newfile
243
- call system("git commit -am 'rename wiki page and links'")
244
+ call system("git commit -am 'rename wiki links'")
244
245
  exec "e " . newfile
245
246
  else
246
247
  call s:display_invalid_wiki_word_error(page_title)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi